Skip to main content

Naive Bayes Text Classification

Project description

# 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
```

Project details


Download files

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

Source Distribution

naive-bayes-0.1.1.tar.gz (1.8 kB view details)

Uploaded Source

File details

Details for the file naive-bayes-0.1.1.tar.gz.

File metadata

  • Download URL: naive-bayes-0.1.1.tar.gz
  • Upload date:
  • Size: 1.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for naive-bayes-0.1.1.tar.gz
Algorithm Hash digest
SHA256 896a93ffff733730fa9b2b5f2e6023cfba75c0c5ff18f2a3fb98c2841724d4ab
MD5 42a1cabe2c316e79847a7460b10cdaab
BLAKE2b-256 abaa75158e517a7678485e9a748b3117ce5edb750af643b2a916b061ee53ba4d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page