AlgoViz

Naive Bayes Visualization

Placement Mode:
Class Selection:
Show Grid
Show Distributions
Show Decision Boundary
Class 1
Class 2
Class 3
Test Point (colored by predicted class)

How It Works

Naive Bayes is a probabilistic classifier based on applying Bayes' theorem with strong independence assumptions between features:

  1. The algorithm models each feature (x, y coordinates) as having a Gaussian distribution for each class
  2. When classifying a new point, it calculates P(class|features) ∝ P(features|class) × P(class)
  3. The "naive" assumption is that features are independent, so P(x,y|class) = P(x|class) × P(y|class)
  4. The class with the highest posterior probability is selected as the prediction

Interactive Features

  • Add training points of different classes by clicking on the canvas
  • Add test points to see how they get classified
  • Toggle distribution visualization to see the Gaussian models for each feature
  • View decision boundaries to understand how the algorithm partitions the feature space
  • Generate random points to quickly test the algorithm with different data distributions