# Fit a small text classifier

Fit a multinomial naive Bayes teaching model using four invented support messages. Class1 has “late broken parcel” and “late delivery”; class0 has “thanks excellent service” and “excellent support thanks”. Training builds separate token counts, class document counts and a training-only vocabulary. Prediction combines the class prior with smoothed token likelihoods in log space. Add-one smoothing prevents an observed vocabulary word from having zero likelihood simply because it did not appear in one class.

Hold out “late parcel” and “excellent thanks”. The fitted model predicts1 and0 respectively. These two convenient cases illustrate the implementation, not a defensible accuracy estimate. No test text is added to the training vocabulary. Unknown tokens are ignored, so a message containing only unseen words is decided by the class prior. With equal priors the explicit tie policy returns0. That behaviour needs disclosure because an unfamiliar urgent complaint could receive a routine label.

Change the training class balance and inspect the prior-driven behaviour for unseen text. Add a contradictory training example and examine whether predictions change. Explain that the simplifying token-independence assumption is often unrealistic and that repeated words affect the likelihood. The same English ASCII preprocessing limits used by the keyword lesson apply here. A sentence such as “not late” can be misinterpreted; tiny curated examples provide no protection against such failures.

Support supplies reviewed labels; analytics manages splits and training artifacts; management agrees whether predictions assist triage or determine a consequential decision. Human review and escalation are essential parts of the proposed workflow. Ask Who labels messages, Whose writing differs from the fixture and How unfamiliar text should be routed. Foundation: explain training vocabulary. Undergraduate: trace counts and one prediction. Postgraduate: evaluate a larger held-out dataset, leakage, class imbalance and costs. Research: design an annotation and deployment study with uncertainty and subgroup analysis. Submit the fitted counts, two predictions, unseen-word tests and an override policy. No pretrained model, external API or live customer data is used.

## Expected baseline

Held-out late parcel->1;excellent thanks->0;unseen-only message->0 with equal priors.

## Evidence

1. Write hand predictions before running the fixture.

Response:

2. Run the implementation and tests;compare expected output.

Response:

3. Complete the specific changed and failure cases described above.

Response:

4. Submit the four-level study evidence and departmental decision memo.

Response:
