Crates.io | rustml |
lib.rs | rustml |
version | 0.0.7 |
source | src |
created_at | 2015-07-06 14:04:21.670002 |
updated_at | 2018-01-31 13:53:37.596503 |
description | A library for doing maching learning in Rust. |
homepage | http://daniel-e.github.io/rustml/rustml/ |
repository | https://github.com/daniel-e/rustml |
max_upload_size | |
id | 2546 |
size | 330,499 |
Rustml is a library for doing machine learning in Rust.
The documentation of the project with a descprition of the modules can be found here.
On Ubuntu:
sudo apt-get install libblas-dev libopencv-highgui-dev
It is recommended to install OpenBLAS as it parallalizes matrix operations.
sudo apt-get install libopenblas-dev
Create a new project with cargo:
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.
#[macro_use] extern crate rustml;
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;
println!("{}", c);
}
Now, in the example
directory run the example with cargo run
.
You can find other examples in the directory examples
. Each example can be executed with cargo run --example <example name>
where <example name>
is one of the following:
gradient_descent
: uses gradient descent to find the minimum of a functionimage_grid
: how to arrange a set of images into a gridlinear_regression
: use linear regression to approximate the points of an unknown functionmatrix_multiplication
: guess what ;)mnist_digits
: shows how to load the MNIST database of handwritten digitsneuralnetwork
: trains a neural network to compute the XOR function and plots the decision boundariesoctave_plot
: shows how to plot things with Octaveplots
: creates some plots for the online documentationscale_matrix
: demonstrates how to scale featuresvector_addition
: demonstrates how to add vectorsvideo_histogram
: how to select specific regions of a video and compute the histogramThe rustml dataset package needs to be installed separately. The package currently contains
the MNIST database of handwritten digits and videos for the examples. Download the following
script which will download and install the package in your home in the directory
~/.rustml/
.
# download the install script
wget -q https://raw.githubusercontent.com/daniel-e/rustml/master/dl_datasets.sh
chmod +x dl_datasets.sh
# download the datasets and install them into ~/.rustml/
./dl_datasets.sh