6 releases
0.1.5 | Jan 24, 2024 |
---|---|
0.1.4 | Jan 23, 2024 |
#299 in Machine learning
1MB
3K
SLoC
rusty-ai
A Rust library containing various machine learning algorithms
lib.rs
:
Rusty-ai
rusty-ai
provides implementations of various classification and regression algorithms using Rust.
It also contains some utility functions for data manipulation and metrics.
Getting Started
To use rusty-ai
, add the following to your Cargo.toml
file:
[dependencies]
rusty-ai = "*"
Example Usage
As a quick example, here's how you can use rusty-ai
to train a gaussian naive bayes classifier on an example dataset:
use rusty_ai::bayes::gaussian::*;
use rusty_ai::data::dataset::*;
use nalgebra::{DMatrix, DVector};
let x = DMatrix::from_row_slice(4, 2, &[1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0]);
let y = DVector::from_vec(vec![0, 0, 1, 1]);
let dataset = Dataset::new(x, y);
let mut model = GaussianNB::new();
model.fit(&dataset).unwrap();
let test_x = DMatrix::from_row_slice(2, 2, &[1.0, 2.0, 3.0, 4.0]);
let predictions = model.predict(&test_x).unwrap();
Dependencies
~6MB
~106K SLoC