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?
| Aspect | Classification | Regression |
|---|---|---|
| Predicts | A category or class | A continuous number |
| Output example | Spam / not spam; cat / dog | A house price; tomorrow’s temperature |
| Question it answers | "Which group does this belong to?" | "How much / how many?" |
| Typical measure | Accuracy, precision, recall | Error size (e.g., average distance from truth) |
| Both are | Supervised 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.