MegaMaester

Artificial Intelligence

Classification vs Regression

Within supervised machine learning, the task is either classification or regression. The difference comes down to one question: are you predicting a category or a number?

AspectClassificationRegression
PredictsA category or classA continuous number
Output exampleSpam / not spam; cat / dogA house price; tomorrow’s temperature
Question it answers"Which group does this belong to?""How much / how many?"
Typical measureAccuracy, precision, recallError size (e.g., average distance from truth)
Both areSupervised learning (need labelled data)Supervised learning (need labelled data)

When to use classification

Use classification when the answer is a label from a set of categories — yes/no, or one of several classes.

When to use regression

Use regression when the answer is a quantity on a continuous scale — a price, a duration, a measurement.

Frequently asked questions

How do I decide which one I need?
Look at what you’re predicting. If the target is a category (a label), it’s classification. If it’s a number that can take a range of values, it’s regression. The same underlying data can sometimes be framed either way depending on the question.
Can a model do both?
Many algorithms have classification and regression versions (for example, decision trees and neural networks). The core method is similar; what changes is the kind of output and how error is measured.
Is predicting a rating (1–5 stars) classification or regression?
It can be treated as either — as ordered categories (classification) or as a number to estimate (regression). The right framing depends on whether the order and spacing of the values matter for your goal.