A lightweight collection of Bayes classifiers: Multivariate Gaussian, Gaussian naive Bayes, multinomial, Bernoulli, categorical, and Poisson.
Project description
bayes-classifier
A lightweight collection of Bayes classifiers for tabular data.
Included classifiers:
MultivariateGaussianBayesClassifierGaussianNaiveBayesClassifierMultinomialBayesClassifierBernoulliBayesClassifierCategoricalBayesClassifierPoissonBayesClassifier
BayesClassifier is provided as an alias of MultivariateGaussianBayesClassifier.
Install
pip install bayes-classifier
Quickstart
import numpy as np
from bayes_classifier import GaussianNaiveBayesClassifier
X = np.array([
[1.0, 2.0],
[1.2, 1.8],
[3.0, 3.2],
[2.8, 3.1],
])
y = np.array([0, 0, 1, 1])
clf = GaussianNaiveBayesClassifier().fit(X, y)
preds = clf.predict(X)
Classifier Guide
Use the classifier that matches your feature distribution:
MultivariateGaussianBayesClassifier: continuous features with full covariance.GaussianNaiveBayesClassifier: continuous features with conditional independence assumption.MultinomialBayesClassifier: non-negative count-like features.BernoulliBayesClassifier: binary/presence features (inputs are thresholded to 0/1).CategoricalBayesClassifier: discrete category-valued features.PoissonBayesClassifier: non-negative count features modeled with Poisson rates.
API
Each classifier follows the same simple interface:
model = SomeBayesClassifier(...)
model.fit(X_train, y_train)
y_pred = model.predict(X_test)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bayes_classifier-0.1.0.tar.gz.
File metadata
- Download URL: bayes_classifier-0.1.0.tar.gz
- Upload date:
- Size: 9.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6edfea1ae84f4feb33e063181e73cc708ea9694e3485a3b31e6481ce000aaf86
|
|
| MD5 |
fbdc884c2a101c2022e787b22862d39d
|
|
| BLAKE2b-256 |
e1f380caf327cad9bde1fd0ff92189d76a46e950c494134db838d557cde07cf0
|
File details
Details for the file bayes_classifier-0.1.0-py3-none-any.whl.
File metadata
- Download URL: bayes_classifier-0.1.0-py3-none-any.whl
- Upload date:
- Size: 13.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
98489c2b931e268c621b31f267ead89b4e58ba473ef9e195fd00d96c5e8fbdd9
|
|
| MD5 |
c875be1170cca20e93ce91ecd4aeb6ba
|
|
| BLAKE2b-256 |
538142aa9a92e38ef29ff3256ce7f0a9269d879a591ec9e15d4a9a3a378af10a
|