ferrolearn-bayes
Naive Bayes classifiers for the ferrolearn machine learning framework. Validated against scikit-learn 1.8.0 head-to-head: exact accuracy parity on every dataset size — see the workspace BENCHMARKS.md.
Algorithms
| Model | Best for |
|---|---|
GaussianNB |
Continuous features with Gaussian distributions |
MultinomialNB |
Discrete count data (e.g., word counts in text classification) |
BernoulliNB |
Binary/boolean features with optional binarization threshold |
ComplementNB |
Imbalanced datasets (complement-class variant of Multinomial NB) |
CategoricalNB |
Discrete categorical features |
All classifiers support predict_proba for class probability estimates and
match scikit-learn defaults (alpha = 1.0, fit_prior = True).
Conjugate priors module
The crate also exposes a conjugate module with closed-form Bayesian updates
for Beta-Bernoulli, Dirichlet-Categorical, Normal-Inverse-Gamma, and
Gamma-Poisson distributions.
Example
use GaussianNB;
use ;
use ;
let x = from_shape_vec.unwrap;
let y = array!;
let model = new;
let fitted = model.fit.unwrap;
let predictions = fitted.predict.unwrap;
// Get class probabilities
let probas = fitted.predict_proba.unwrap;
License
Licensed under either of Apache License, Version 2.0 or MIT License at your option.