Spam Detection
Interactive Visualizations (Naive Bayes • Logistic Regression • KNN)
Loading dataset…

Prior Probability Control

Drag either slider to modify class priors and observe how it affects posterior probabilities and accuracy of a Naive Bayes classifier.

Bayes' Theorem
\[P(C \mid X) = \frac{P(X \mid C)\,P(C)}{P(X)}\]
Posterior ∝ Likelihood × Prior  —  we adjust P(C) with the sliders below
0.82
0.18
Original Class Distribution
Posterior Probabilities \(P(C\mid X)\)
Summary
P(Ham)
P(Spam)
Accuracy
Prediction

Feature Independence Visualization

Select a message (or choose Custom), click Analyse, and adjust Top N words to see feature contributions.

Naive Bayes Independence Assumption
\[P(X \mid C) = \prod_{i=1}^{n} P(x_i \mid C)\]
Each word contributes independently — multiply all individual likelihoods
8
Individual Feature Likelihoods
Posterior Probabilities
P(Ham | X)
P(Spam | X)
Predicted Class

Model Comparison

Train and compare Logistic Regression, KNN, and Naive Bayes on the same TF‑IDF features.

Not trained
Click the button to train models and view metrics.
Classifiers Comparison on the selected sample Ham Spam
Logistic Regression
K‑Nearest Neighbors
Naive Bayes