Regression
Teaching a computer to guess a number on a scale, such as a price, a time or a size, from past examples where the real number was known.
Draft - this entry has not been reviewed yet.
Formal
A task in machine learning where the model learns from labelled examples to map an input to a number that can take any value within a range, and is judged by how far its guesses land from the real values.
In plain English
Like guessing a house's price from its size, age and street after seeing what many other houses sold for; the answer is an amount, not a yes or no.
In practice
An operations planner at a water utility uses a model trained on five years of readings to predict tomorrow's water use hour by hour from the weather forecast and the day of the week.
Why it matters
Many business questions are "how much" or "how long", not "which one"; the guess always has a margin of error that must be shown, not hidden.
Technical deep dive
The name comes from Francis Galton's observation that children of unusually tall parents tend to be closer to average height, published in 1886 as "Regression towards mediocrity in hereditary stature". The workhorse is linear regression fitted by ordinary least squares: minimise the sum of squared residuals, which for a design matrix X and target vector y has the closed-form solution β = (XᵀX)⁻¹Xᵀy, the normal equations. Under the Gauss-Markov assumptions (a model linear in its parameters, errors with zero mean given the inputs, uncorrelated errors with constant variance, no perfect multicollinearity) OLS is the best linear unbiased estimator. In practice it is solved with QR or SVD decompositions rather than an explicit matrix inverse, for numerical stability.
Regularised variants trade a little bias for lower variance: ridge regression (Hoerl and Kennard, 1970) adds an L2 penalty, lasso (Tibshirani, 1996) an L1 penalty that sets some coefficients exactly to zero, and elastic net combines both. Non-linear regression is handled by feature transformations, splines, generalised additive models, tree ensembles such as gradient boosting, or neural networks with a linear output unit. Poisson and other generalised linear models suit counts and rates; time-series forecasting adds temporal structure (autoregression, seasonality) and must be validated on strictly later periods.
The loss function encodes what an error costs. Mean squared error targets the conditional mean and is dominated by outliers; mean absolute error targets the conditional median and is more robust; Huber loss is quadratic near zero and linear in the tails. Reported metrics include RMSE and MAE in the target's own units, MAPE (undefined when the true value is zero and asymmetric in its penalties), and R², the share of variance explained, which can be negative on test data when a model does worse than predicting the mean.
A point forecast is incomplete without uncertainty. Quantile regression, using the pinball loss, predicts chosen quantiles such as the 10th and 90th percentile directly; conformal prediction wraps any model to give intervals with finite-sample coverage guarantees under exchangeability. Common failures are heteroscedasticity (error that grows with the level, invalidating constant-width intervals), extrapolation beyond the range seen in training, where tree models go flat and linear models continue straight lines indefinitely, and confusing correlation in coefficients with causal effect.
Two naming traps: logistic regression is a classification method, and "regression" in software testing means a previously working feature breaking, which is unrelated. Regression also differs from classification only in the output type; ordinal targets such as ratings from 1 to 5 sit in between and can be modelled either way.
What to learn first
Everything this builds on, foundations first.
- Training data
- →Model training
- →Regression
Relationships
- A kind of
- Supervised learning
- Requires
- Model training
- Implemented by
- Decision treeLinear regression
- Don't confuse with
- Classification
- Used with
- Validation set
Sources & further reading
Standards & official texts
Official documentation
- scikit-learn User Guide, Linear Models · scikit-learn
Reference works
- Galton (1886), Regression Towards Mediocrity in Hereditary Stature · Journal of the Anthropological Institute of Great Britain and Ireland
- Hoerl & Kennard (1970), Ridge Regression: Biased Estimation for Nonorthogonal Problems · Technometrics
- Tibshirani (1996), Regression Shrinkage and Selection via the Lasso · Journal of the Royal Statistical Society, Series B
Textbooks
Where this data comes from
This entry was drafted by an AI from the sources above and has not yet been checked by a person. Treat it as a starting point, and check anything important against the sources.
See the review queueSuggest a correction on GitHubThis term as JSON
Check yourself
Loading…