Skip to content

dollspace-gay/ferrolearn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

117 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ferrolearn

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

use ferrolearn::prelude::*;
use ferrolearn::{linear, preprocess, decomp, datasets};

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

// Build a pipeline: scale -> PCA -> logistic regression
let pipeline = Pipeline::new()
    .transform_step("scaler", Box::new(preprocess::StandardScaler::<f64>::new()))
    .transform_step("pca", Box::new(decomp::PCA::<f64>::new(2)))
    .estimator_step("clf", Box::new(linear::LogisticRegression::<f64>::new()));

Features

Supervised Learning

Unsupervised Learning

Preprocessing

Model Selection

Metrics

Infrastructure

Architecture

ferrolearn is a workspace of 14 crates. Use the umbrella crate for convenience, or depend on individual crates for smaller binaries:

Crate Description
ferrolearn Umbrella re-export crate
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)

Core traits

All models follow a consistent type-state pattern:

// Unfitted model — can configure, cannot predict
let model = Ridge::<f64>::new().with_alpha(1.0);

// Fit returns a new FittedRidge type
let fitted = model.fit(&x, &y)?;

// Only the fitted type can predict
let predictions = fitted.predict(&x_test)?;

The key traits from ferrolearn-core:

Requirements

  • Rust edition 2024
  • MSRV: 1.85

Testing

ferrolearn is validated against scikit-learn with 26 numerical oracle tests that compare predictions, coefficients, and metrics against sklearn reference values:

# Run the full test suite (1,932 tests)
cargo test --workspace

# Run only oracle tests
cargo test --workspace --test oracle_tests

# Regenerate sklearn fixtures (requires Python + scikit-learn)
python scripts/generate_fixtures.py

License

Licensed under MIT OR Apache-2.0 at your option.

About

No description, website, or topics provided.

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors