sklears (crate)
Latest release:
0.2.0(July 14, 2026). See the workspace release notes for highlights and upgrade guidance.
Overview
This crate exposes the top-level sklears API that bundles all subcrates into a cohesive, scikit-learn compatible experience. It re-exports sklears-core/sklears-utils at the crate root and exposes each optional algorithm subcrate as a feature-gated module.
Key Features
- Per-Module Re-exports: Each enabled feature exposes its subcrate as a named module (
sklears::linear,sklears::tree,sklears::neighbors, ...) — there is no singlepreludeglob import. - Feature Flags: Enable only the modules you need (
linear,ensemble,gpu, etc.) to keep builds lightweight. - Rust + Python: Designed to work with both native Rust projects and the
sklears-pythonbindings. - Documentation Hub: Acts as the canonical entry point for examples, tutorials, and integration guides.
Quick Start
[]
= { = "0.2.0", = ["linear", "ensemble", "gpu"] }
use RandomForestClassifier;
use ;
use ;
let x = array!;
let y = from;
let model = new
.n_estimators
.fit?;
let predictions = model.predict?;
Note: this crate is a facade — it has no prelude module. Each enabled
feature re-exports its subcrate under its own name (sklears::linear,
sklears::tree, sklears::ensemble, ...); import types from the specific
module for the algorithms you enabled.
Status
- Serves as the umbrella facade crate, re-exporting
sklears-core/sklears-utilsplus one module per optional algorithm-category feature (linear,clustering,ensemble,tree,neighbors,naive-bayes,multiclass,semi-supervised, and more — seeCargo.toml's[features]for the full list). - GPU acceleration is available behind the
gpufeature (OxiCUDA/CUDA-backed viasklears-core::gpu), forwarding to each enabled subcrate's owngpufeature with an honest CPU fallback when no device is detected. - This crate's own integration/property tests: 32 passing (13 skipped) with
--all-featuresfor0.2.0; each subcrate carries its own, much larger, unit-test suite documented in its own README. - The
preprocessingfeature and itssklears-preprocessingoptional dependency (previously commented out workspace-wide) are restored in0.2.0, along with the 8 algorithm-showcase examples and thetree_ensemble_benchmarksbench target that require it (linear_models_showcase,lasso_regression,kmeans_clustering,dbscan_clustering,hierarchical_clustering,mean_shift_clustering,spectral_clustering,gmm_clustering, plusperformance_comparison_comprehensive). - Re-export map kept in sync with individual module READMEs and documentation.
- Further enhancements (module-level doc consolidation, feature flag audits) tracked in
TODO.md.