Overfitting
The algorithms, the bias-variance trade-off and the questions on model choice
Computer Science | Undergraduate (Level 6) | December 2026
WHAT IS INSIDE
1. Framing a learning problem
2. Core supervised algorithms
3. Evaluation and the bias-variance trade-off
4. From model to deployment
Exam question patterns
Glossary of exam-ready definitions
1. Framing a learning problem
Supervised learning maps inputs to labelled outputs, unsupervised learning finds structure without labels,
and reinforcement learning learns a policy from reward. The first exam decision is the task type - regression
for a continuous target, classification for a categorical one - and the second is the loss: squared error penalises
large deviations heavily and is sensitive to outliers, absolute error is robust but non-differentiable at zero, and
cross-entropy is the natural loss for probabilities because it punishes confident wrong answers hardest.
Features decide more of the outcome than the algorithm. Categorical variables need encoding (one-hot,
ordinal, target), numeric features need scaling for any distance-based or gradient-based method, and data
leakage - fitting a scaler or selecting features before splitting - produces a model that looks excellent in
validation and fails in production. The i.i.d. assumption behind every held-out estimate is worth stating
whenever the data are temporal or grouped.
• Inductive bias - every learner assumes something; smoothness, linearity, locality or axis-aligned splits.
• Class imbalance - accuracy misleads; use precision, recall, F1, balanced accuracy or PR-AUC.
• Leakage - encode and scale inside the cross-validation fold, never before the split.
• Curse of dimensionality - distance concentrates as dimensions grow, which erodes k-NN and clustering.
2. Core supervised algorithms
Linear regression fits coefficients by least squares and is interpretable, with the Gauss-Markov conditions
making it the best linear unbiased estimator; ridge adds an L2 penalty to stabilise collinear features, lasso an
L1 penalty that also selects, and elastic net combines them. Logistic regression models the log-odds with a
sigmoid and is the baseline every classifier must beat, because it is fast, calibrated and explainable through its
coefficients.
k-nearest neighbours is non-parametric and local: small k gives a jagged boundary and low bias with high
variance, large k smooths it. Decision trees split greedily on information gain or Gini impurity, are
interpretable and unstable - a small data change can rebuild the tree - which is why bagging, random forests
and gradient boosting exist. Support vector machines maximise the margin and, with the kernel trick, learn
non-linear boundaries, at the cost of scaling behaviour and tuning two hyperparameters.
• Regularisation strength - raising lambda reduces variance and increases bias; tune it, do not guess it.
• Random forest - decorrelates trees by feature subsampling; little tuning, strong baseline.
• Boosting - sequential correction of residual error; higher accuracy, more sensitive to noise and overfitting.
Machine Learning: Supervised Learning, Evaluation and Overfi Page 1 of 3