tiny ml
A simple, fast rust crate for simple basic neural networks.
What is this for?
- Learning about ML
- Evolution simulations
- Whatever else you want to use this for
what is this not?
- A large scale ML library like Tensorflow or PyTorch. This is simple and basic, or just 'tiny'.
How to use this?
As an example, here is how to make a model that can tell if a point is in a circle or not!
use *;
// how many input data-points the model has
const NET_INPUTS: usize = 2;
// how many data-points the model outputs
const NET_OUTPUTS: usize = 1;
// radius of the circle
const RADIUS: f32 = 30.0;
Features
serialization
enables Serde support.
parallelization
enables rayon, default feature.
Speed?
Here some benchmarks on an AMD Ryzen 5 2600X (12) @ 3.6 GHz with the 'bench' example.
Build with --release
-flag enabled.
Benchmark is 10 Million runs on this network, and then sum the results:
method | time | Description |
---|---|---|
run |
1.045s | Single threaded, but buffers some Vecs |
unbuffered_run |
1.251s | Can be ran in multiple threads at the same time, however has to allocate more often |
par_run |
240ms | Takes a multiple inputs at once. Parallizes computation with rayon , uses unbuffered_run under the hood |