Rustml is a library for doing machine learning in Rust.
The documentation of the project can be found here.
Create a new project with cargo:
bash
cargo new example --bin
A new directory example
is created. Change into this directory and add the following lines Cargo.toml
:
[dependencies.rustml]
git = "https://github.com/daniel-e/rustml/"
or the following dependency:
[dependencies]
rustml = "*"
Edit the file main.rs
in the src
directory.
```rust
use rustml::*;
fn main() { let a = mat![ 1.0f32, 2.0; 3.0, 4.0; 5.0, 6.0 ]; let b = mat![ 5.0, 7.0; 6.0, 2.0 ]; let c = (a * b).unwrap();
println!("{}", c);
} ```
Now, in the example
directory run the example with cargo run
.
You can find other examples in the directory examples
. These examples can be executed with
Cargo as follows:
bash
cargo run --example vector_addition
cargo run --example mnist_digits
cargo run --example matrix_multiplication
Rustml comes with the MNIST database of handwritten digits and provides an API to access this database. In prior to use the dataset you have to install it into you home path. This can be easily done as follows:
```bash
wget -q https://raw.githubusercontent.com/daniel-e/rustml/master/dldatasets.sh chmod +x dldatasets.sh
./dl_datasets.sh ```