PythiloLesson 6 of 12 · progress kept in this browser

Practice in Lab: Use the finite-sample conformal rank →

Use the finite-sample conformal rank

Split conformal regression calibrates an interval width using held-out absolute residuals. The finite-sample rank is ceil((n+1)(1-alpha)), not an ordinary interpolated percentile. If that rank exceeds the available calibration sample, the conservative interval is unbounded.

Coverage is marginal under exchangeability between calibration and future observations. It does not guarantee conditional coverage for every subgroup or survive arbitrary time drift. The calibration residuals must come from a model that was not fitted on those calibration outcomes. Keep the final test set separate from choosing the score or calibration strategy.

import math
n=9;alpha=.1
print(math.ceil((n+1)*(1-alpha)))
Your task

Implement conformal_radius(residuals,alpha) with finite nonnegative residuals, nonempty input and 0<alpha<1. Return sorted residual at one-based rank ceil((n+1)*(1-alpha)); return inf if rank>n.