5 releases
0.1.4 | Dec 13, 2023 |
---|---|
0.1.3 | Dec 4, 2023 |
0.1.2 | Dec 4, 2023 |
0.1.1 | Dec 4, 2023 |
0.1.0 | Dec 4, 2023 |
#695 in Machine learning
42 downloads per month
15KB
208 lines
Only Brain
A very simple Neural Network library built in Rust with the objective to allow the user to create, manipulate and train a neural network directly. The user has direct access to weights and biases of the network, allowing they to manipulate the NN as wanted.
Usage
use no_brain::NeuralNetwork;
use nalgebra::dmatrix;
use nalgebra::dvector;
fn main() {
let mut nn = NeuralNetwork::new(&vec![2, 2, 1]);
nn.set_layer_weights(1, dmatrix![0.1, 0.2;
0.3, 0.4]);
nn.set_layer_biases(1, dvector![0.1, 0.2]);
nn.set_layer_weights(2, dmatrix![0.9, 0.8]);
nn.set_layer_biases(2, dvector![0.1]);
let input = vec![0.5, 0.2];
let output = nn.feed_forward(&input);
println!("{:?}", output);
}
lib.rs
:
No Brain
A very simple Neural Network library built in Rust with the objective to allow the user to create, manipulate and train a neural network directly. The user has direct access to weights and biases of the network, allowing him to implement his own training methods.
Example
use no_brain::NeuralNetwork;
use nalgebra::dmatrix;
use nalgebra::dvector;
fn main() {
let mut nn = NeuralNetwork::new(&vec![2, 2, 1]);
nn.set_layer_weights(1, dmatrix![0.1, 0.2;
0.3, 0.4]);
nn.set_layer_biases(1, dvector![0.1, 0.2]);
nn.set_layer_weights(2, dmatrix![0.9, 0.8]);
nn.set_layer_biases(2, dvector![0.1]);
let input = vec![0.5, 0.2];
let output = nn.feed_forward(&input);
println!("{:?}", output);
}
Dependencies
~4.5MB
~89K SLoC