Skip to content

FL03/concision

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Concision

crates.io docs.rs

clippy rust crates.io


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