sklears-discriminant-analysis
Latest release:
0.2.0(July 14, 2026). See the workspace release notes for highlights and upgrade guidance.
Overview
sklears-discriminant-analysis implements Linear Discriminant Analysis (LDA), Quadratic Discriminant Analysis (QDA), and related subspace methods with scikit-learn compatible APIs. The crate emphasizes numerical robustness, GPU acceleration, and seamless integration with the broader sklears ecosystem.
Key Features
- Comprehensive Algorithms: LDA, QDA, shrinkage estimators, regularized discriminant analysis, and Bayesian variants.
- Performance Optimizations: SIMD-enabled linear algebra, batched matrix factorizations, and (behind the opt-in
gpufeature, not enabled by default) a realsklears_core::gpu-backed GPU path (GEMM-based class-statistics, an LDA generalized-eigenvalue solve via Cholesky reduction verified against SciPy to ~1e-15, and QDA viaoxicuda-solver). - Pipeline Support: Works with sklears pipelines and model selection utilities;
predict_probais available on the fitted estimators.
Quick Start
use LinearDiscriminantAnalysis;
use ;
let x = array!;
let y = from;
let lda = new
.solver
.shrinkage
.n_components;
let fitted = lda.fit?;
let predictions = fitted.predict?;
Status
- Covered by 322 passing tests in
0.2.0(Partial — actively evolving). - Numerical stability validated on high-dimensional datasets using SciRS2 linear algebra backends;
NumericalStability::stable_inversenow correctly handles non-symmetric matrices viascirs2_linalg::inv(previously a stub that returnedNotImplemented). - GPU acceleration now targets the
sklears_core::gpufoundation (GpuBackend/GpuArray/GpuMatrixOps), replacing the previous deadscirs2_core::gpu::*path. - Future enhancements (incremental LDA) tracked within this crate's
TODO.md.