Calculate class probabilities for a Naive Bayes classifier given feature likelihoods.
Naive Bayes classification computes P(C|features) ∝ P(C) × Π P(fᵢ|C) for each class, then normalizes. The 'naive' assumption is that features are conditionally independent given the class, which greatly simplifies computation and works surprisingly well for text classification, spam filtering, and sentiment analysis.
Naive Bayes
P(C|f1,...,fn) = P(C) * product(P(fi|C)) / P(f1,...,fn)
It assumes all features are conditionally independent given the class — a strong and usually unrealistic assumption. Despite this, Naive Bayes often performs well in practice, especially for text classification where the feature space is very high-dimensional.
Laplace smoothing (adding a small constant to all counts) prevents any likelihood from being exactly zero, which would otherwise zero out the entire product for that class.