Label examples
Start with fictional passages already labeled gardening or baseball. Labels come with the teaching data. The model does not invent them.
From systems to signals.
A field guide to probabilistic classification
A likelihood can summarize patterns in training data. It cannot tell you who a person is. This interactive guide shows the math, the assumptions, and the places a tidy score can go wrong.
The example uses fictional posts about gardening and baseball. It does not infer political views, age, gender, or any other personal trait. Nothing leaves your browser.
Its meaning depends on the data behind it.
A multinomial Naive Bayes classifier counts how often words appear in labeled examples. It then compares how likely a new passage is under each topic.
Start with fictional passages already labeled gardening or baseball. Labels come with the teaching data. The model does not invent them.
Split text into lowercase words. Count each word within each topic, then add smoothing so an unseen word does not zero out the score.
Multiply the prior by each token likelihood. In practice, add log probabilities to avoid tiny floating point values.
Rescale the topic scores so they sum to one. The result is a model score, not a statement about the author's identity.
The prior is the topic's share before reading the passage. The likelihood asks how expected each word is within that topic. The code uses log(prior) + Σ log(likelihood), then applies softmax.
Edit the passage or choose a sample. The base rate slider changes the starting assumption before any words are read.
Use fictional text only. Do not paste another person's posts or personal information.
Bars to the right favor gardening. Bars to the left favor baseball. Repeated words add repeated weight.
for each topic:
score = log(topic_prior)
for each recognized token:
count = token_count_in_topic + 1
total = all_tokens_in_topic + vocabulary_size
score += log(count / total)
probability = softmax(scores)
Each recognized token is treated as conditionally independent given the topic. That assumption is convenient, not realistic. Phrases, sarcasm, quoted text, and context can break it.
The teaching table below is deliberately tiny. It makes the arithmetic inspectable. It is not a trained language model or a benchmark of classification accuracy.
Calculation updates locally in this page.
A useful model report separates the score from its test results. These charts use invented evaluation data to show what that report should contain.
If many cases receive a score near 70%, about 70% should have the labeled outcome. The gap between those values is the calibration error.
One overall accuracy number can hide uneven mistakes. Report false positive rates for each relevant group, with sample sizes and intervals.
Invented values for teaching. They are not measurements of Facebook users or any real population.
The formula is easy. Getting evidence that deserves trust is much harder.
A model learns the judgments in its training set. Ambiguous labels and annotator disagreement become part of the score.
Quoting a post is not endorsing it. Jokes and local slang can flip meaning. A bag of words throws that context away.
Language moves. Interests change. A model tested on last year's posts may fail on today's without any code changing.
Rare outcomes need strong evidence. Move the prior in the demo and watch the same words produce a different result.
Softmax forces the scores to sum to one. That does not make the model right, especially when the input differs from its training data.
Classification can help sort public documentation, route support tickets, or label consented research data. It should not turn fragments of a person's life into an identity claim. The honest output includes uncertainty, provenance, and a reason to stop.