Skip to main content
Python Software Foundation 20th Year Anniversary Fundraiser  Donate today!


Project description


Python 3.7 PyPI version Build Status Documentation Status License: MIT

A deck of Naive Bayes algorithms with sklearn-like API.


  • Complement Naive Bayes
  • Negation Naive Bayes
  • Universal-set Naive Bayes
  • Selective Naive Bayes


You can install this module directly from GitHub repo with command:

python3.7 -m pip install git+

or as a PyPI package

python3.7 -m pip install bace


bace API mimics scikit-learn API, so usage is very simple.

from bace import ComplementNB
from sklearn.datasets import fetch_20newsgroups
from sklearn.feature_extraction.text import CountVectorizer

vectorizer = CountVectorizer()

# Train set
newsgroups_train = fetch_20newsgroups(subset='train', shuffle=True)
X_train = vectorizer.fit_transform(
y_train =

# Test set
newsgroups_test = fetch_20newsgroups(subset='test', shuffle=True)
X_test = vectorizer.fit_transform(
y_test =

# Score 
cnb = ComplementNB(), y_train).accuracy_score(X_test, y_test)


The full documentation is at

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for bace, version 1.0.1
Filename, size File type Python version Upload date Hashes
Filename, size bace-1.0.1-py3-none-any.whl (14.7 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size bace-1.0.1.tar.gz (8.9 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page