13 releases
new 0.1.13 | May 10, 2024 |
---|---|
0.1.12 | May 7, 2024 |
0.1.11 | Aug 1, 2022 |
0.1.10 | Jul 18, 2022 |
#249 in Science
257 downloads per month
115KB
3K
SLoC
Concision
Concision is designed to be a complete toolkit for building machine learning models in Rust.
Getting Started
Building from the source
Start by cloning the repository
git clone https://github.com/FL03/concision.git
cd concision
cargo build --features full -r --workspace
Usage
extern crate concision as cnc;
use cnc::func::Sigmoid;
use cnc::linear::{Config, Features, Linear};
use cnc::{linarr, Predict, Result};
use ndarray::Ix2;
fn main() -> Result<()> {
tracing_subscriber::fmt::init();
tracing::info!("Starting linear model example");
let (samples, dmodel, features) = (20, 5, 3);
let features = Features::new(3, 5);
let config = Config::new("example", features).biased();
let data = linarr::<f64, Ix2>((samples, dmodel)).unwrap();
let model: Linear<f64> = Linear::std(config).uniform();
// `.activate(*data, *activation)` runs the forward pass and applies the activation function to the result
let y = model.activate(&data, Sigmoid::sigmoid).unwrap();
assert_eq!(y.dim(), (samples, features));
println!("Predictions: {:?}", y);
Ok(())
}
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
License
Dependencies
~2–3MB
~63K SLoC