no prior used in naive bayes classifier
bmuller opened this issue · 2 comments
bmuller commented
It looks like the prior probability for each classification is ignored in the Naive Bayes classifier. You should keep track of the number of times "train" is called with each class, and then use that to calculate the prior for each class: P(class) = # class trainings / # all trainings. You should then add Math.log(P(class)) to your log sum (score[category.to_s]) in your "classifications" method.
Without the addition of that prior you do not have a Naive Bayes classifier.
cardmagic commented
Please submit a patch. Thanks!
cardmagic commented
This is released in version 1.4