A customer sends a support ticket that says “refund charge.” A support team wants to route it to Billing or Technical Support. A Naive Bayes classifier can make that choice using the categories of past tickets and the words each category tends to contain.
Naive Bayes is a family of classifiers that uses Bayes’ theorem to compare classes given the observed features. The “naive” assumption is that features are independent once the class is known. For text, this lets the model combine evidence from individual words using counts learned from labeled examples.
What the model learns from old tickets
Suppose the training inbox contains 12 Billing tickets and eight Technical tickets. Your class priors are 12 ÷ 20 = 0.60 for Billing and 8 ÷ 20 = 0.40 for Technical. The prior describes how frequent each category was before the model saw the new ticket.

To keep the arithmetic small, use a vocabulary of four words. The table counts occurrences, so a word appearing twice in one ticket contributes two. A real text model typically uses a much larger vocabulary.
| Word | Billing count | Technical count |
|---|---|---|
| refund | 6 | 1 |
| charge | 5 | 1 |
| login | 1 | 6 |
| error | 0 | 4 |
| Total | 12 | 12 |
Score a new ticket in three steps
1. Smooth the word counts
With add-one smoothing, add one to the count for each word in each class. The denominator becomes the total word count plus the vocabulary size, or 12 + 4 = 16 for either class. In Billing, “refund” has probability 7/16 and “charge” has probability 6/16. In Technical, each has probability 2/16.
Smoothing also gives “error” a Billing probability of 1/16 even though it never appeared in the Billing training sample. Without smoothing, that zero would make the entire Billing score zero whenever “error” appeared.
2. Multiply the prior and the word probabilities
For “refund charge,” Billing scores 0.60 × 7/16 × 6/16 = 0.0984375. Technical scores 0.40 × 2/16 × 2/16 = 0.00625. Multinomial Naive Bayes uses a word’s contribution once for each occurrence, and implementations generally add log probabilities to avoid multiplying many tiny values.
3. Compare the class scores
Billing has the higher score, so the model sends the ticket there. Dividing the Billing score by the sum of both scores gives about 94% under this model. If the team wants to use that number as an estimate of real-world confidence, it should check calibration on held-out tickets.

When the independence assumption matters
“Refund” and “charge” can appear together even after you know a ticket is about Billing. Treating them as separate evidence can make the model overly confident. A count model also loses word order. The messages “please refund” and “do not refund” share a strong cue even though the requests differ.
Test a few real cases with negation, quoted messages, and mixed topics. Adding short phrases as features may help in some cases. Compare that change against the original on the same splits so another change in the data does not explain the difference.
Which Naive Bayes variant fits your data?
| Variant | Typical input | Example |
|---|---|---|
| Multinomial | Nonnegative word counts | Number of times “refund” appears |
| Bernoulli | Binary indicators | Whether “refund” appears at least once |
| Gaussian | Continuous measurements | Response time or request duration |
The support ticket calculation uses the multinomial variant. Bernoulli also models whether a feature is absent. Gaussian Naive Bayes models each continuous feature with a Gaussian distribution within each class. Scikit-learn guide to Naive Bayes variants.
Evaluate the routing decisions
Fit the vocabulary and classifier on training tickets. Hold out later tickets if you plan to deploy the model on future requests, and keep messages from the same thread together to avoid leaking near-duplicates across training and validation. How to choose a cross-validation split.
Compare against a majority-class baseline and logistic regression. Then look at how many Technical tickets were routed to Billing and how many Billing tickets went the other way. Those two mistakes may create different delays. How to read a confusion matrix and how logistic regression works.
Common questions
Can Naive Bayes handle more than two classes?
Yes. Add a prior and feature probabilities for each class, then compare all scores. A support team could add separate Account Access and Shipping categories if it has enough examples to evaluate both.
What happens when a ticket contains a completely new word?
With a fixed training vocabulary, the vectorizer typically ignores a new word that lacks a feature column. Smoothing applies to a feature already in the vocabulary that was unseen within a particular class.
Is the class with the largest prior always predicted?
No. The prior is one factor. Strong word evidence can favor a rarer class. If the message contains no recognized features, a count-based model can fall back to the class priors.














