Word Probabilities
0 words
| Word | P(w|Spam) | P(w|Ham) | Log LR |
|---|---|---|---|
| Classify a message to see word probabilities | |||
Training Data
What is Naive Bayes?
Naive Bayes is a probabilistic classifier based on Bayes' theorem. It predicts the class of an input by computing the posterior probability of each class given the observed features.
Why "Naive"?
The algorithm is called "naive" because it assumes that all features (words) are conditionally independent given the class. While this assumption is rarely true in practice, the classifier often performs surprisingly well.
How to Use
- Type a message and click Classify to see the prediction
- Examine the word probability table to see per-word contributions
- Adjust α to see the effect of Laplace smoothing
- Add training data to improve the classifier
- Toggle log probabilities to see the math behind the scenes
Training Phase
- Count the number of spam and ham messages
- Compute prior probabilities: P(Spam), P(Ham)
- Tokenize each message into words
- Count word frequencies per class
- Compute P(word|class) with Laplace smoothing
Classification Phase
- Tokenize the input message
- For each class, compute log P(class) + Σ log P(word|class)
- The class with the highest score wins
- Convert log-scores to probabilities via softmax
Fitted Parameters
Training parameters will appear here.
Live Calculation
Classify a message to see the calculation breakdown.