|
solidc
Robust collection of general-purpose cross-platform C libraries and data structures designed for rapid and safe development in C
|
Simple Machine Learning library using 4x4 Matrices and Vectors. More...
Go to the source code of this file.
Classes | |
| struct | ML_Layer |
| Represents a single fully connected layer 4 inputs -> 4 outputs. More... | |
| struct | ML_Network |
| A neural network composed of multiple layers. More... | |
Functions | |
| void | ml_init (ML_Network *net, int num_layers, float learning_rate) |
| Initialize a new network. | |
| Vec4 | ml_forward (ML_Network *net, Vec4 input) |
| Perform forward propagation. | |
| float | ml_train_step (ML_Network *net, Vec4 input, Vec4 target) |
| Train the network on a single sample. | |
Simple Machine Learning library using 4x4 Matrices and Vectors.
Demonstrates a real-world use case for the vector and matrix libraries. Implements a simple Feed-Forward Neural Network (MLP) with Sigmoid activation.
Limitations:
Definition in file ml.h.
| Vec4 ml_forward | ( | ML_Network * | net, |
| Vec4 | input | ||
| ) |
Perform forward propagation.
| net | Pointer to the network. |
| input | Input vector (4 floats). |
Definition at line 47 of file ml.c.
References ml_forward().
Referenced by ml_forward(), and ml_train_step().
| void ml_init | ( | ML_Network * | net, |
| int | num_layers, | ||
| float | learning_rate | ||
| ) |
Initialize a new network.
| net | Pointer to the network struct. |
| num_layers | Number of layers to create. |
| learning_rate | Learning rate for gradient descent. |
Definition at line 36 of file ml.c.
References ml_init().
Referenced by ml_init().
| float ml_train_step | ( | ML_Network * | net, |
| Vec4 | input, | ||
| Vec4 | target | ||
| ) |
Train the network on a single sample.
| net | Pointer to the network. |
| input | Input vector. |
| target | Target output vector. |
Definition at line 74 of file ml.c.
References ml_forward(), ml_train_step(), Vec4::w, Vec4::x, Vec4::y, and Vec4::z.
Referenced by ml_train_step().