Skip to main content
# Naive Bayes Text Classifier

Text classifier based on Naive Bayes.

## Instalation

```bash
$ pip install naive-bayes
```

## Usage example

```python
from naivebayes import NaiveBayesTextClassifier

classifier = NaiveBayesTextClassifier(
categories=categories_list,
stop_words=stopwords_list
)
classifier.train(train_docs, train_classes)
predicted_classes = classifier.classify(test_docs)
```

`NaiveBayesTextClassifier` is a simple wrapper around `scikit-learn` class `CountVectorizer`. You can put all arguments which support this class. For more information please check `scikit-learn` official documentation.

## More examples

Check examples at `examples` folder. Before run them, install requirements in this folder.

Clone repository from github

```bash
$ git clone git@github.com:itdxer/naive-bayes.git
$ cd naive-bayes/examples
$ pip install -r requirements.txt
```

And run some example

### Usenet 20 newsgroup

```bash
$ python 20newsgroup
```

### Kaggle IMDB reviews competition

```bash
$ python imdb_reviews
```

Metadata

Release files for naive-bayes 0.1.1

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

Source distribution (sdist)

Source distribution for naive-bayes 0.1.1
File Size Uploaded
naive-bayes-0.1.1.tar.gz 1.8 kB Details

Release files / naive-bayes-0.1.1.tar.gz

Download URL naive-bayes-0.1.1.tar.gz
Size 1.8 kB
Tags Source
SHA-256 checksum
How to use checksums
896a93ffff733730fa9b2b5f2e6023cfba75c0c5ff18f2a3fb98c2841724d4ab
BLAKE2b-256 checksum
How to use checksums
abaa75158e517a7678485e9a748b3117ce5edb750af643b2a916b061ee53ba4d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1.1 This release

1 release file

0.1.0

1 release file

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