Solved – Does Zero Observations Problem exist for Gaussian Naive Bayes

machine learningnaive bayes

I'm currently implementing a Gaussian Naive Bayes classifier. With a Naive Bayes classifier the zero observation or zero probability problem can occur, see e.g. point 11 on http://machinelearningmastery.com/better-naive-bayes/. This can be solved by e.g. laplacian smoothing.

Am I right that this problem cannot happen for Gaussian Naive Bayes? Because there we use the normal distribution for calculating the probabilities (using the mean and standard deviation calculated for each feature).

Best Answer

Generally, the zero probability problem is about the fact that you lack a certain kind of cases in your data that are actually possible. In this case assigning probability of zero to such cases does not seem appropriate, so you assign some low probabilities to such cases (you can find some examples in here).

Now, how does this relate to continuous variables? Recall that in continuous case $P(X = x) = 0$, so correcting for missing point-values does not make sens. In this case, "zero probability" problem would be that (a) you know that your data is censored, truncated, has outliers etc., and you want to make corrections in your model for that fact, or (b) you, in general, want to include out-of-sample knowledge (prior) in your model (a fully Bayesian model).

So, with discrete values using Laplacian correction can be easily applied, but it does not have a simple analogue with continuous data. With continuous data it is rather a matter of understanding your data and building a valid statistical model of it. Laplacian smoothing is in fact using a uniform prior and for continuous data you also can use some prior distribution to include out-of-sample knowledge in your model.