Machine Learning
Naive Bayes — Fast Probabilistic Classification
Decision regions
Ellipses show 1σ (solid) and 2σ (dashed) of each class. They are always axis-aligned: naive Bayes assumes the features are independent.
Data
What the model learned
| Class | Prior | Mean (x1, x2) | Std (x1, x2) |
|---|---|---|---|
| 0 | 0.361 | -0.496, -0.394 | 0.178, 0.228 |
| 1 | 0.300 | 0.473, -0.372 | 0.195, 0.216 |
| 2 | 0.339 | 0.017, 0.505 | 0.230, 0.213 |
Train accuracy
98.3%
Test accuracy
100.0%
How to use this tool
- 1Choose Gaussian (numbers) or Text (word counts).
- 2Gaussian: pick a dataset and read the learned means, standard deviations and accuracy.
- 3Text: edit the labelled training messages, then type a message to classify.
- 4Read the posterior probabilities and the per-word evidence table.
Frequently asked questions
It assumes the features are independent given the class — for text, that each word appears independently. That is rarely true, but the classifier still works surprisingly well.
It adds α to every word count so that a word never seen in one class does not make that class impossible.
Yes. They match scikit-learn’s GaussianNB and MultinomialNB on the same data and tokens.
No. Everything is calculated in your browser; nothing you enter is sent to MuhammadLab.
Related tools
Logistic Regression — Classification Basics
Train logistic regression with gradient descent on 2D data: probability map, threshold, confusion matrix and ROC.
Random Forests — Bagging for Trees
Train a random forest on 2D data and compare it with single trees: decision regions, OOB accuracy and feature importance.
Gradient Descent — Optimization (Explained)
Compare gradient descent, momentum, Nesterov, RMSProp and Adam on bowls, valleys, Rosenbrock, Himmelblau and saddles.