runnt (rust neural net)
Very simple fully connected neural network.
For when you just want to throw something together with minimal dependencies, and few lines of code.
Aim is to create a fully connected network, run it on data, and get results in about 10 lines of code
This library was created due to being unable to find a nice rust library which didn't have external dependencies, and was easy to use.
You are welcome to raise an issue or PR if you identify any errors or optimisations.
Functionality:
- fully connected neural network
- minimal dependencies
- no external static libraries/dlls required
- regression and classfication
- can save/load model
- Stochastic, mini batch, gradient descent
- Dataset manager
- csv
- onehot encoding
- normalization
- Reporting
- Losses MSE, BCE (binary), Softmax with Cross Entropy (multi class)
- Regularisation: L1, L2
- Activations: Linear, Sigmoid, Tanh, ReLU, Swish, Softmax
- Optimizers: SGD, Momentum, Adam
How to use
Simple example
All you need is NN and data
//XOR
use ;
let inputs = ;
let outputs = ;
let mut nn = NNnew
.with_learning_rate
.with_hidden_type
.with_output_type;
for i in 0..5000
Simple example with Dataset and reporting
Dataset makes loading and transforming data a bit easier
train makes running epochs and reporting easy
Complete neural net with reporting in < 10 lines
let set = builder
.read_csv
.add_input_columns
.add_target_columns
.allocate_to_test_data
.build;
let mut net = NNnew.with_learning_rate;
net.train;
With Dataset and reporting and save:
let set = builder
.read_csv
.allocate_to_test_data
.add_input_columns
.add_input_columns
.add_target_columns
.build;
let save_path = r"network.txt";
let mut net = if from_str.unwrap.exists else ;
//run for 100 epochs, with batch size 32 and report every 10 epochs
net.train;
net.save;