

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


The algorithms, the bias-variance trade-off and the questions on model choice Computer Science | Undergraduate (Level 6) | December 2026
WHAT IS INSIDE
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.
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.
Machine Learning: Supervised Learning, Evaluation and Overfitting
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.
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.
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.