Skip to content
StackDecode
AI & ML Atlas
Machine LearningalgorithmInteractive simulation

Gaussian Naive Bayes

Naive Bayes for continuous features, modelled as bell curves per class.

The idea

For each class and each feature, it estimates a mean and variance and uses the normal density as the likelihood. Classification multiplies those densities with the class prior. Boundaries are smooth curves where the class densities cross.

P(x | c) = (1/√(2πσ²))·exp(−(x−μ)²/2σ²)

Watch it run

This is a real computation, not a drawing. Pause, step, change the settings, or try new random data.

  • class 0
  • class 1

All the data starts in one box. The tree will ask yes/no questions to separate the classes.

impurity:
0.5
1/4

Every cut is axis-aligned, so each region is a rectangle. Deeper trees carve finer boxes and can overfit.

Step by step

  1. 1Compute each class's prior.
  2. 2For each class and feature compute the mean and variance.
  3. 3Evaluate the Gaussian density of the new point's features.
  4. 4Multiply by the prior and choose the largest.

Where it is used

Measurements such as sensor or medical readings.

Watch out for

Features that are not bell-shaped give poor likelihoods; transform them first.

Related