A modular rust written library for training simple Neuronal Networks.
- Modular layer system
- Multiple activation functions (ReLU, Sigmoid, Softmax)
- Multiple cost functions (MSE, CrossEntropy, BinaryCrossEntropy)
- Easy to extend with custom layers and activations
Add to your Cargo.toml:
[dependencies]
meuron = "0.1"use meuron::{NeuralNetwork, layer::DenseLayer, activation::Sigmoid, cost::MSE};
use ndarray::Array2;
fn main() {
// Create a simple 2-layer network
let layer1 = DenseLayer::new(784, 128, Sigmoid);
let layer2 = DenseLayer::new(128, 10, Sigmoid);
let mut nn = NeuralNetwork::new(
vec![layer1, layer2],
MSE,
);
// Train the network
nn.train(&train_data, &train_labels, 0.01, 10, 32);
// Save the model
nn.save("model.bin").unwrap();
// Load later
let loaded_nn = NeuralNetwork::load("model.bin", MSE).unwrap();
}- ReLU
- Sigmoid
- Softmax
- Tanh
- MSE
- CrossEntropy
- BinaryCrossEntropy
- DenseLayer
See the examples/ directory:
cargo run --example mnist --release
Contributions are welcome! Please feel free to submit a Pull Request.