Skip to main content
4 votes
Accepted

How to improve results from a Naive Bayes algorithm?

Your model certainly overfits. It's likely that the main issue is the inclusion in the features of words which appear very rarely (especially those which appear only once in the corpus): Words which ...
Erwan's user avatar
  • 25.5k
2 votes
Accepted

Why naive bayes is "naive"

Naive Bayes doesn't assume independence of attributes ... It assumes conditional independence (or what you call independence within a class). This allows us to write the likelihood in the bayes rule P(...
Samyer's user avatar
  • 44
1 vote

Does it make sense to build a ROC curve for Naive Bayes classification?

Using metrics makes sense in the context of the task, not algorithms. After all, we do not train algorithms on quality metrics, but compare different models by quality metrics. That is, if this is a ...
Andrew's user avatar
  • 406
1 vote
Accepted

Stop words list to use for CountVectorization

import nltk from nltk.corpus import stopwords print(stopwords.words('english'))
SrJ's user avatar
  • 858
1 vote

Independence of Features assumption in Naive Bayes

Statistical independence is a pretty straightforward thing. If $$p(A\cap B) = p(A) p(B)$$ then $A$ and $B$ are independent (in other words if marginal distributions are equal to conditional). If you ...
Anvar Kurmukov's user avatar
1 vote

Subtraction of Positive and Negative Frequencies in Sentiment Analysis

Let's take an example, consider two words A & B. A's positive/negative values are +1/0 and B's are +0.5/-0.5. Their difference would appear equivalent (diffAB = 1). When in fact they are quite ...
WBM's user avatar
  • 711
1 vote

How to implement HashingVectorizer in multinomial naive bayes algorithim

In newer versions of sklearn, use HashingVectorizer(alternate_sign=False)
Gabriel Blanco's user avatar
1 vote

How to implement HashingVectorizer in multinomial naive bayes algorithim

It doesn't seem that non_negative is an argument in some versions. Try using decode_error = 'ignore'. If you're working with a ...
chiceman's user avatar
1 vote

How to implement HashingVectorizer in multinomial naive bayes algorithim

You need to ensure that the hashing vector doesn't purpose negatives. The way to do this is via HashingVectorizer(non_negative=True).
Tophat's user avatar
  • 2,430

Only top scored, non community-wiki answers of a minimum length are eligible