I am reading naive Bayes classifier from the book "Data mining practical machine learning tools and techniques". The example of naive Bayes is given using the below dataset.

Weather data set

As (Outlook=Overcast | Play=No) has 0 counts, the book suggests using Laplace smoothing. For this, I have to add 1 to numerator and 3 to the denominator (as there are 3 different outlooks. I understand this part).

Now my question is do I have to use Laplace smoothing on (Outlook | Play=Yes) too? Do I have to use Laplace smoothing for other attributes too? Or using Laplace smoothing on only the attributes that have 0 count enough? (in this case (Outlook | Play=No)).


Sorry this is certainly too late to help you, but answering in case others find the question.

When using Laplace smoothing, you should apply the smoothing for all attributes.

To see why this is important, consider a dataset containing exactly 1 instance of a certain attribute and 0 instances of another. If you only applied the smoothing factor to the attribute with 0 instances, the result would be equal probabilities for the two attributes, even though there were more instances of the former. By adding 1 to all attributes, you make sure nothing has a complete 0% probability while also maintaining the correct relative likelihood.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.