Skip to main content

bayes-classifier

A lightweight collection of Bayes classifiers for tabular data.

Included classifiers:

  • MultivariateGaussianBayesClassifier
  • GaussianNaiveBayesClassifier
  • MultinomialBayesClassifier
  • BernoulliBayesClassifier
  • CategoricalBayesClassifier
  • PoissonBayesClassifier

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)

Metadata

Release files for bayes-classifier 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bayes-classifier 0.1.0
File Size Uploaded
bayes_classifier-0.1.0.tar.gz 9.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for bayes-classifier 0.1.0
File Interpreter ABI Platform
bayes_classifier-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 22.7 kB

Release files / bayes_classifier-0.1.0.tar.gz

Download URL bayes_classifier-0.1.0.tar.gz
Size 9.3 kB
Tags Source
SHA-256 checksum
How to use checksums
6edfea1ae84f4feb33e063181e73cc708ea9694e3485a3b31e6481ce000aaf86
BLAKE2b-256 checksum
How to use checksums
e1f380caf327cad9bde1fd0ff92189d76a46e950c494134db838d557cde07cf0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.12

Release files / bayes_classifier-0.1.0-py3-none-any.whl

Download URL bayes_classifier-0.1.0-py3-none-any.whl
Size 13.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
98489c2b931e268c621b31f267ead89b4e58ba473ef9e195fd00d96c5e8fbdd9
BLAKE2b-256 checksum
How to use checksums
538142aa9a92e38ef29ff3256ce7f0a9269d879a591ec9e15d4a9a3a378af10a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.12

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page