# Classification

> Classification is a machine learning task in which a model assigns each input, such as an email, image, transaction or document, to one of a set of predefined categories, for example spam or not spam, or which team should handle it.

Also called: text classification, image classification, categorisation, tagging, intent detection. Category: Models and training. Source: https://aibuildindex.com/glossary/classification

## In the index

- Machine learning: median $3,520, middle half $500 to $10,000, 4,945 priced briefs (https://aibuildindex.com/skills/machine-learning)
- Image classification: median $1,680, middle half $500 to $4,560, 43 priced briefs (https://aibuildindex.com/skills/image-classification)
- scikit-learn: median $4,720, middle half $400 to $21,060, 83 priced briefs (https://aibuildindex.com/skills/scikit-learn)

Classification means sorting things into labelled buckets automatically. Is this email a complaint, a sales enquiry or an invoice? Is this transaction suspicious? Does this photo show a damaged item? For a business buyer it is one of the most practical forms of AI, because most back-office work starts with deciding what something is and where it should go.

## How it works

There are two broad ways to build a classifier. The traditional route is [machine learning](https://aibuildindex.com/glossary/machine-learning): collect examples that people have already labelled, train a model on them, and test it on examples it has not seen. This suits high volumes, stable categories and tabular data such as transactions. The newer route is to ask a language model to choose a label from a list, describing each category in the prompt and asking for [structured output](https://aibuildindex.com/glossary/structured-output). That needs few or no labelled examples and copes well with messy text, but each call costs more and results can drift when the model is updated.

Variants matter. **Binary** classification has two outcomes. **Multi-class** picks one of many. **Multi-label** allows several at once, such as a ticket that is both urgent and about billing. A support inbox build might classify each incoming message by topic and urgency, route it to the right queue, and send anything below a confidence threshold to a person.

## What it means for cost

The model is rarely the hard part. A quote mostly reflects:

- **Category design.** Overlapping or vague categories cause errors no model can fix. Agreeing clear definitions with examples is cheap and saves weeks.
- **Labelled examples.** Training a classical model needs [training data](https://aibuildindex.com/glossary/training-data); even a prompt-based approach needs a labelled test set for [evals](https://aibuildindex.com/glossary/evals).
- **Cost of mistakes.** If a wrong label sends a refund to the wrong place, the build needs thresholds, review queues and logging.
- **Volume.** At very high volumes a small trained model is usually cheaper to run than a language model call per item.

Ask a builder how they will measure precision and recall for each category, not only overall accuracy.

## Common mistakes

Reporting a single accuracy figure hides problems when categories are uneven. If nearly all emails are routine, a model that labels everything routine looks accurate and is useless. Per-category results and a confusion matrix tell the real story.

## Common questions

### What is the difference between classification and clustering?

Classification uses categories you define in advance. Clustering groups items by similarity without predefined labels and leaves people to decide what each group means. Clustering is useful for discovering categories; classification is for applying them.

### How many labelled examples does a classifier need?

There is no fixed number. It depends on how many categories there are, how distinct they are and which approach is used. A prompt-based classifier can start with a small test set; a trained model usually needs a meaningful number of examples per category, especially rare ones.

## Related terms

- [Machine learning](https://aibuildindex.com/glossary/machine-learning): Machine learning is a branch of AI in which software learns patterns from examples rather than following hand-written rules, then uses those patterns to make predictions or decisions about new data.
- [Sentiment analysis](https://aibuildindex.com/glossary/sentiment-analysis): Sentiment analysis is the automatic detection of the attitude in a piece of text, usually positive, negative or neutral, used to sort reviews, support tickets, survey answers and social mentions at a scale no team could read by hand.
- [Training data](https://aibuildindex.com/glossary/training-data): Training data is the set of examples a machine learning model learns from, such as labelled images, past transactions or question-and-answer pairs, and its quality, coverage and rights largely decide how well the finished model performs.
- [Data labelling](https://aibuildindex.com/glossary/data-labelling): Data labelling is the work of adding correct answers to raw examples, such as tagging images, marking entities in text or rating model outputs, so that a machine learning model can be trained or evaluated on them.
- [Evals (AI evaluation)](https://aibuildindex.com/glossary/evals): Evals are structured tests that measure how well an AI system performs on a fixed set of realistic inputs, scoring its outputs so that changes to prompts, models or data can be judged by evidence rather than impression.
- [Structured output](https://aibuildindex.com/glossary/structured-output): Structured output is a way of making an AI model return its answer in a fixed, machine-readable format, typically JSON matching a defined schema, so that other software can use the result without guessing at free text.
