COOLJAPAN
← All posts

sklears 0.1.0 Released — Pure Rust scikit-learn with >99% API Coverage

The first stable release of sklears: a pure-Rust scikit-learn alternative spanning 36 crates with >99% API coverage, type-safe Untrained→Trained state machines, and a SciRS2 foundation. No Python runtime, no GIL, no C or Fortran.

release sklears machine-learning scikit-learn rust classical-ml data-science scirs2

Classical machine learning, finally without the Python runtime, the GIL, or a single line of C or Fortran.

Today we released sklears 0.1.0 — a comprehensive, pure-Rust classical machine learning library inspired by scikit-learn’s intuitive API, rebuilt with Rust’s performance and safety on top of the SciRS2 numerical stack.

No C. No Fortran. No Cython. No GIL. scikit-learn is brilliant, but it rides on a deep stack of compiled glue — NumPy and SciPy over BLAS/LAPACK, Cython extensions, and a Python interpreter to coordinate it all. That stack is what makes pip install occasionally explode, what forces you to ship an interpreter to production, and what serializes your CPUs behind the GIL. sklears throws the whole thing out. It is built on OxiBLAS for BLAS/LAPACK, Oxicode for SIMD-optimized serialization, and the SciRS2 ecosystem for scientific computing — with ZERO C or Fortran system dependencies. The result compiles to a single static binary (or WASM)…

Why sklears 0.1.0 matters

scikit-learn’s pain points are structural, not incidental. You pay for a Python runtime everywhere you deploy. The GIL caps true parallelism unless a library drops into C. The C/Cython build chain turns “just install it” into a yak-shave on fresh machines and exotic targets. And because everything is dynamically typed, a wrong array shape or a forgotten .fit() surfaces as a runtime traceback — often in production, not in CI.

sklears trades all of that for compile-time guarantees and a single binary:

Technical Deep Dive: a 36-crate workspace on SciRS2

sklears is a Cargo workspace of 36 focused members, each owning one slice of the scikit-learn surface. You depend on the sklears meta-crate for the full experience, or pull in only the families you need.

Threading it all together is the type-state machine in sklears-core: estimators move from Untrained to Trained as a type-level transition, so the trained-only methods simply do not exist on an untrained value. Underneath, every crate stands on the same foundation — SciRS2 (scirs2-core/-linalg/-stats/-cluster/-metrics/-optimize/-datasets/-sparse at 0.3.x) for the numerics, OxiBLAS for BLAS/LAPACK, and Oxicode for fast serialization. When you need to call from Python, the sklears-python crate exposes PyO3 bindings — Rust speed, familiar scikit-learn ergonomics.

Getting Started

Install:

cargo add sklears

A minimal end-to-end example — generate data, split, train, and score:

use sklears::prelude::*;
use sklears::linear_model::LinearRegression;
use sklears::model_selection::train_test_split;

fn main() -> Result<()> {
    // Generate a regression dataset
    let dataset = sklears::dataset::make_regression(100, 10, 0.1)?;

    // Split into train/test sets (20% test, seed 42)
    let (x_train, x_test, y_train, y_test) =
        train_test_split(&dataset.data, &dataset.target, 0.2, Some(42))?;

    // Create and train the model (Untrained -> Trained at compile time)
    let model = LinearRegression::new()
        .fit_intercept(true)
        .fit(&x_train, &y_train)?;

    // Predict and evaluate
    let _predictions = model.predict(&x_test)?;
    let r2 = model.score(&x_test, &y_test)?;
    println!("R² score: {:.4}", r2);
    Ok(())
}

The type-state machine turns a whole class of bugs into compile errors:

let model = LinearRegression::new();
// model.predict(&x_test)?; // ❌ won't compile: predict() doesn't exist on an Untrained model

And the same builder ergonomics scale to parallel ensembles:

use sklears::ensemble::RandomForestClassifier;

let forest = RandomForestClassifier::new()
    .n_estimators(200)
    .n_jobs(-1) // use all cores via Rayon
    .fit(&x_train, &y_train)?;

What’s inside

Tips

This is the foundation

sklears does not stand alone. It is built directly on SciRS2, the numerical backbone of the COOLJAPAN ecosystem, with NumRS2 and PandRS (DataFrames) feeding it data, OxiBLAS powering the linear algebra, and Oxicode handling serialization. And it has a sibling shipping the very same day: where sklears covers classical machine learning, TenfloweRS covers deep learning — two halves of a pure-Rust ML stack arriving together.

Repository: https://github.com/cool-japan/sklears

Star the repo if you want classical ML you can deploy as a single binary, without a Python runtime or a GIL in the way. Pure Rust classical machine learning is here — fast, safe, and sovereign.

KitaSan at COOLJAPAN OÜ March 20, 2026

↑ Back to all posts