You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-**Preprocessing**: Label Encoding, One-Hot Encoding, Standard Scaler, Min-Max Scaler
41
41
-**Regularizers**: L1, L2, Combined L1-L2
@@ -103,39 +103,78 @@ C-ML/
103
103
104
104
## Usage
105
105
106
-
The `main.c` file demonstrates how to use the library to create a simple neural network. Below is an example:
106
+
The `main.c` file demonstrates how to use the library to create a simple neural network with a dense layer, ReLU activation, and mean squared error loss.
This section documents the core modules of the C-ML library, which provide essential functionalities for building and training neural networks.
4
+
5
+
## Training Module
6
+
7
+
-**Description**: Provides functions for creating, building, training, and evaluating neural networks.
8
+
-**Functions**:
9
+
-`NeuralNetwork *create_neural_network(int input_size)`: Creates a new neural network.
10
+
-`CM_Error build_network(NeuralNetwork *network, OptimizerType optimizer_type, float learning_rate, int loss_function, float l1_lambda, float l2_lambda)`: Builds the neural network by setting the optimizer, loss function, and regularization parameters.
11
+
-`CM_Error add_layer(NeuralNetwork *network, LayerConfig config)`: Adds a layer to the neural network.
12
+
-`CM_Error model_add(NeuralNetwork *network, LayerType type, ActivationType activation, int input_size, int output_size, float rate, int kernel_size, int stride)`: Adds a layer to the neural network using a simplified interface.
13
+
-`CM_Error forward_pass(NeuralNetwork *network, float *input, float *output, int input_size, int output_size, int is_training)`: Performs a forward pass through the network.
14
+
-`float calculate_loss(float *predicted, float *actual, int size, LossType loss_type)`: Calculates the loss between predicted and actual values.
15
+
-`void calculate_loss_gradient(float *predicted, float *actual, float *gradient, int size, LossType loss_type)`: Calculates the gradient of the loss function.
16
+
-`CM_Error train_network(NeuralNetwork *network, float **X_train, float **y_train, int num_samples, int input_size, int output_size, int batch_size, int epochs)`: Trains the neural network.
17
+
-`CM_Error evaluate_network(NeuralNetwork *network, float **X_test, float **y_test, int num_samples, int input_size, int output_size, int *metrics, int num_metrics, float *results)`: Evaluates the neural network on a given dataset.
18
+
-`CM_Error test_network(NeuralNetwork *network, float **X_test, float **y_test, int num_samples, int input_size, int output_size, int *metrics, int num_metrics, float *results)`: Tests the neural network (alias for evaluate_network).
19
+
-`CM_Error free_neural_network(NeuralNetwork *network)`: Frees memory allocated for the neural network.
20
+
-`void summary(NeuralNetwork *network)`: Prints a summary of the neural network architecture.
0 commit comments