ferrolearn 0.2.0

A scikit-learn equivalent for Rust — re-export crate
Documentation

ferrolearn

A scikit-learn equivalent for Rust. Type-safe, modular machine learning built on ndarray.

This is the umbrella crate that re-exports all ferrolearn sub-crates under a single dependency. If you want everything, depend on this crate. If you only need specific algorithms, depend on the individual sub-crates for smaller compile times and binary sizes.

Quick start

[dependencies]
ferrolearn = "0.1"
use ferrolearn::prelude::*;
use ferrolearn::{linear, preprocess, datasets, metrics};

// Load the iris dataset
let (x, y) = datasets::load_iris::<f64>().unwrap();

// Scale features to zero mean and unit variance
let scaler = preprocess::StandardScaler::<f64>::new();
let fitted_scaler = scaler.fit(&x, &()).unwrap();
let x_scaled = fitted_scaler.transform(&x).unwrap();

// Train a logistic regression classifier
let model = linear::LogisticRegression::<f64>::new();
let fitted = model.fit(&x_scaled, &y).unwrap();
let predictions = fitted.predict(&x_scaled).unwrap();

Sub-crates

Crate Description
ferrolearn-core Traits (Fit, Predict, Transform), error types, pipeline, backend
ferrolearn-linear Linear and generalized linear models
ferrolearn-tree Decision trees and ensemble methods
ferrolearn-neighbors k-Nearest Neighbors with KD-tree
ferrolearn-bayes Naive Bayes classifiers
ferrolearn-cluster Clustering algorithms
ferrolearn-decomp Dimensionality reduction and decomposition
ferrolearn-preprocess Scalers, encoders, imputers, feature engineering
ferrolearn-metrics Evaluation metrics
ferrolearn-model-sel Cross-validation, hyperparameter search, calibration
ferrolearn-datasets Toy datasets and synthetic data generators
ferrolearn-io Model serialization (MessagePack, JSON)
ferrolearn-sparse Sparse matrix formats (CSR, CSC, COO)

Requirements

  • Rust 1.85+ (edition 2024)

License

Licensed under either of Apache License, Version 2.0 or MIT License at your option.