Linfa is a Rust machine learning framework with crates for preprocessing, clustering, classification, and regression, inspired by scikit-learn.
Overview
Linfa is a Rust ecosystem for building machine learning applications. It follows a scikit-learn-style focus on everyday preprocessing and classical algorithms rather than deep learning stacks.
Functionality is split into sub-packages, each implementing a family of methods. Covered areas include naive Bayes, clustering (K-Means, DBSCAN, OPTICS, Gaussian mixtures), ensembles, linear and logistic models, SVMs, decision trees, dimensionality reduction, ICA, nearest neighbours, and time-series embedding such as t-SNE.
Many crates are tested or benchmarked within the project. Optional BLAS and LAPACK backends (OpenBLAS, Netlib, Intel MKL) can replace the default pure-Rust linear algebra for some algorithms. A wasm-bindgen feature targets browser WASM on wasm32-unknown-unknown.
Linfa suits developers who want composable Rust crates to assemble ML pipelines without leaving the language ecosystem.
Key features
- Modular algorithm crates
- Clustering and classification
- Linear and logistic regression
- Support vector machines
- PCA and dimensionality reduction
- Preprocessing and vectorization
- Optional BLAS backends
- Browser WASM feature flag
Use cases
- Classical ML pipelines in Rust
- Clustering unlabeled data
- Preprocessing before custom models
- WASM ML experiments in the browser