Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/itdxer/naive-bayes
Naive Bayes Text Classifier
https://github.com/itdxer/naive-bayes
Last synced: 11 days ago
JSON representation
Naive Bayes Text Classifier
- Host: GitHub
- URL: https://github.com/itdxer/naive-bayes
- Owner: itdxer
- License: mit
- Created: 2015-04-25T16:15:12.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2023-04-16T13:21:29.000Z (over 1 year ago)
- Last Synced: 2024-10-12T02:15:17.145Z (about 1 month ago)
- Language: Python
- Size: 9.77 KB
- Stars: 12
- Watchers: 3
- Forks: 4
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Naive Bayes Text Classifier
Text classifier based on Naive Bayes.
## Instalation
```bash
$ pip install naive-bayes
```## Usage example
```python
from naivebayes import NaiveBayesTextClassifierclassifier = 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 [email protected]: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
```