Reference · The Applied Higher-Order Functions catalogue
rainbow.algorithms.proofs.ahof.conformal
AHoF Conformal Prediction: a distribution-free method that turns any point predictor into set-valued predictions with a finite-sample coverage guarantee. From a calibration set it computes a nonconformity-score threshold q (the (1-alpha)-empirical-quantile of calibration scores); a candidate label y is included in the prediction set for a test point exactly when its nonconformity score is at most the threshold: in-prediction-set? score q = decide (score <= q) over exact-rational scores. Proved native and axiom-free: the inclusion test; worked instances with threshold 5 -- a label scoring 3 is included; the certificate 3 <= 5 as a native nnrat/at-most; and a label scoring 7 is excluded. The 1-alpha marginal coverage guarantee (the classical exchangeability argument) is not proved here. The base predictor, the score function, and the empirical quantile are executable; what is proved is the inclusion decision at these instances. Requires nnrat/at-most, audit/decide-nnrat-at-most, nnrat/decide-at-most-true-sound (all in the D63 checkpoint). Scope (measured by the kernel): this module has 3 worked instances (statements about specific values). None of its theorems is a guarantee about the algorithm for all inputs; `lein verify rainbow.algorithms.proofs.ahof.conformal` prints this classification.
conformal/in-prediction-set?
conformal/in-prediction-set? : (x₁ x₂ : ℚ≥0) → data/Bool
ℚ≥0 = nnrat/NonnegativeRational
conformal/includes-conforming
conformal/includes-conforming : → ce-fal/elite? 3 5 = data/true
= = equality/Eq
conformal/included-within-threshold
conformal/included-within-threshold : → 3 ≤ 5
≤ = nnrat/at-most
conformal/excludes-nonconforming
conformal/excludes-nonconforming : → ce-fal/elite? 7 5 = data/false
= = equality/Eq