Skip to content
/ bace Public

A deck of Naive Bayes algorithms with sklearn-like API ๐Ÿƒ

License

Notifications You must be signed in to change notification settings

krzjoa/bace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

bace

Python 3.7 PyPI version Build Status Documentation Status License: MIT

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

Algorithms

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

Installation

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

python3.7 -m pip install git+https://github.com/krzjoa/bace.git

or as a PyPI package

python3.7 -m pip install bace

Usage

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(newsgroups_train.data)
y_train = newsgroups_train.target
    
# Test set
newsgroups_test = fetch_20newsgroups(subset='test', shuffle=True)
X_test = vectorizer.fit_transform(newsgroups_test.data)
y_test = newsgroups_test.target

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

Releases

No releases published

Packages

No packages published

Languages