Sha256: 58bb8421f00caa661dffd8cc6c175c58a1a1c81fd698f7c7ee7a71049e3bb5b1

Contents?: true

Size: 1.33 KB

Versions: 2

Compression:

Stored size: 1.33 KB

Contents

NaiveBayes
==========

**Naive Bayes text classification**

What is Naive bayes
-------------------

See also.

+ http://en.wikipedia.org/wiki/Naive_bayes


Tutorial
--------

The Bernoulli model.

+ http://nlp.stanford.edu/IR-book/html/htmledition/the-bernoulli-model-1.html

``` html
require 'naivebayes'
classifier = NaiveBayes::Classifier.new(:model => "berounoulli")
classifier.train("positive", {"aaa" => 0, "bbb" => 1})
classifier.train("negative", {"ccc" => 2, "ddd" => 3})
result = classifier.classify({"aaa" => 1, "bbb" => 1})
p result # => {"positive" => 0.8767123287671234,"negative" => 0.12328767123287669}
```

Relation to multinomial unigram language model.

+ http://nlp.stanford.edu/IR-book/html/htmledition/relation-to-multinomial-unigram-language-model-1.html

``` html
require 'naivebayes'
classifier = NaiveBayes::Classifier.new(:model => "multinomial")
classifier.train("positive", {"aaa" => 0, "bbb" => 1})
classifier.train("negative", {"ccc" => 2, "ddd" => 3})
result = classifier.classify({"aaa" => 1, "bbb" => 1})
p result # => {"positive" => 0.9411764705882353,"negative" => 0.05882352941176469}
```


ChangeLog
---------

See doc/ChangeLog.


Developers
----------

See doc/AUTHORS.


Author
------

**774**

+ http://id774.net
+ http://github.com/id774


Copyright and license
---------------------

See the file doc/LICENSE.


Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
naivebayes-0.0.3 README.md
naivebayes-0.0.2 README.md