Skip to main content
BVDNET
Arnhem · websites & automationBVDNET
Core Concepts

Classifier

A classifier is an AI model that sorts each input into one of a set of categories you chose, such as spam or not spam, or which team a ticket goes to.

Also known as: classification model, classificatiemodel

A classifier is an AI model that sorts things into fixed categories: an email is spam or not, a support ticket is about billing or about delivery. You choose the categories. The model learns from examples that people have already labelled, and then labels new cases on its own, often with a score for how sure it is. Where regression predicts a number, a classifier predicts a category.

How does it work?

Most classifiers are trained with supervised learning: the model sees many inputs with the right label and learns which patterns go with which class. Google's Machine Learning Crash Course uses a spam filter as its example. The model gives each email a probability that it is spam, and a classification threshold turns that probability into a label. With the threshold at 0.5, emails scored 0.99 and 0.51 both go to the spam folder; at 0.95, only the first one does.

There are three set-ups. Binary classification has two classes. In multiclass classification each input gets exactly one of several classes, such as orange, apple or pear. In multilabel classification an input can get several labels at once, because the properties do not exclude each other (scikit-learn). Common algorithms include logistic regression, decision trees and random forests, support vector machines, naive Bayes and neural networks, and the Python library scikit-learn implements all of them.

A large language model can classify without that training: you describe the categories in the prompt, with or without a few examples (zero-shot or few-shot prompting). Anthropic's guide to ticket routing has Claude sort support tickets by intent, and says this works with a few dozen labelled examples, where traditional machine learning needs large labelled datasets.

How do you measure it?

The crash course starts from the confusion matrix, which counts four outcomes: true and false positives, and true and false negatives. The usual metrics follow from it:

  • Accuracy: the share of all classifications that is correct.
  • Precision: of everything labelled positive, the share that really is positive (how much of the spam folder is spam).
  • Recall: of all real positives, the share the model found (how much of the spam reached the spam folder).
  • F1: the harmonic mean of precision and recall, preferable to accuracy when the classes are imbalanced.

Accuracy misleads when one class is rare. If 1% of the cases are positive, a model that always says "negative" scores 99% accuracy and is useless. Raising the threshold usually improves precision and lowers recall, so the right threshold depends on which mistake costs more: a real email in the spam folder, or spam in the inbox.

Example

Gmail's spam filter is a classifier on a large scale: in a blog post from February 2019, Google put Gmail at 1.5 billion users a month. Google wrote that its machine learning models, together with rule-based protections, kept more than 99.9% of spam, phishing and malware out of Gmail inboxes. New models built with TensorFlow blocked about 100 million additional spam messages a day, including image-based spam and messages from domains registered shortly before. Every email, Google notes, has thousands of potential signals, which the models weigh together.