Linear Models
A linear model predicts through a score . What changes across regression, logistic regression, and linear margin classifiers is the link from to the output and the loss used for fitting.
Defining math
For squared-error regression,
where is the feature vector for example , is the intercept, is the vector of coefficients (one per feature), is the observed target, and is the prediction. For binary logistic regression, the same linear score is passed through the sigmoid to produce a probability:
fitted with cross-entropy loss instead of squared error. With ridge regularization, many linear objectives add a penalty
where is the squared coefficient norm and is the penalty strength that trades fit against shrinkage. Lasso regularization instead uses an penalty and can set coefficients exactly to zero, which turns coefficient shrinkage into feature pruning; see regularization for the ridge-lasso comparison. The geometry is simple: a one-unit feature change moves the score by the corresponding coefficient, holding other features fixed. That interpretability is only meaningful when preprocessing, interactions, and scaling are explicit.
Intuition
Linear models are strong baselines because they ask whether the representation already contains the answer. If a linear model works well, the features encode the signal in an almost additive way. If it fails with systematic residuals or segment errors, the next move is often feature engineering, not immediately a larger model.
Worked example
Fit a one-feature line to five points by least squares. With and , the slope and intercept are
So . The residuals are , and their squares sum to . No other line achieves a smaller squared total — that is exactly the quantity least squares minimizes:
The slope is the model’s whole story: a one-unit increase in raises the prediction by , regardless of where on the line you stand. That constant, additive effect is what makes linear models interpretable — and also what fails when the true effect depends on or on other features, the case for feature engineering or a nonlinear method.
Caveats
Coefficient magnitude is not comparable across differently scaled features. Correlated predictors make individual coefficient stories fragile even when predictions are stable, and lasso may prune one correlated feature while keeping another. Linear additivity also hides interactions: if risk rises only when two conditions co-occur, the model needs interaction features or a nonlinear method such as decision trees.
References
Nav