Examples¶
Nine notebooks, each executed and committed with outputs. None needs external data or credentials.
| Notebook | Task | Domain | Model |
|---|---|---|---|
| 01 Binary classification | binary | credit scoring | GradientBoostingClassifier |
| 02 Multiclass and ordinal | multiclass, ordinal | underwriting | RandomForestClassifier |
| 03 Regression | regression, validation | premium, severity, frequency | GradientBoostingRegressor |
| 04 PyTorch and friends | binary | fraud | PyTorch, Keras-shaped, remote |
| 05 Boosters and the CLI | binary | fraud | XGBoost, --model-loader |
| 06 Reports and plots | all three | credit, pricing, underwriting | LogisticRegression, plain functions |
| 07 Insurance pricing | regression, exposure | motor tariff end to end | GradientBoostingRegressor + business rules |
| 08 Generative side-cars | binary + a side-car | claims explanation assistant | a scripted LLM stand-in |
| 09 Champion and challenger | binary | replacing a credit scorecard | LogisticRegression → HistGradientBoostingClassifier |
Start with 01. It covers the core machinery — contexts, checks, reports, verdicts, configuration, custom checks, plugins, validation and the CLI. The others assume it and focus on what their task or framework changes.
06 is the other half — the fourteen charts, why each one is not a number, the self-contained HTML report a reviewer signs, and the confidence intervals plus the split-stability check that measures what they bought.
07 is the domain case — the same machinery pointed at a rate filing: exposure weighting, actual-vs-expected by decile, the Lorenz Gini against its ceiling, a filed monotonicity constraint the tariff breaks, and who gets an increase. See Insurance pricing. Read it after 03.
08 is the generative half — prompt injection tested for leakage rather than for refusal, both surfaces, and a canary leak caught. No network and no credentials: the side-car is a scripted stand-in. See Generative side-cars.
09 is the replacement case — a challenger that beats the champion on AUC and is clearly worse for one channel, then the traps that make a comparison confidently wrong. See Replacing a model.
Running them¶
01–03 need nothing more. 04 needs torch; 05 needs xgboost (and
brew install libomp on macOS, which XGBoost requires there regardless);
06, 07, 08 and 09 need the [plots] extra.
Why PyTorch and XGBoost are in separate notebooks
On macOS the two link different OpenMP runtimes and segfault in the same process — a hard crash, not an exception. A single notebook covering both would die partway through for many readers.
Source lives in
examples/, and
examples/run_all.sh re-executes them all and fails on the first error.