pyrus-nn

Build Status Dependabot Status crates.io

Rust API Documentation

Lightweight neural network framework written in Rust, with thin python bindings.

Install:

Python: pip install pyrus-nn # Has ZERO dependencies!

Rust: toml [dependencies] pyrus-nn = "0.2.0"

From Python

```python from pyrusnn.models import Sequential from pyrusnn.layers import Dense

model = Sequential(lr=0.001, nepochs=10) model.add(Dense(ninput=12, noutput=24, activation='sigmoid')) model.add(Dense(ninput=24, n_output=1, activation='sigmoid'))

Create some X and y, each of which must be 2d

X = [list(range(12)) for _ in range(10)] y = [[i] for i in range(10)]

model.fit(X, y) out = model.predict(X)

```


From Rust

```rust use ndarray::Array2; use pyrus_nn::{network::Sequential, layers::Dense};

// Network with 4 inputs and 1 output. fn main() { let mut network = Sequential::new(0.001, 100, 32, CostFunc::CrossEntropy); assert!( network.add(Dense::new(4, 5)).isok() ); assert!( network.add(Dense::new(5, 6)).isok() ); assert!( network.add(Dense::new(6, 4)).isok() ); assert!( network.add(Dense::new(4, 1)).isok() );

let X: Array2<f32> = ...
let y: Array2<f32> = ...

network.fit(X.view(), y.view());

let yhat: Array2<f32> = network.predict(another_x.view());

}

```