2 releases
0.1.1 | Mar 4, 2022 |
---|---|
0.1.0 | Mar 4, 2022 |
#633 in Machine learning
7KB
87 lines
syron
syron is a Rust library designed to make simple neural networks with ease.
Example
use syron::nn::{Network, Activation};
fn main() {
// XOR Problem
let x = ndarray::arr2(&[[0.0, 0.0], [0.0, 1.0], [1.0, 0.0], [1.0, 1.0]]);
let y = ndarray::arr2(&[[0.0], [1.0], [1.0], [0.0]]);
// Create a network with 2 inputs and 3 hidden layers
let mut nn = Network::new(2, 3, Activation::Sigmoid);
nn.train(x, y, 1000);
println!("{:?}", nn.predict(ndarray::arr2(&[[0.0, 0.0]])));
}
lib.rs
:
syron is a Rust library designed to make simple neural networks with ease.
Example
use syron::nn::{Network, Activation};
fn main() {
// XOR Problem
let x = ndarray::arr2(&[[0.0, 0.0], [0.0, 1.0], [1.0, 0.0], [1.0, 1.0]]);
let y = ndarray::arr2(&[[0.0], [1.0], [1.0], [0.0]]);
// Create a network with 2 inputs and 3 hidden layers
let mut nn = Network::new(2, 3, Activation::Sigmoid);
nn.train(x, y, 1000);
println!("{:?}", nn.predict(ndarray::arr2(&[[0.0, 0.0]])));
}
Dependencies
~2.5MB
~45K SLoC