Reference

Glossary

Short definitions of the terms that appear across the regression notes. Linked from inline mentions where useful.

28 terms
Bias
Systematic error from a model too simple to capture the true pattern. High-bias models underfit — high error on both train and test.
See also: Variance · Underfitting
Cost function
The number the optimiser tries to minimise. For OLS regression it's SSE; with regularisation it's SSE plus a coefficient penalty.
Cross-validation
Repeated train/test splits to reduce score variance. k-fold is the standard variant — every row gets validated exactly once.
Data leakage
Test information sneaking into training — duplicate rows, scaler fit on the full dataset, features built from the target. Inflates scores and breaks generalisation.
Elastic Net
Convex combination of L1 and L2 penalties controlled by `l1_ratio`. Useful when features are correlated and pure LASSO becomes unstable.
See also: L1 / LASSO · L2 / Ridge
Feature selection
Picking a subset of features for the final model. LASSO does it implicitly via zeroed coefficients; RFE does it explicitly by recursive elimination.
GridSearchCV
Exhaustive search over a hyperparameter grid using cross-validation. After `.fit` it has picked the best params *and* refit on the full training set.
Hyperparameter
A knob set by you, not by the data. Polynomial degree, Ridge alpha, the number of folds — those are hyperparameters.
See also: Parameter · GridSearchCV
k-fold
Cross-validation splitter: chop data into k slabs, train on k−1, validate on 1, rotate. Common k = 5 or 10. Set `shuffle=True` unless the row order means something.
L1 / LASSO
Regularisation that penalises the sum of absolute coefficients: `λ Σ |β|`. Drives some coefficients to exactly zero — automatic feature selection. Slower to fit (coordinate descent).
L2 / Ridge
Regularisation that penalises the sum of squared coefficients: `λ Σ β²`. Shrinks everything toward zero but doesn't zero anything out. Fast (closed-form solution).
Loss function
The per-example error term inside the cost function. Squared error for regression, log-loss for classification. Often used interchangeably with 'cost' in casual usage.
See also: Cost function
MSE
Mean Squared Error — SSE divided by n. Comparable across datasets of different sizes. Use `mean_squared_error` from sklearn.metrics.
See also: SSE · RMSE
Overfitting
Model has learned the noise as if it were signal. Symptom: gap between train and test performance. Fix: simpler model, regularisation, or more data.
Parameter
A value learned from the data during training (e.g. the coefficients of a linear regression).
See also: Hyperparameter
Pipeline
Chains preprocessing and an estimator into a single object. Critical for cross-validation: each fold's training rows refit the preprocessor independently.
Polynomial features
Expand each feature with its powers and cross-products. `PolynomialFeatures(degree=2)` turns `[x₁, x₂]` into `[x₁, x₂, x₁², x₁x₂, x₂²]`. The model stays linear in the coefficients.
See also: Overfitting
Coefficient of determination. Fraction of variance in y explained by the model. 1 = perfect, 0 = no better than predicting the mean, negative = worse than that.
See also: MSE
Recursive feature elimination
Fit, drop the lowest-importance feature, refit, repeat. `RFE` needs a fixed target count; `RFECV` picks the count by cross-validation. Works on any estimator with `.coef_` or `.feature_importances_`.
Regularization
Any technique that constrains a model to reduce variance — typically by penalising coefficient magnitudes. The α / λ knob controls strength; pick it via cross-validation.
Residual
The signed difference between an observed y and the model's prediction: yᵢ − ŷᵢ. Residual plots reveal whether the model has missed a pattern.
See also: SSE · MSE
RMSE
Root Mean Squared Error — √MSE. Lives in the same units as y, which makes it easier to interpret than MSE.
See also: MSE
ShuffleSplit
Yields n independent random train/test splits. Unlike k-fold, the validation sets can overlap. `StratifiedShuffleSplit` preserves class ratios.
SSE
Sum of Squared Errors. The total squared residual across all training examples. Lower = tighter fit, but watch for overfitting.
See also: MSE · Residual
StandardScaler
Subtracts the mean and divides by the standard deviation per feature. Mandatory before Ridge / LASSO / Elastic Net so the penalty is scale-blind.
Train/test split
Hold out a fraction of rows (commonly 20–30%) for evaluation. Train on the rest. `sklearn.model_selection.train_test_split` is the workhorse.
Underfitting
Model is too rigid to capture the underlying pattern. Both train and test error are high. Fix: more features, polynomial expansion, lower regularisation.
See also: Bias
Variance
Sensitivity to which exact training rows you used. High-variance models overfit — tiny train error, large test error, very different fits across resamples.
See also: Bias · Overfitting