The case
You are a junior analyst building a risk report on eleven US instruments. The report grows after most sessions, a part at a time, from two stocks compared by hand in Part 1 to every model of the course side by side in Part 12.
How it works
- A part after most sessions. Parts are numbered by session, so there is no Part 7, 10 or 13: those sessions are case lectures of their own.
- Each part starts where the last one stopped. From Part 2 on, a quick load cell restores the numbers the earlier parts worked out, so you can start a part even if you skipped the one before.
- Do the session's exercises first. The exercises teach the moves; the case asks you to choose which move to make.
- Run all is safe. Every cell runs before you fill in its
..., and hints and solutions are folded under each question.
The report, part by part
What each part asked, what it added to the report, and the number it ended on, as Part 12 sums it up. "Open" starts the part in Colab.
| Part | The question | What it added | The number | |
|---|---|---|---|---|
| 1 | Which of Apple and Coca-Cola moved more in 2024? | lists, slicing and a first gauge, the price range | Apple 51.22 percent, Coca-Cola 26.15 | open |
| 2 | Volatility from every daily return | loops, functions, a dictionary of five stocks | Nvidia 0.0330 a day, Coca-Cola 0.0080 | open |
| 3 | All eleven instruments | pandas: returns, annualised volatility, rankings, figures | Nvidia 53 percent a year, the S&P 500 fund 13 | open |
| 4 | Which names will be volatile next month? | a target, features from the past, a split by date, two baselines | the average 0.00514, persistence 0.00417 | open |
| 5 | The first model | linear regression on vol_20d, chosen on time-ordered folds | 0.00402, ahead of persistence on 11 of 11 | open |
| 6 | Every column the desk has | OLS, ridge, the lasso, pipelines, GridSearchCV | ridge 0.00460 against 0.00412; ahead on 7 of 11 | open |
| 8 | Will next month be busier? | logistic regression, the threshold, the AUC | AUC 0.797 | open |
| 9 | A jump, priced | a rare label, costs, a threshold of 0.25, calibration, k-NN | AUC 0.889; a cost of 178 against 210 | open |
| 11 | Trees and forests | a tree, bagging, a forest tuned on the folds, out-of-bag | the forest 0.00462, level with ridge | open |
| 12 | Boosting, and the report as a whole | boosting, XGBoost, importance, every model side by side | boosted stumps 0.00398 and 0.00780; the forecast stays | open |
Where it ends
Parts 1 to 3 described a year that had happened. Part 4 turned the report into a question about the next month and set the rules every later part kept: a target that cannot see the future, a split by date, and baselines to beat. Parts 5 to 12 then brought one family of models after another to that question, and each was held to the same test block and the same folds.
The report that goes out holds a volatility forecast, a warning before a jump, and the evidence for both. On the folds, the one-column model from Part 5 was never beaten by enough to replace it.