Proposition 2: weighted conformal risk control under covariate shift
ProvedConformalRiskControl.weighted_risk_control_covariate_shiftLet and be probability measures on . Let be measurable with
(covariate shift). Let be nonempty and compact, and . Let be such that is measurable for every and is non-increasing and right-continuous for every . Assume that for -almost every , takes values in and . Let and be independent, and put . With the weighted parameter of Section 4.1,
This generalizes weighted conformal prediction (Tibshirani et al., 2019) to monotone risks. The weight may be unbounded.
Formalization Note The covariate shift is encoded as . The data are the product of copies of and one copy of . The ratio in is undefined only when all weights vanish, which happens with probability at .
import Mathlib import Definitions.Def_ConformalRiskControl_Basic open MeasureTheory ProbabilityTheory Filter
namespace ConformalRiskControl
theorem weighted_risk_control_covariate_shift {X Y : Type*} [MeasurableSpace X]
[MeasurableSpace Y] (Ptr Pte : Measure (X × Y)) [IsProbabilityMeasure Ptr]
[IsProbabilityMeasure Pte] (w : X → ℝ) (hw : Measurable w) (hw0 : ∀ x, 0 ≤ w x)
(hshift : Pte = Ptr.withDensity fun z => ENNReal.ofReal (w z.1))
(n : ℕ) (hn : 0 < n) (Λ : Set ℝ) (hΛ : IsCompact Λ) (hΛne : Λ.Nonempty) (B α : ℝ)
(hαB : α < B) (ℓ : X × Y → ℝ → ℝ) (hℓ : ∀ x ∈ Λ, Measurable fun z => ℓ z x)
(hanti : ∀ z, AntitoneOn (ℓ z) Λ) (hrc : ∀ z, IsRightContOn Λ (ℓ z))
(hbd : ∀ᵐ z ∂Ptr, LossBounds Λ B α (ℓ z) ∧ ∀ x ∈ Λ, 0 ≤ ℓ z x) :
upperExp ((Measure.pi fun _ : Fin n => Ptr).prod Pte) B
(fun D => ℓ D.2 (weightedLhat Λ B α w (fun i => ℓ (D.1 i)) (fun i => (D.1 i).1) D.2.1))
≤ (α : EReal) := by sorry
end ConformalRiskControlRead-back
What the Lean code literally says, in plain math · claude-opus-5-5
Let and be arbitrary measurable spaces. Let (training) and (test) be probability measures on .
Hypotheses on the weight. Let be measurable with for every . Assume has density with respect to :
Because both measures are probability measures, this forces .
Parameters.
- is an integer.
- is a nonempty compact set, and .
- satisfy .
Hypotheses on the loss. Let , written , satisfy:
- Measurability: for each , the map is measurable.
- Non-increasing, for every (not merely almost every ): if are both in , then .
- Right-continuous on , for every : at each , the restriction of to is continuous at .
- Bounds, for -almost every :
- for all ;
- .
These bounds are required only -almost surely. The bounds together imply . If , the hypotheses cannot be satisfied.
The weighted parameter. Given calibration points for and a test covariate , define
Division by zero is interpreted as . If all the weights are zero, the fraction equals . In that case when , and when .
Conclusion. Let be i.i.d. with law , and let be independent of them with law . The joint law is the product measure . Define
where is computed from . The theorem asserts, as an inequality in the extended reals :
About the expectation.
- The expectation takes values in . It is a lower Lebesgue integral, so no measurability of is assumed.
- The left-hand side therefore lies in .
- When almost surely, the left-hand side equals the ordinary expectation . In that case the inequality reads
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.