Share Your Experience: Take the 2024 Developer Survey

# Tag Info

Accepted

### How to handle a zero factor in Naive Bayes Classifier calculation?

An approach to overcome this 'zero frequency problem' in a Bayesian setting is to add one to the count for every attribute value-class combination when an attribute value doesn’t occur with every ...
• 3,940
Accepted

### How does Naive Bayes classifier work for continuous variables?

The difference boils down to "how we define $P(x_i|C_k)$?", where $x_i$ is a single feature, and $C_k$ is a class from a total of $K$ classes. Discrete In discrete case, $P(x_i|C_k)$ is ...
• 9,332
Accepted

### Difference between Bernoulli and Multinomial Naive Bayes

Bernoulli models the presence/absence of a feature. Multinomial models the number of counts of a feature. Here's a concise explanation. Wikipedia warns that Note that a naive Bayes classifier with ...
• 271
Accepted

### Why does the naive bayes algorithm make the naive assumption that features are independent to each other?

By doing so, the joint distribution can be found easily by just multiplying the probability of each feature whilst in the real world they may not be independent and you have to find the correct joint ...
• 14.1k

### Does dataset training and test size affect algorithm?

It is completely normal in some circumstances. If you consider the learning problem from a statistical perspective, learning is done by trying to estimate the conditional estimate of your output ...
• 4,763
Accepted

### Can feature importance change a lot between models?

Is this normal? It is not surprising. First, you are using different measures of feature importance. It’s like measuring the importance of people (or simply sorting them) using their a) weight, b) ...
• 1,520
Accepted

### Naive Bayes: Divide by Zero error

Although I haven't verified it, a first glance at the features and training set you used shows an obvious problem. You have just two data samples with the exact same features while you give it ...
• 291
Accepted

### Is the prediction algorithm absolutely the same for all linear classifiers?

Is it true that linear classifiers differ only in the Learning algorithm, but do they do the same during Prediction y = w1*x1 + w2*x2 + ... + c? Yes, all parametric linear classifiers try to ...
• 2,255
Accepted

### What Shape Does Naive Bayes make?

Specifically talking about Gaussian Naive Bayes, the decision boundary are ellipsoids characterized by the mean and standard deviation of the Gaussian distribution. Image: https://scikit-learn.org/...
• 2,989

### Overfitting Naive Bayes

Let me try to answer your questions point by point. Perhaps you already solved your problem, but your questions are interesting and so perhaps other people can benefit from this discussion. Is Naive ...
• 6,056

### In general, when does TF-IDF reduce accuracy?

The IDF part of TF-IDF gives less weight to a word if it occurs in a large fraction of the documents in your corpus. However, this doesn't necessarily mean that the word is unimportant for ...
• 3,100

### Naive Bayes Should generate prediction given missing features (scikit learn)

Your question is sensible. The way in which posterior probability is calculated in the classical Naive Bayes classifier (in sklearn) is like summation of the conditional probabilities of the all the ...
• 343
Accepted

### Handling underflow in a Gaussian Naive Bayes classifier

The standard answer is to work in log space, and manipulate the log of probabilities instead of probabilities, for exactly this reason. This classifier involves products of probabilities which just ...
• 6,595

### Does dataset training and test size affect algorithm?

Your training and test errors are affected by the size of the training. Take a look to this plot, usually known as a learning curve: In this example, we compute the training score and the test score (...
• 1,787
Accepted

• 2,196