Build a classification or regression model in a Rust application without calling a Python service
Run K-means clustering or PCA dimensionality reduction on data directly from a Rust binary
Use WebAssembly to run machine learning inference in the browser from a Rust project
Add a random forest or SVM to a performance-critical Rust app where Python is not an option
Optional BLAS/LAPACK backends (OpenBLAS, Intel MKL) require system library installation, pure-Rust mode needs no extras.
Linfa is a machine learning toolkit written in Rust. It is modeled after Python's scikit-learn, a well-known library that provides a standard set of algorithms for classification, regression, clustering, and data preparation. Linfa aims to offer that same collection of everyday machine learning tools, but for developers working in Rust instead of Python. Rust is a programming language known for being fast and memory-safe, which makes it appealing for performance-critical applications. The trade-off is that its ecosystem for scientific computing and machine learning is less mature than Python's. Linfa is a community effort to close that gap for classical algorithms, meaning traditional statistical methods rather than deep neural networks. The project is organized as a set of smaller packages, each covering a different algorithm or category. The available options include linear regression, logistic regression, support vector machines, decision trees, random forests, K-means clustering, Naive Bayes classifiers, dimensionality reduction methods like PCA and t-SNE, and several others. There are also preprocessing packages for normalizing data and computing nearest neighbors. Each package lists its current status, and most are described as tested or benchmarked. For heavy numerical computation, some packages can optionally use external math libraries, called BLAS and LAPACK backends, instead of the default pure-Rust implementation. Supported backends include OpenBLAS and Intel MKL. The library also supports running in the browser via WebAssembly with an optional feature flag. Linfa is dual-licensed under MIT and Apache 2.0. The project's README acknowledges that building a complete machine learning ecosystem in Rust requires sustained community effort, and it invites contributors to review the public roadmap and get involved.
← rust-ml on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.