5 releases
0.2.3 | Mar 15, 2023 |
---|---|
0.2.2 | Mar 14, 2023 |
0.2.1 | Mar 3, 2023 |
0.2.0 | Mar 2, 2023 |
0.1.0 | Mar 1, 2023 |
#639 in Machine learning
25 downloads per month
29KB
439 lines
NNRS - Rust Neural Network Library
NNRS is a Rust library for creating and working with feedforward neural networks. It provides a set of tools for building and manipulating neural networks, including creating nodes and edges, setting inputs, and firing the network to generate outputs.
Note: this library is still in development, and is not yet ready for use.
Installation
To use NNRS, simply add it as a dependency to your Rust project with Cargo:
cargo add nnrs
Usage
For the most up-to-date usage information, clone the
repository and run cargo doc --open
, or view the
documentation on docs.rs.
Limitations
At this moment, NNRS does not include training functionality. You can use this library to generate outputs from pre-trained networks.
Roadmap
- Basic Parts
- Generating Outputs
- Serialization
- Training (NEAT?)
License
NNRS is licensed under the AGPLv3 license. See the LICENSE
file for more
information.
lib.rs
:
nnrs
A simple, minimal neural network library written in Rust. No training included
Example:
use nnrs::{network::Network, node::Node, edge::Edge, layer::LayerID, activationfn::ActivationFn};
let mut network = Network::create(1, 1, ActivationFn::Linear).unwrap();
let mut output: Vec<f64> = Vec::new();
let layer_id = network.add_layer();
let input_node_id = network.input_node_ids().pop().unwrap();
let hidden_node_id = Node::create(&mut network, layer_id, 0.2).unwrap();
let output_node_id = network.output_node_ids().pop().unwrap();
let edge_input_to_hidden = Edge::create(&mut network, input_node_id, hidden_node_id, 1.3).unwrap();
let edge_hidden_to_output = Edge::create(&mut network, hidden_node_id, output_node_id, 1.5).unwrap();
network.fire(vec![0.8], &mut output).unwrap();
assert_eq!(output, vec![((0.8 * 1.3) + 0.2) * 1.5]);
Dependencies
~3–10MB
~104K SLoC