Skip to main content
# pyrus-nn

[![Build Status](https://milesgranger.visualstudio.com/builds/_apis/build/status/pyrus-nn?branchName=master)](https://milesgranger.visualstudio.com/builds/_build/latest?definitionId=1&branchName=master)
[![Dependabot Status](https://api.dependabot.com/badges/status?host=github&repo=milesgranger/black-jack)](https://dependabot.com)
[![crates.io](http://meritbadge.herokuapp.com/pyrus-nn)](https://crates.io/crates/pyrus-nn)

[Rust API Documentation](https://docs.rs/pyrus-nn)

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

- Features:
- Serialize networks into/from YAML & JSON!
- Rust -> serde compatible
- Python -> `network.to_dict()` & `Sequential.from_dict()`
- Python install requires _zero_ dependencies
- No external system libs to install

- Draw backs:
- Only supports generic gradient descent.
- Fully connected (Dense) layers only so far
- Activation functions limited to linear, tanh, sigmoid and softmax
- Cost functions limited to MSE, MAE, Cross Entropy and Accuracy

### Install:

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

Rust:
```toml
[dependencies]
pyrus-nn = "0.2.1"
```



### From Python
```python
from pyrus_nn.models import Sequential
from pyrus_nn.layers import Dense

model = Sequential(lr=0.001, n_epochs=10)
model.add(Dense(n_input=12, n_output=24, activation='sigmoid'))
model.add(Dense(n_input=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)).is_ok()
);
assert!(
network.add(Dense::new(5, 6)).is_ok()
);
assert!(
network.add(Dense::new(6, 4)).is_ok()
);
assert!(
network.add(Dense::new(4, 1)).is_ok()
);

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

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

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

```

Metadata

Release files for pyrus-nn 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for pyrus-nn 0.2.1
File
pyrus_nn-0.2.1-cp37-cp37m-win_amd64.whl CPython 3.7 CPython 3.7 pymalloc Windows x86-64 Details
pyrus_nn-0.2.1-cp37-cp37m-manylinux1_x86_64.whl CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.5+ x86-64 Details
pyrus_nn-0.2.1-cp36-cp36m-win_amd64.whl CPython 3.6 CPython 3.6 pymalloc Windows x86-64 Details
pyrus_nn-0.2.1-cp36-cp36m-manylinux1_x86_64.whl CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-64 Details
pyrus_nn-0.2.1-cp35-cp35m-manylinux1_x86_64.whl CPython 3.5 CPython 3.5 pymalloc Linux glibc 2.5+ x86-64 Details
pyrus_nn-0.2.1-cp27-cp27mu-manylinux1_x86_64.whl CPython 2.7 CPython 2.7 pymalloc wide-unicode Linux glibc 2.5+ x86-64 Details
pyrus_nn-0.2.1-cp27-cp27m-manylinux1_x86_64.whl CPython 2.7 CPython 2.7 pymalloc Linux glibc 2.5+ x86-64 Details

Total release size: 11.8 MB

Release files / pyrus_nn-0.2.1-cp37-cp37m-win_amd64.whl

Download URL pyrus_nn-0.2.1-cp37-cp37m-win_amd64.whl
Size 488.5 kB
Tags CPython 3.7 CPython 3.7 pymalloc Windows x86-64
SHA-256 checksum
How to use checksums
a81181e278190c05dd36fbf5d154f7b6c7b3b9382026273d889a9d299e00bd1d
BLAKE2b-256 checksum
How to use checksums
fb7921157ab4821966f7ab6ed270988e8b6313fcc0676f87a2a12853667e12e3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

Release files / pyrus_nn-0.2.1-cp37-cp37m-manylinux1_x86_64.whl

Download URL pyrus_nn-0.2.1-cp37-cp37m-manylinux1_x86_64.whl
Size 3.9 MB
Tags CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
53320d65328e2ffa5695bdd974bb740c92d8ede8be87707c8420aaacf6c5caad
BLAKE2b-256 checksum
How to use checksums
12c71267f7d063c5b19d6015d1fe8748751a43abc558a3df15676ab4dca1a181
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

Release files / pyrus_nn-0.2.1-cp36-cp36m-win_amd64.whl

Download URL pyrus_nn-0.2.1-cp36-cp36m-win_amd64.whl
Size 488.6 kB
Tags CPython 3.6 CPython 3.6 pymalloc Windows x86-64
SHA-256 checksum
How to use checksums
9e8333e8cc7a5c47b765c79551a97075c5d1af7fbdc3da0fde0ff1bd149e0932
BLAKE2b-256 checksum
How to use checksums
d0ba5b28feb149a5a0d22bd9b09942fda15e965566b9fd5b3323fea109152ddf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.8

Release files / pyrus_nn-0.2.1-cp36-cp36m-manylinux1_x86_64.whl

Download URL pyrus_nn-0.2.1-cp36-cp36m-manylinux1_x86_64.whl
Size 3.0 MB
Tags CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
d87623c52ab0f9b57c8e0f3c2c554537a274f9fe27020d58ff79de6844878ffc
BLAKE2b-256 checksum
How to use checksums
d803330440ea9556123011fa957d2db893ad15e5c19c5cdc95f185295391f5f3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

Release files / pyrus_nn-0.2.1-cp35-cp35m-manylinux1_x86_64.whl

Download URL pyrus_nn-0.2.1-cp35-cp35m-manylinux1_x86_64.whl
Size 2.0 MB
Tags CPython 3.5 CPython 3.5 pymalloc Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
dc345d8b4e21d18262641340a3fed7ea5f94c8667fd4663b82dfc5ab944df978
BLAKE2b-256 checksum
How to use checksums
982bfc6abe651ca8b8ecc24a798c78c7f5e4b0b4b473d4f96ccbbbb29c268f95
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

Release files / pyrus_nn-0.2.1-cp27-cp27mu-manylinux1_x86_64.whl

Download URL pyrus_nn-0.2.1-cp27-cp27mu-manylinux1_x86_64.whl
Size 989.5 kB
Tags CPython 2.7 CPython 2.7 pymalloc wide-unicode Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
1e9d2cdb95bfb82bb6b70325edeb158f53b143165755d811e324becbf046bea3
BLAKE2b-256 checksum
How to use checksums
36a9eaeb486bbde169757ddd54ed0f7f3a07398478403d0c1bfe66c603fc44dc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

Release files / pyrus_nn-0.2.1-cp27-cp27m-manylinux1_x86_64.whl

Download URL pyrus_nn-0.2.1-cp27-cp27m-manylinux1_x86_64.whl
Size 989.5 kB
Tags CPython 2.7 CPython 2.7 pymalloc Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
cc93fb547ebd95d0f59e33e45e459db99d131d34daa5c0811542b00ee8de64c8
BLAKE2b-256 checksum
How to use checksums
259d523d6aedb8cb21cc335babaa65b762423dd01bf93374b11e4464774b3095
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

Release history Release notifications | RSS feed

This release

0.2.1 This release

7 release files

0.2.0

7 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page