Theorem 1: validity of split conformalized quantile regression
ProvedConformalizedQuantileRegression.cqr_coverageLet , , be exchangeable. Partition into disjoint sets with and , and let . Fit with a measurable quantile regression algorithm on the proper training set , compute the conformity scores for , let be their -th empirical quantile, and let
Then
If moreover the conformity scores , , are almost surely distinct, then
The guarantee holds for every joint distribution of the data and every quantile regression algorithm, however inaccurate.
Formalization Note The split is fixed (deterministic); a random split drawn independently of the data is covered by conditioning on it. The fitted functions are required to depend measurably on the training data and the input, the standing convention that makes the coverage event measurable. is valued in the extended reals; when it is and . The distinctness hypothesis is read as distinctness of the calibration and test scores.
import Mathlib import Definitions.Def_ConformalizedQuantileRegression_Basic open MeasureTheory ProbabilityTheory
namespace ConformalizedQuantileRegression
theorem cqr_coverage {Ω : Type*} [MeasurableSpace Ω] (P : Measure Ω)
[IsProbabilityMeasure P] {p n : ℕ} (Z : Fin (n + 1) → Ω → Sample p) (hZ : IsExchangeable P Z)
(I₁ I₂ : Finset (Fin n)) (hdisj : Disjoint I₁ I₂) (hsplit : I₁ ∪ I₂ = Finset.univ)
(hI₂ : I₂.Nonempty) (A : QRAlgorithm p I₁) (hA : IsMeasurableAlgorithm A)
(α : ℝ) (hα0 : 0 < α) (hα1 : α < 1) :
ENNReal.ofReal (1 - α) ≤
P {ω | (Z (Fin.last n) ω).2 ∈
cqrInterval A I₂ α (fun i => Z i.castSucc ω) (Z (Fin.last n) ω).1} ∧
((∀ᵐ ω ∂P, Set.InjOn
(fun j => conformityScore (fitQR A (fun i => Z i.castSucc ω)).1
(fitQR A (fun i => Z i.castSucc ω)).2 (Z j ω))
(↑(I₂.map Fin.castSuccEmb ∪ {Fin.last n}) : Set (Fin (n + 1)))) →
P {ω | (Z (Fin.last n) ω).2 ∈
cqrInterval A I₂ α (fun i => Z i.castSucc ω) (Z (Fin.last n) ω).1} ≤
ENNReal.ofReal (1 - α + 1 / ((I₂.card : ℝ) + 1))) := by sorry
end ConformalizedQuantileRegressionRead-back
What the Lean code literally says, in plain math · claude-opus-5-5
Setting. Let be a probability space. Fix natural numbers (the feature dimension) and . Let
be random samples. Each consists of a feature vector and a response . They are assumed exchangeable:
- each is measurable for the product Borel structure on ;
- for every permutation of , the joint law of on equals the joint law of .
The first samples are the data. is the test point.
The split. Let satisfy:
- ;
- ;
- , which forces .
may be empty. Write .
The algorithm. is an arbitrary map that takes a family of samples indexed by and returns a pair of functions , each from to . It is assumed that both of the following maps are jointly measurable:
Nothing else is assumed about . In particular, is not assumed. If , then returns one fixed pair.
For each , the fitted functions are obtained by applying to . They depend only on the samples indexed by and never on .
The interval. Fix a level with . For any sample , the conformity score is
Let for . Their empirical CDF is
The correction term is the extended-real number
Since , we have . There are two cases:
- If , then is the -th smallest of the , counted with multiplicity.
- If , the set is empty and . This happens exactly when .
The prediction set at is
with the comparisons made in the extended reals. So when . may be empty when is negative enough. All of depend on through .
Claim. The probabilities below are the measure applied to the set of outcomes in question. Measurability of that set is not asserted, so acts as an outer measure if necessary. Both of the following hold:
- Lower bound (unconditional).
- Upper bound (conditional on a hypothesis). Suppose that, for -almost every , the numbers
are pairwise distinct. These are the scores of the calibration samples and the test sample, all computed with the same fitted . Under that hypothesis,
This bound exceeds , and is therefore automatic, whenever .
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.