New Neural Networks Rust crate
Code Examples
Let's try to approximate simple sin(x)
function.
extern crate neuroflow;
use FeedForward;
use DataSet;
use Tanh;
Expected output
for [0.000], [0.000] -> [0.003]
for [0.050], [0.050] -> [0.048]
for [0.100], [0.100] -> [0.098]
for [0.150], [0.149] -> [0.149]
for [0.200], [0.199] -> [0.199]
for [0.250], [0.247] -> [0.248]
for [0.300], [0.296] -> [0.297]
But we don't want to lose our trained network so easily. So, there is functionality to save and restore neural networks from files.
/*
In order to save neural network into file call function save from neuroflow::io module.
First argument is link on the saving neural network;
Second argument is path to the file.
*/
save;
/*
After we have saved the neural network to the file we can restore it by calling
of load function from neuroflow::io module.
We must specify the type of new_nn variable.
The only argument of load function is the path to file containing
the neural network
*/
let mut new_nn: FeedForward = load;
classic XOR problem
extern crate neuroflow;
use FeedForward;
use DataSet;
use Tanh;
Expected output
for [0.000, 0.000], [0.000] -> [0.000]
for [1.000, 0.000], [1.000] -> [1.000]
for [0.000, 1.000], [1.000] -> [1.000]
for [1.000, 1.000], [0.000] -> [0.000]
Current goals
- Implement Optimal Brain Surgery algorithm
- Work with data in files (
csv
,xlsx
, etc)
Motivation
Previously the library was created only for educational purposes. Saying about now there is, also, sport interest :)
Installation
Insert into your project's cargo.toml block next line
[dependencies]
neuroflow = "0.1.0"
Then in your code
extern crate neuroflow;
License
MIT License
Attribution
The origami bird from logo is made by Freepik