
Bias Variance Tradeoff (60 Pages)
You can already ask an AI to write you a bias–variance analysis. The problem is knowing why a model that fits its training data perfectly can predict worse than a cruder one, why averaging more neighbors helps right up until it suddenly hurts, or why a simulation with too few runs can quietly make the wrong model look best. None of that is visible from model.fit(). This is the course that gives you that judgment.
Five parts, one algorithm, no gaps:
· Part 1 — Intro. Why every prediction error splits exactly into noise, squared bias and variance, why making a model more flexible trades one for the other, and how averaging, regularization and cross-validation each manage that trade. The intuition before the notation.
· Part 2 — By Hand. A complete worked example: ten noisy readings of a parabola, one query point, and five full iterations of k-nearest-neighbor regression — average prediction, bias, variance and expected error for k = 1 to 5, every number shown. Nothing waved away, nothing left “as an exercise.” You watch the expected error fall from 8 to 52/9 and climb again, then prove to yourself that k = 3 cannot be beaten.
· Part 3 — In Excel. The same example built out in a spreadsheet you can open and poke at, one iteration per block, carried through all ten values of k, with a second sheet that measures bias and variance from twenty simulated data sets — so you watch the best k shift as you change the noise level or the true response.
· Part 4 — In Python. A clean, executable, verified reference implementation that computes the exact decomposition, confirms it with ten thousand simulated training sets, and checks its own answer by brute force — the known-good version you can check any other code against.
· Part 5 — With AI. A tested prompt that directs an AI assistant to carry this same algorithm to your problem, plus the understanding to catch it when it's wrong.
By the end you won't just have working code. You'll have followed the bias–variance tradeoff from first principles through a hand calculation, a spreadsheet, and production Python — so when you point an AI at your own model, you'll know how to diagnose whether a disappointing error comes from bias or from variance, size a simulation large enough to trust, choose the complexity setting on purpose, and tell when the answer is right.