A1 · Supervised Machine Learning in Depth

Module Review and Assessment

This assessment covers Supervised Machine Learning in Depth: the workflow and leakage, preprocessing and pipelines, linear and logistic regression with their derivations, k-NN, Naive Bayes, SVMs, trees and ensembles, evaluation metrics and curves, imbalance, cross-validation, tuning and interpretability, through derivation exercises and a scored quiz.

20 min Advanced

What you need: The earlier topics of this module, and its prerequisites.

Definition

Ready to show mastery of supervised learning?

This assessment covers Supervised Machine Learning in Depth: the workflow and leakage, preprocessing and pipelines, linear and logistic regression with their derivations, k-NN, Naive Bayes, SVMs, trees and ensembles, evaluation metrics and curves, imbalance, cross-validation, tuning and interpretability, through derivation exercises and a scored quiz.

In simple words

Work through the derivations on paper first, then take the quiz. Each answer is explained. Anything you miss points to the topic to revisit before moving on to unsupervised learning.

Why it matters

These ideas recur in every advanced module: gradient descent and log loss train neural networks, regularisation becomes weight decay, and evaluation and leakage apply to every LLM system you will build.

How it works

Derivation exercises

  1. Derive the normal equation from J(w) = ‖y − Xw‖².
  2. Show that the gradient of log loss for logistic regression is Xᵀ(p − y)/n.
  3. Derive the ridge solution (XᵀX + λI)⁻¹Xᵀy and explain why it is always invertible for λ > 0.
  4. Compute the Gini decrease of a split from 8/2 into 6/0 and 2/2.
  5. Show that the cost-optimal threshold is c_FP / (c_FP + c_FN) for calibrated probabilities.

Common mistakes

  • Tuning on the test set, or preprocessing before the split.
  • Reporting accuracy on imbalanced data.
  • Reading feature importance as causation.

Check yourself

Question 1

1. Which step prevents preprocessing leakage?

Question 2

2. The least-squares solution satisfies…

Question 3

3. If gradient descent's loss explodes, first try…

Question 4

4. Which penalty can set weights exactly to zero?

Question 5

5. R² = 1 − SS_res/SS_tot. A model worse than the mean has R²…

Question 6

6. The gradient of logistic log loss is…

Question 7

7. k-NN without feature scaling is dominated by…

Question 8

8. Laplace smoothing in Naive Bayes prevents…

Question 9

9. In an SVM, a larger C usually gives…

Question 10

10. Random forests mainly reduce… and boosting mainly reduces…

Question 11

11. With 1 per cent positives, the most informative curve is…

Question 12

12. For daily sales forecasting, use…

Question 13

13. Error = Bias² + Variance + Noise. More model complexity usually…

Question 14

14. Why can random search beat grid search on the same budget?

Question 15

15. Permutation importance should be computed on…

Summary

  • You can derive, implement, evaluate and tune the main supervised algorithms.
  • You can design honest validation and choose metrics and thresholds from costs.
  • Next: unsupervised learning and applied machine learning.

Finished reading?