# Classification vs Regression

URL: https://softwaredictionary.org/compare/classification-vs-regression
Last updated: 2026-10-06

In short: Classification predicts a category, such as spam or not spam; regression predicts a number, such as a price or a delivery time. Both are supervised learning.

## What is the difference between classification and regression?

Classification and regression are the two main kinds of supervised learning: in both, a model learns from labeled examples, inputs paired with the correct answer, and then predicts that answer for new inputs. In classification the answer is a category, called a class, such as fraud or not fraud, or which topic a support ticket is about. In regression it is a continuous number, such as a flat's sale price, tomorrow's temperature or how long a delivery will take.

The type of answer changes how a model is judged. A classifier usually outputs a probability for each class and turns it into a decision with a threshold, and it is measured by accuracy, precision, recall and a confusion matrix. A regression model outputs a number and is measured by how far it misses, with the mean absolute error (MAE), the root mean squared error (RMSE) or R².

Many algorithms come in both versions, such as decision trees, gradient-boosted trees and neural networks, so the choice depends on the question, not the tool. A quick test: if it makes sense to ask how far off a prediction was, it is regression; if the prediction is simply right or wrong, it is classification. A number can also become a class with a cut-off, for example predicting a delivery time and then flagging orders that will be late.

A common source of confusion is logistic regression, which despite its name is a classification model: it computes a probability between 0 and 1, and a threshold turns it into a class. Another is treating labels that happen to be numbers, such as product codes or the digits 0 to 9 in an image, as a regression target; they are names, not quantities, so they call for classification.

| Aspect | Classification | Regression |
| --- | --- | --- |
| Predicts | A category, called a class | A continuous number |
| Example questions | Is this email spam? Which digit is in this image? | What will this flat sell for? How long will delivery take? |
| Output | A probability per class, turned into a label by a threshold | A single value, such as 235 or 4.7 |
| Measured with | Accuracy, precision, recall and the confusion matrix | MAE, RMSE and R² |
| A wrong answer | Picks the wrong class | Misses the true value by some amount |
| Classic first model | Logistic regression | Linear regression |
| Common pitfall | Accuracy misleads when one class is rare | Outliers pull the predictions and inflate RMSE |

## Choose Classification when

- The answer is one of a fixed set of labels, such as spam or not spam.
- You need a yes-or-no decision, such as approving or flagging a transaction.
- Items can carry several tags at once, such as the topics of an article.
- The labels are names that happen to be numbers, such as product codes.

## Choose Regression when

- The answer is a quantity, such as a price, a duration or a temperature.
- Being close counts: a small miss is better than a big one.
- You forecast values such as demand, sales or energy use.
- You want to know how much each input moves the result, as linear regression shows.

## Frequently asked questions

**Is logistic regression classification or regression?**

Classification. Despite its name, it computes the probability that an input belongs to a class, and a threshold, often 0.5, turns that probability into a predicted class.

**Can the same algorithm do both classification and regression?**

Yes. Decision trees, random forests, gradient-boosted trees, k-nearest neighbors and neural networks all come in a classification and a regression version; what changes is the output and the error the model is trained to reduce.

**Is predicting a rating from 1 to 5 classification or regression?**

Either can work. Treating the stars as classes ignores that 4 is closer to 5 than to 1, while regression keeps that order but may predict values such as 3.6; ordinal regression is a middle ground made for ordered categories.

---

Software Dictionary: https://softwaredictionary.org/ · https://softwaredictionary.org/llms.txt
