Skip to content
Sign in

What is Naive Bayes?

Naive Bayes is a simple probabilistic classifier based on Bayes' theorem. It predicts the class of an item by calculating probabilities while assuming all features are independent of each other.

The algorithm starts from Bayes' theorem, which describes the probability of an event based on prior knowledge of conditions related to the event. It computes the posterior probability for each class given the input features.

The 'naive' part comes from the strong assumption that every feature is conditionally independent of every other feature. This simplifies calculations dramatically, allowing the model to multiply individual feature probabilities instead of modeling complex dependencies.

Different variants exist for different data types, such as Gaussian Naive Bayes for continuous features and Multinomial Naive Bayes for discrete counts like word frequencies in text.

Example

To classify an email as spam or not, Naive Bayes counts how often words like 'free' or 'winner' appear in spam versus normal emails, then multiplies those probabilities under the independence assumption to decide the most likely category.

Why it matters

Naive Bayes remains widely used today because it is extremely fast to train, works well with limited data, and serves as a strong baseline for text classification tasks such as spam filtering and sentiment analysis.

Frequently asked questions

It is called naive because it assumes all features are completely independent, which is rarely true in real data but greatly simplifies math.