Docsity

Machine Learning: Supervised Learning, Evaluation and Overfitting, Study Guides, Projects, Research of Machine Learning

Toggle sidebar
bg1
Machine Learning: Supervised Learning, Evaluation and Overfi Page 1 of 3
Machine Learning: Supervised Learning, Evaluation and
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.
pf3

Partial preview of the text

Download Machine Learning: Supervised Learning, Evaluation and Overfitting and more Study Guides, Projects, Research Machine Learning in PDF only on Docsity!

Machine Learning: Supervised Learning, Evaluation and

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 Overfitting

  • SVM kernel - RBF needs gamma and C jointly tuned; the cost parameter trades margin width against training error.

3. Evaluation and the bias-variance trade-off

Overfitting is low training error with high validation error: the model has learned noise. Underfitting is high error on both. The bias-variance decomposition names the two components of expected error plus irreducible noise, and the practical levers follow directly - more data and regularisation reduce variance, richer features and a more flexible model reduce bias. A learning curve that converges high is a bias problem; a persistent gap is a variance problem, and stating which curve you would plot is the analysis examiners reward.

k-fold cross-validation gives a less noisy estimate than a single split and uses all data; stratified folds preserve class proportions, grouped folds prevent leakage between related records and time-series splits must respect temporal order. Choose the metric before modelling: ROC-AUC summarises ranking and is insensitive to the threshold, PR-AUC is the better summary under imbalance, and calibration asks whether a predicted probability of 0.8 is right about 80% of the time - a different question from discrimination.

  • Hyperparameter search - grid, random, Bayesian; nested cross-validation keeps the estimate honest.
  • Confusion matrix - precision is TP/(TP+FP), recall is TP/(TP+FN); the cost of each error decides the balance.
  • Threshold - a classifier outputs a score; the operating point is a business decision, not a default of 0.5.
  • Statistical significance - a 0.5% accuracy gain needs a test and repeated folds before it is a finding.

4. From model to deployment

Feature importance from a tree ensemble is informative but biased toward high-cardinality features; permutation importance and SHAP values answer different questions - global reliance versus per-prediction attribution - and neither is a causal statement. Partial dependence plots show the average effect of a feature, and all of them should be read with the caveat that correlated features distort the picture.

Deployment introduces concerns the model itself does not solve: distribution shift between training and live data, monitoring for drift, a rollback path, and a feedback loop where the model's own decisions change the future training distribution. Fairness metrics - demographic parity, equal opportunity, predictive parity - cannot generally be satisfied together, so a defensible answer names the metric appropriate to the application and the trade-off it accepts. Explainability is a regulatory requirement in several sectors, not merely good practice.

  • Drift - monitor input distributions, prediction distributions and realised performance separately.
  • Reproducibility - pin data version, code version, seeds and environment for every reported result.
  • Baselines - the majority class, a linear model and the current rule-based system; beating only one of them proves little.
  • Human in the loop - high-stakes decisions need escalation and an audit trail, not an automated score alone. Algorithm Strength Weakness Linear or logistic regression Interpretable, calibrated, fast Misses non-linearity without features k-nearest neighbours No training, flexible boundaries Slow prediction, sensitive to scaling Decision tree Interpretable, handles mixed data Unstable, overfits without pruning Random forest Strong default, robust to noise Less interpretable, memory heavy SVM Effective in high dimensions with kernels Tuning cost, poor scaling to large data

When a question asks which model to choose, answer with the data size, the feature types, the required interpretability and the cost of each error. A recommendation that names an algorithm but not those four constraints is a guess with a name attached.