Regression in Machine Learning: Types, Metrics and Examples

LLM foundationsModels and inferencePublished By Simon Budziak

Regression is the machine learning task of predicting a continuous number from input data. Next week's demand, a delivery time, the price a house will fetch. A model learns from labeled history how the inputs relate to the numeric outcome, then estimates it for new cases. It is supervised learning, the numeric sibling of classification.

How does regression work?

Each training row pairs inputs with a known number, the setup of supervised learning, and the model fits a function that keeps a loss such as mean squared error as low as possible. Linear regression, the most common type, predicts a weighted sum of the inputs plus an intercept, so each coefficient reads as “one more unit of this input adds this much to the outcome”. When the relationship curves, polynomial terms, tree ensembles or a neural network take over, and ridge and lasso add regularization. The inputs you choose usually matter more than the algorithm, the work of feature engineering.

Regression vs classification: what is the difference?

The output. Regression returns a number, classification returns a category.

Regression Classification
Output A continuous number One of a fixed set of labels
Example Units sold next week Will this customer churn?
Typical methods Linear, ridge, lasso, tree regressors Logistic regression, tree classifiers
Typical loss Mean squared error Log loss (cross-entropy)
Metrics MAE, RMSE, R squared Accuracy, precision, recall

Logistic regression is a classifier despite its name. It “is implemented as a linear model for classification rather than regression” (scikit-learn 1.9.1 linear models guide, read 5 November 2026): it outputs a probability between 0 and 1, and a threshold turns that into a label.

How do you evaluate a regression model?

With error metrics on data the model never trained on.

Metric What it measures How to read it
MAE Mean absolute error The typical miss, in the target’s units
RMSE Root of mean squared error Same units, large misses weigh more
R squared Share of variance explained 1.0 is perfect, 0.0 matches predicting the average

R squared has no floor: its “best possible score is 1.0 and it can be negative” (scikit-learn 1.9.1 model evaluation guide, read 5 November 2026). Pick the metric whose errors cost what yours cost: RMSE when one large miss hurts, such as a stockout, MAE when every unit off costs the same. Training-set scores flatter through overfitting.

Where do businesses use regression?

Wherever a decision waits on a number. Demand forecasting sets stock and staffing, pricing models estimate what a market will bear, logistics teams predict delivery times, and finance projects customer lifetime value. Much predictive analytics is regression under another name. A forecast is only usable with its error attached: 1,200 units plus or minus 150 is a plan, 1,200 alone is a guess. “Regression testing” is an unrelated software idea, rerunning checks to catch a change that broke what used to work; for prompts and models see prompt regression testing.

This entry was drafted with AI assistance.

Frequently asked questions

What is regression vs linear regression?

Regression is the general task of predicting a number. Linear regression is one method for it, which models the outcome as a weighted sum of the inputs; polynomial regression, tree ensembles and neural networks are other methods for the same task.

What is the goal of linear regression?

To find the straight-line relationship between the inputs and a numeric outcome that keeps prediction error lowest, usually the sum of squared errors, so it can estimate the outcome for new cases and show how much each input moves it.

Is logistic regression used for regression?

No. Despite the name, logistic regression predicts the probability that an input belongs to a class, so it is a classification method. The name comes from the logistic function it fits, not from the kind of task it solves.

Summarize this page with

Train your team to build this