AI GLOSSARY · AI CONCEPTS
Linear regression
Definition
Linear regression is a supervised method that predicts a number as a weighted sum of input features plus a constant, with the weights chosen so the predictions fit the training data as closely as possible.
Also called: linear regression machine learning, linear regression model, linear regression algorithm, OLS regression.
In plain language
Linear regression predicts a number by adding weighted features and a constant. With one unchanged input feature, its predictions form a straight line. With several features it uses a weighted combination; supplying squared or other transformed features can let that combination describe a curve in the original input. Outliers and poorly chosen features can affect the fit, so evaluate predictions on data excluded from fitting.
Technical definition
A linear regression model predicts y_hat = w0 + w1*x1 + ... + wp*xp. In the Google Machine Learning Crash Course the weight plays the role of the slope and the bias the role of the y-intercept, both calculated during training. Ordinary least squares, as implemented by scikit-learn's LinearRegression, fits the coefficients to minimize the residual sum of squares between observed and predicted targets. Near linear dependence among columns of the design matrix can make coefficient estimates unstable. Linear independence of columns is not the same as statistical independence of input variables. Regularized variants such as ridge and lasso are covered in the same guide.
Worked examples in this catalogue
Catalogue examples point at a skill, guide or coding tool listed on this site, with what to run and what you see. An example marked illustrative describes the item from its own documentation; it was not executed for this page. Platform Scores are our assessment under a published method, not a safety guarantee.
Skill by Skill Almanac · Illustrative, not executed
data-analysis-eda 56/100 · Provisional, not yet measuredScored · Method v0.2 · How we score
- What you see
- A fixed exploratory-analysis procedure and a CSV profiler, with findings kept descriptive, evidenced and caveated.
- Why it exercises the concept
- The catalogue has no training skills. Profiling a table first shows the column types, gaps and spread that decide whether this method is a sensible choice for the data.
Skill by Skill Almanac · Illustrative, not executed
split-leakage-check 53/100 · Provisional, not yet measuredScored · Method v0.2 · How we score
- What you see
- A JSON report that checks train, validation and test files for duplicates, shared groups, time leakage and label leakage.
- Why it exercises the concept
- The catalogue has no skill that trains this algorithm. This one covers the step that decides whether a score from any trained model can be trusted: whether the test rows were kept apart from the training rows.
Skill by Skill Almanac · Illustrative, not executed
mock-record-generator 42/100 · Provisional, not yet measuredScored · Method v0.2 · How we score
- What you see
- Seeded mock records written as CSV or JSON from a JSON field list or a simple TypeScript interface.
- Why it exercises the concept
- The catalogue has no training skills. Seeded mock rows give you a small, repeatable table to try a scikit-learn example on without touching real data.
How it shows up when you use agents
Linear regression is one supervised learning baseline for predicting a number that an agent can build when you ask Claude Code, Codex or Cursor to model a column in a CSV. It also connects to modern training: a loss function measures the gap between predictions and targets, and gradient descent is one way to reduce it, although least squares can also be solved directly.
The catalogue has no skill that trains models, so the examples cover the work around one. A common failure is reading too much into a fitted line. A strong fit on training data says little about new data, correlated input columns can make the coefficients unstable, and an unsuitable feature representation can miss a curved relationship. Ask the agent to profile the data first, report error on held-out rows, and plot the residuals. A next action is to compare it with a more flexible model on the same split.
Worked example (illustrative)
Choose the toy model y_hat = 1 + 2x + 3x². At x = 2 it returns 17. It is linear in its chosen coefficients even though its predictions form a curve as x varies. Its supplied features are x and x². This arithmetic counterexample shows why linear does not mean a straight line in the original input; no coefficients were fitted and no predictive accuracy was measured.
Common confusions
- Linear regression versus logistic regression. Linear regression predicts a number. Logistic regression is used for classification into categories, despite the word regression in its name.
- Linear versus straight line. The model is linear in its weights. You can feed it transformed features, but what it learns is still a weighted sum.
- Fit versus cause. A fitted weight describes a pattern in the data. It does not show that changing the input would change the outcome.
- Statistics versus machine learning. The method is the same. In a machine-learning setting, it fits the relationship between features and a label.
Related terms
Terms that mention Linear regression
3 terms mention this one
More in AI concepts
Sources
- 1.1. Linear Models, scikit-learn (accessed 2026-11-24)
- What is linear regression?, IBM (accessed 2026-11-24)
- Linear regression, Google for Developers (Machine Learning Crash Course) (accessed 2026-11-24)
- Preprocessing: polynomial feature construction, scikit-learn (accessed 2026-11-24)
Definitions are written by Skill Almanac from these sources and were checked against them on 2026-11-24. Wikipedia is never the only source.
Review record
Last verified
Drafted by Claude (original draft) and Codex (automated revisions); sources and example targets checked by Independent automated source review (OpenAI Codex); not human peer review on 2026-11-24. Last verified .
Change log (6)
- : Independent automated factual/example review completed. Cached US query estimate aligned to receipt; no traffic promise. Final technical gate recorded separately; publication disabled.
- : First version.
- : Verifier pass: applied wording corrections from the verification list.
- : Foundation scope and counterexample corrections; independent exact-version review pending.
- : Removed unrelated sample-size comparison card; retained the direct polynomial-feature illustration. Independent recheck pending.
- : Automated review completed; approved for the staged public release. Search indexing is controlled by the release configuration.