Search code examples
nltkscikit-learndocument-classification

Different results between the Bernoulli Naive Bayes in NLTK and in scikit-learn


I am getting quite different results when classifying text (in only two categories) with the Bernoulli Naive Bayes algorithm in NLTK and the one in scikit-learn module. Although the overall accuracy is comparable between the two (although far from identical) the difference in Type I and Type II errors is significant. In particular, the NLTK Naive Bayes classifier would give more Type I than Type II errors , while the scikit-learn -- the opposite. This 'anomaly' seem to be consistent across different features and different training samples. Is there a reason for this ? Which of the two is more trustworthy?


Solution

  • NLTK does not implement Bernoulli Naive Bayes. It implements multinomial Naive Bayes but only allows binary features.