What is classification?
Classification is a supervised learning task in which a model assigns an input to one or more predefined discrete classes; deciding whether an email is spam, which type a document is or whether a transaction carries fraud risk are examples.
Unlike regression, which predicts a continuous number such as demand, classification picks a discrete label. Most classifiers actually output a probability per class, with the label set by a threshold.
- Topic
- Machine learning, models and training
- Also known as
- Categorisation
How classification works
- A model is trained on labelled examples and learns to predict class probabilities from inputs.
- Binary classification picks one of two classes, multi-class one of many; multi-label classification can assign several labels to one input.
- Probabilities become labels by a threshold or by choosing the most probable class.
- Performance is evaluated with the confusion matrix, accuracy, precision, recall and F1.
In more detail
The closed-world assumption and abstention
Standard classifiers assume a closed world and force every input, even gibberish, unseen topics or emerging complaint types, into one of the known labels. Production pipelines pair classification with out-of-distribution (OOD) detection or an explicit 'Other' or 'Abstain' threshold so novel inputs route to human review rather than silent misclassification.
Confidence calibration and threshold management
Raw softmax scores from neural networks and prompted LLMs are frequently overconfident and do not reflect true error likelihood. Temperature scaling or isotonic calibration aligns confidence scores with actual accuracy when routing borderline cases to human reviewers.
Ordinal and hierarchical classification
Not all discrete labels are independent: risk tiers (Low, Medium, High) have an inherent order (ordinal classification), while enterprise taxonomies often form multi-level trees (hierarchical classification). Choosing ordinal losses or hierarchical classifiers prevents severe errors such as confusing Low with High or assigning inconsistent sub-categories.
Distilling an LLM into a small classifier
In enterprise workflows, teams often combine LLM versatility with small-model efficiency through teacher-student distillation: a frontier LLM labels or generates synthetic edge cases, which are then used to train a compact encoder (such as ModernBERT or DeBERTa) or a contrastive few-shot head (SetFit) for fast, low-cost on-premise inference.
Commonly confused terms
| Term | How it differs |
|---|---|
| Clustering | Classification is supervised learning with predefined class labels. Clustering is unsupervised learning that discovers natural groups in unlabelled data without assigning predefined names. |
| Multi-label classification | Multi-class classification assigns exactly one label from three or more mutually exclusive classes (e.g., department routing). Multi-label classification allows multiple non-exclusive labels simultaneously for a single input (e.g., an email tagged both 'Billing' and 'Urgent'). |
Why classification matters for on-premises AI
Classification is enterprise AI's most common task: document routing, complaint categorisation, risk grading and quality control are examples. Large language models can classify by prompting without labelled data, but for high-volume fixed-category work a small fine-tuned classifier is often cheaper, faster and more consistent. The right metric depends on class distribution and error cost; on imbalanced data accuracy alone misleads.
To route citizen petitions to the right unit, a public body trains a classifier on past petitions; low-confidence predictions go to human review and precision and recall are tracked monthly per unit.
Common questions
How does classification differ from regression?
Classification picks a discrete label. Regression predicts a continuous number.
Can large language models be used for classification?
Yes, by prompting or fine-tuning. For high volumes a small classifier is often cheaper and more consistent.
Related terms
Sources
- Hastie, Tibshirani and Friedman, The Elements of Statistical Learning, Springer, 2009
- Goodfellow, Bengio and Courville, Deep Learning, MIT Press, 2016
In the glossary: Glossary, A to C