PythiloLesson 8 of 8 · progress kept in this browser

Practice in Lab: Project: train uncertainty and calibrate independent prediction intervals →

Project: train uncertainty and calibrate independent prediction intervals

An uncertainty model and an interval calibration procedure answer different questions. This project trains a heteroscedastic likelihood, selects its checkpoint on validation data, and only then uses a separate calibration partition to choose interval width. The corrected order statistic is an integer rank, not an interpolated percentile. Final test rows measure observed coverage without feeding back into model or quantile selection. Synthetic regions make subgroup differences visible while keeping every row reproducible offline.

Your task

Build the complete local synthetic heteroscedastic regression experiment with four disjoint partitions: training, validation selection, conformal calibration and final test. Train both mean and positive variance using Gaussian NLL, choose the checkpoint by validation NLL, then compute normalized absolute calibration residuals and the finite-sample ceil((n+1)*(1-alpha)) order statistic without interpolation. Export the learned state plus quantile, reload in a fresh model, and report actual test coverage, width and left/right-region coverage. Calibration and test labels must never fit or select model weights. Keep the full reference report schema. Marginal conformal coverage requires exchangeability and does not imply subgroup coverage.

This lesson uses torch, which Python in this browser does not include. Read it here, and run and check it in the Pythilo app on iPhone or iPad.

All lessons