Black October, explainedAppsGuidesAI DictionarySmall FixesOn RecordAboutFollow the lab

Classification

Also called classifier

Classification is when an AI sorts each input into one of a set of categories, like spam or not spam, cat or dog, fraud or fine.

In plain words

Many questions we ask computers have a fixed set of answers. Is this email spam or not? Is this photo a cat, a dog or a bird? Is this card payment normal or suspicious? Picking the right category is called classification.

A classifier learns from past examples that were already sorted, which makes it a kind of supervised learning. It works out which details tend to go with which category, then draws a boundary between them.

When something new arrives, the classifier checks which side of the boundary it falls on. Usually it also gives a confidence, like 92% likely spam, and a cut-off decides when that counts as a yes. Spam filters, phone face recognition and the auto-tagging in a photo gallery all work this way.

Everyday example

Sorting mangoes at a fruit stall

A fruit seller picks up each mango and, in a second, drops it into one of two baskets: ripe today or keep for later. She is not measuring anything exactly. She has handled thousands of mangoes and learned what colour, softness and smell go with each basket. Each mango is an input, the baskets are the categories.

Where the example breaks: The seller can taste a mango to check her call and notice when a new variety arrives. A classifier never checks its own answers, and if a new input looks unlike anything it trained on, it still picks a basket, often confidently.

Go deeper

How it actually works

Formally, a classification model maps an input's features to one class out of a fixed set.

  1. Two classes or many

    Binary classification picks between two options, such as spam or not spam. Multi-class picks one of many, such as which of 1,000 objects is in a photo. Multi-label lets an input carry several tags at once.

  2. A boundary in feature space

    Each example is a point in a space of features. Training finds a boundary that separates the classes as well as possible. With two features it is a line; with thousands it is a surface no one can picture, but the idea holds.

  3. Scores, then a threshold

    Most classifiers output a probability for each class. A method called logistic regression, despite its name, does exactly this. A threshold then turns the score into a decision; raising it means fewer false alarms but more misses.

  4. Measuring mistakes

    A confusion matrix counts four outcomes: correct yes, correct no, false alarm and miss. For rare events like fraud, accuracy alone misleads, so people track precision (how many flagged items were right) and recall (how many real cases were caught).

  5. Classifiers inside bigger AI

    Image recognition, content moderation and guardrails all rely on classifiers. Even a language model picking its next word is, at each step, choosing one class out of its whole vocabulary.

Type of learning
Supervised: trained on examples with known categories
Output
A category, often with a probability for each
Sister task
Regression, which predicts a number instead of a category
Everyday uses
Spam filters, face recognition, fraud alerts, medical image screening, photo tagging

Questions people ask

What is the difference between classification and regression?

Classification predicts a category, such as spam or not spam. Regression predicts a number, such as a price or tomorrow's temperature. A handy test: if the answer comes from a fixed list, it is classification; if it is a quantity on a scale, it is regression.

What is the difference between classification and clustering?

Classification learns categories someone already defined, from labelled examples. Clustering gets no labels and invents its own groups from the data. Classification answers "which known box?"; clustering asks "what boxes are there?"

What are examples of classification in AI?

Email spam filtering, recognising the owner's face on a phone, flagging suspicious card payments, sorting customer messages by topic, spotting signs of disease in scans, and detecting the language a text is written in.

Why is logistic regression used for classification?

Because it predicts a probability between 0 and 1, such as the chance an email is spam. Pick a threshold, say 0.5, and that probability becomes a yes or no. The name is historical: it comes from statistics, where the method was first framed as regression.

Further reading