Crates.io | sproutml |
lib.rs | sproutml |
version | 0.1.1 |
source | src |
created_at | 2024-04-17 15:41:47.997982 |
updated_at | 2024-04-17 15:48:32.118076 |
description | A simple Machine Learning Library built in Rust |
homepage | |
repository | https://github.com/Chigo042823/Sprout |
max_upload_size | |
id | 1211504 |
size | 76,496 |
use Sprouts::{Layer::{Layer, LayerType}, network::Network, activation::ActivationFunction::*, loss_function::LossType::*}
let layers = vec![
Layer::dense([2, 3], Sigmoid),
Layer::dense([3, 1], Sigmoid),
];
// Network::new(layers, learning_rate, batch_size, loss_function);
let nn = Network::new(layers, 0.2, 1, MSE);
//Prints network's loss and epoch progress in the terminal
nn.dense_train(true);
//data: Vec<[Inputs, Outputs]>
let data: Vec<[Vec<f64>; 2]> = vec![
[vec![1.0, 0.0], vec![0.0]],
[vec![0.0, 0.0], vec![1.0]],
[vec![1.0, 1.0], vec![1.0]],
[vec![0.0, 1.0], vec![0.0]],
];
//dense_train(data, epochs)
nn.dense_train(data.clone(), 10000);
for i in 0..data.len() {
println!("Input: {:?} || Output: {:?} || Target: {:?}",data[i][0].clone(), nn.dense_forward(data[i][0].clone()), data[i][1].clone());
}
As of now the only supported layers are conv and dense layers, pooling layers are next on the agenda.
will expound readme soon...
This project is licensed under the MIT License.