ML.Surrogate
Surrogate-loss learning: generic convex empirical risk minimization with proper binary losses — losses whose conditional risk is minimized at the true probability — and their Fisher consistency (the population-risk minimizer recovers E[Y∣X]).
ClampedSquare 3 core · 3 supporting The clamped square is a globally Lipschitz surrogate for the squared map on a bounded prediction range. ★ clampedSq★ clampedSq_eq_sq★ lipschitzAt0_clampedSq
Clamped square surrogate for squared-loss contraction bounds
The clamped square is a globally Lipschitz surrogate for the squared map on a
bounded prediction range. The basic loss squaredLoss lives in
ML/Core/Losses; this separate surrogate file imports the Rademacher
contraction interface and proves the analytic facts needed for squared-loss
complexity bounds. The clipping itself is Causalean.Mathlib.Analysis.clipIcc
(see Mathlib/Analysis/ClipInterval), whose contraction and boundedness lemmas
are reused here.
On the band [-c, c], clampedSq c t agrees with t²; globally, it is
2c-Lipschitz and fixes zero. This is the standard route for applying a
Ledoux-Talagrand contraction bound to bounded squared-loss classes.
clampedSq_eq_sq—clampedSq c t = t²whenever|t| ≤ c;lipschitzAt0_clampedSq—clampedSq cisLipschitzAt0with constant2cforc ≥ 0.
The clamped-square surrogate controls squared loss globally by clipping to a symmetric interval and squaring. It uses a real clipping bound and real input, even when the nominal lower and upper endpoints are not ordered.
Definition (Lean source)
Clamped square agrees with ordinary square throughout the unclipped input band.
Formal statement
Proof (Lean source)
Clamped square fixes zero and is globally twice-bound Lipschitz when the clipping bound is nonnegative.
Formal statement
Proof (Lean source)
3 supporting declarations (lemmas, instances)
-
continuous_clampedSqlemma — The clamped square is continuous.Proof (Lean source)
@[fun_prop] lemma continuous_clampedSq (c : ℝ) : Continuous (clampedSq c) := (continuous_clipIcc _ _).pow 2 -
clampedSq_nonneglemma — The clamped square is nonnegative.Proof (Lean source)
-
clampedSq_le_sqlemma — Clamped square never exceeds the squared clipping bound for any real input when the clipping bound is nonnegative.Proof (Lean source)
lemma clampedSq_le_sq {c : ℝ} (hc : 0 ≤ c) (t : ℝ) : clampedSq c t ≤ c ^ 2 := by have h := abs_clipIcc_neg_le hc t calc clampedSq c t = |clipIcc (-c) c t| ^ 2 := by rw [clampedSq, sq_abs] _ ≤ c ^ 2 := by gcongr
ProperLoss 3 core · 1 supporting This file defines ProperBinaryLoss and StrictProperBinaryLoss for losses L q b, where q is a predicted probability and b is a binary label. ★ ProperBinaryLoss★ properLoss_population_minimizer_recovers_eta
Proper binary losses and population risk
This file defines ProperBinaryLoss and StrictProperBinaryLoss for losses
L q b, where q is a predicted probability and b is a binary label. A
proper loss is minimized pointwise at the true probability η; a strictly proper
loss has η as its unique [0,1] minimizer.
The theorem properLoss_population_risk_le integrates the pointwise proper-loss
inequality, showing that predicting η has no larger conditional-risk integral
than any measurable [0,1]-valued comparator. The theorem
properLoss_population_minimizer_recovers_eta proves the corresponding
identification statement for strictly proper losses: any population minimizer
equals the true conditional probability almost everywhere.
Gneiting--Raftery (2007), equation (1), uses the opposite convention of scores that
are maximized; the definitions here reorient those scores as losses to minimize.
Proper and strictly proper binary losses follow Reid--Williamson (2010), Section 3.1.
Log loss requires the conditional probability to lie in the open interval (0,1) when finite
real-valued risk, rather than an extended endpoint convention, is needed.
A proper binary loss makes truthful probability reports optimal: truth weakly minimizes conditional risk on the unit interval. The criterion applies to a real-valued binary probability loss.
A strictly proper binary loss makes truthful probability reporting uniquely optimal: the loss is proper, and equal conditional risk forces truth. It applies to a real-valued binary probability loss.
Strictly proper population minimizers recover the regression function. For a strictly proper binary loss under a population law, suppose the true conditional probability is measurable, [0,1]-valued almost everywhere, and has integrable conditional risk, while the candidate is measurable, [0,1]-valued almost everywhere, and has integrable risk. If the candidate minimizes over admissible competitors, then it equals the truth almost everywhere.
Formal statement
Proof (Lean source)
1 supporting declaration (lemmas, instances)
-
properLoss_population_risk_letheorem — Proper-loss integrated risk inequality. For a proper binary loss under a population law, let the true conditional probability and a comparator be [0,1]-valued almost everywhere, with integrable truthful and comparator conditional risks. Then truthful prediction has no larger integrated risk than the comparator.hypothesesProof (Lean source)
theorem properLoss_population_risk_le {L : ℝ → Bool → ℝ} (hproper : ProperBinaryLoss L) {PX : Measure X} (η : X → ℝ) (hη : ∀ᵐ x ∂PX, η x ∈ Icc (0 : ℝ) 1) (q : X → ℝ) (hq : ∀ᵐ x ∂PX, q x ∈ Icc (0 : ℝ) 1) (hint_η : Integrable (fun x => η x * L (η x) true + (1 - η x) * L (η x) false) PX) (hint_q : Integrable (fun x => η x * L (q x) true + (1 - η x) * L (q x) false) PX) : ∫ x, (η x * L (η x) true + (1 - η x) * L (η x) false) ∂PX ≤ ∫ x, (η x * L (q x) true + (1 - η x) * L (q x) false) ∂PX := by exact integral_mono_ae hint_η hint_q <| by filter_upwards [hη, hq] with x hηx hqx exact (hproper (η x) hηx) hqx