Classification

Classification is the machine learning task of assigning each input to one of a set of categories, such as which language a sentence is in or whether a transaction is fraudulent.

Classification is one of the two basic kinds of supervised learning. A classification model predicts a category; a regression model predicts a number. Google's machine learning glossary gives examples of the first: a model that predicts whether a sentence is in French, Spanish or Italian, one that predicts the species of a tree, and one that predicts whether a patient has a particular condition. In each case the possible answers are a fixed set of labels, called classes.

The model learns from labelled examples. It is shown many inputs along with their correct classes, and training adjusts its parameters until it can predict the class of examples it has not seen. Inputs are described by features: the words in an email, the pixels of an image, the amount and location of a payment. Many classifiers output a probability for each class, and the most likely class, or one that crosses a chosen threshold, becomes the prediction.

There are two main forms. Binary classification has exactly two classes, such as spam or not spam. Multi-class classification has more, such as identifying which of three iris species a flower belongs to. A related form, multi-label classification, allows one input to carry several labels at once, as when a news article is tagged with both politics and technology.

Methods range from logistic regression and decision trees to deep neural networks, and the task underpins a huge share of deployed AI: spam filters, fraud detection, medical image screening, content moderation and sentiment analysis. Large language models can also classify text when asked in a prompt, which has made simple classification tasks possible without training a dedicated model. Whether that is the cheapest or most reliable option depends on the volume and the stakes.

Common questions

What is classification in machine learning?

It is the task of predicting which of a fixed set of categories an input belongs to. A model learns from examples that already carry the correct category, then applies what it learned to new inputs, such as deciding whether an email is spam.

What is the difference between classification and regression?

Classification predicts a category, such as approved or declined. Regression predicts a number, such as the price of a house. Some models produce a probability that is then turned into a category, which blurs the line, but the type of output is the deciding factor.

What is the difference between classification and clustering?

Classification learns from examples that already have correct labels and sorts new inputs into those known categories. Clustering works without labels, grouping inputs by similarity and discovering the groups itself. Classification is supervised learning; clustering is unsupervised.

Can large language models do classification?

Yes. Given a prompt describing the categories, a large language model can label text such as reviews or support tickets without dedicated training. For high-volume or high-stakes uses, a smaller model trained specifically for the task is often cheaper and easier to test.

Finding more

Search for "classification vs regression", "multi-class classification" or "classification metrics" for clear introductions. Machine learning courses and glossaries from major providers, statistics references and the documentation of libraries such as scikit-learn are reliable. When judging a classifier in the news, look for how it was tested and how it performs on each class, not only overall accuracy.

Working out what this means for your business?

Aileron Shift builds the systems behind this site: AI newsrooms that research, write and publish on their own, marketing automation and WordPress hosting for companies that need to move faster than their competitors.