sklears-naive-bayes

Crates.iosklears-naive-bayes
lib.rssklears-naive-bayes
version0.1.0-beta.1
created_at2025-10-13 13:23:44.352657+00
updated_at2026-01-01 21:33:44.967935+00
descriptionNaive Bayes classifiers for sklears - scikit-learn compatible ML in Rust
homepagehttps://github.com/cool-japan/sklears
repositoryhttps://github.com/cool-japan/sklears
max_upload_size
id1880515
size2,037,497
KitaSan (cool-japan)

documentation

README

sklears-naive-bayes

Crates.io Documentation License Minimum Rust Version

Latest release: 0.1.0-beta.1 (January 1, 2026). See the workspace release notes for highlights and upgrade guidance.

Overview

sklears-naive-bayes implements the full family of Naive Bayes estimators with scikit-learn compatible APIs and Rust-powered performance.

Key Features

  • Supported Models: GaussianNB, MultinomialNB, BernoulliNB, ComplementNB, CategoricalNB, Passive-Aggressive hybrids.
  • Performance: SIMD-accelerated likelihood computation, streaming updates, and GPU-backed batch scoring.
  • Calibration: Compatibility with sklears calibration and inspection crates for probability post-processing.
  • Pipeline Integration: Works seamlessly with preprocessing, feature selection, and model selection modules.

Quick Start

use sklears_naive_bayes::MultinomialNB;
use scirs2_core::ndarray::{array, Array1};

let x = array![
    [1u32, 0, 2],
    [0, 1, 1],
    [3, 0, 0],
];
let y = Array1::from(vec![0, 1, 0]);

let model = MultinomialNB::builder()
    .alpha(1.0)
    .fit_prior(true)
    .build();

let fitted = model.fit(&x, &y)?;
let log_probs = fitted.predict_log_proba(&x)?;

Status

  • Covered by workspace tests; all 10,013 suites passed for 0.1.0-beta.1.
  • Extensive unit and property tests guarantee numerical stability on sparse matrices.
  • Planned enhancements (GPU multinomial smoothing, mixed-type inputs) live in this crate’s TODO.md.
Commit count: 0

cargo fmt