Documentation

CslibFrontier.MachineLearning.PACBayes.Catoni

PAC-Bayes bounds for general measurable spaces: Catoni, Hoeffding, and Gibbs oracle bounds #

Extends CslibFrontier.MachineLearning.PACBayes.Basic on arbitrary measurable hypothesis spaces (Θ, mΘ) (including uncountable/continuous parameter spaces such as ℝᵈ with a Gaussian or uniform prior), assuming joint measurability Measurable (Function.uncurry ℓ) of the [0, 1]-bounded loss ℓ : Θ → Z → ℝ.

Using the Donsker–Varadhan change-of-measure inequality (CslibFrontier.Probability.ChangeOfMeasure), the shared Tonelli–Markov and joint-measurability helpers in CslibFrontier.MachineLearning.PACBayes.Basic, and Gibbs variational optimality (CslibFrontier.Probability.DonskerVaradhan), this module proves:

  1. Catoni's PAC-Bayes bound [Catoni2007, Theorem 1.2.6] (exact constant 1 — no log m or log (m + 1) slack!). For any scale c > 0, define the convex, strictly increasing potential catoniPhi c p = -log (1 - p * (1 - exp (-c))) / c on [0, 1] with inverse catoniInv c y = (1 - exp (-c * y)) / (1 - exp (-c)). With probability at least 1 - δ over S ~ D^m, every posterior Q with KL(Q ‖ P) < ∞ satisfies catoniPhi c (𝔼_Q L_D) ≤ 𝔼_Q L_S + (KL(Q ‖ P) + log (1 / δ)) / (c * m), equivalently 𝔼_Q L_D ≤ catoniInv c (𝔼_Q L_S + (KL(Q ‖ P) + log (1 / δ)) / (c * m)) and the linearized form 𝔼_Q L_D ≤ (c / (1 - exp (-c))) * 𝔼_Q L_S + (KL(Q ‖ P) + log (1 / δ)) / (m * (1 - exp (-c))).
  2. Realizable O(1 / m) fast-rate PAC-Bayes bound. With probability at least 1 - δ over S ~ D^m, every posterior Q with KL(Q ‖ P) < ∞ and zero empirical risk (∫ θ, L_S(θ) ∂Q = 0) satisfies 𝔼_Q L_D ≤ (KL(Q ‖ P) + log (1 / δ)) / m — without any log m factor.
  3. Linear PAC-Bayes–Hoeffding (PAC-Bayes-λ) bounds [Cat07] [Alquier2024, Theorem 2.1]. Upper and lower two-sided deviations for any inverse temperature lam > 0: 𝔼_Q L_D ≤ 𝔼_Q L_S + (KL(Q ‖ P) + log (1 / δ)) / lam + lam / (8 * m) (and reversed).
  4. Gibbs posterior excess-risk oracle inequalities [Alq24]. With probability at least 1 - δ, the Gibbs posterior Q̂ S = P.tilted (-lam * L_S) satisfies:
    • for any fixed comparator Q with KL(Q ‖ P) < ∞: 𝔼_{Q̂} L_D ≤ 𝔼_Q L_D + KL(Q ‖ P) / lam + lam / (4 * m) + 2 * log (2 / δ) / lam;
    • simultaneously for every (even data-dependent) Q with KL(Q ‖ P) < ∞: 𝔼_{Q̂} L_D ≤ 𝔼_Q L_D + 2 * KL(Q ‖ P) / lam + lam / (4 * m) + 2 * log (2 / δ) / lam.

(The general measurable McAllester log (√m / δ) bound measure_pi_exists_integral_risk_gt_of_measurable lives directly in CslibFrontier.MachineLearning.PACBayes.Basic.)

Differences from the sources: δ < 1 is not required; posteriors with klDiv Q P = ⊤ are excluded (for which the bounds are vacuous); losses are required to be jointly measurable in Θ × Z and valued in [0, 1].

Main definitions #

Main results #

References #

Exact section and page locators below are unverified against primary PDFs (pending an outside-fleet source check).

Catoni potential Φ_c and its inverse #

Catoni's log-Laplace potential Φ_c(p) = -log (1 - p * (1 - exp (-c))) / c for c > 0 and p ∈ [0, 1] [Cat07] (locator unverified).

Defining equation of catoniPhi.

Inverse of Catoni's potential: Φ_c⁻¹(y) = (1 - exp (-c * y)) / (1 - exp (-c)).

Defining equation of catoniInv.

theorem Cslib.MachineLearning.PACBayes.catoniPhi_le_self {c p : ℝ} (hc : 0 < c) (hp : p ∈ Set.Icc 0 1) :

catoniPhi c lies below the identity on [0, 1] (via convexity of exp).

theorem Cslib.MachineLearning.PACBayes.catoniInv_catoniPhi {c p : ℝ} (hc : 0 < c) (hp : p ∈ Set.Icc 0 1) :

Left inverse relation: catoniInv c (catoniPhi c p) = p for p ∈ [0, 1] and c > 0.

catoniInv c is strictly increasing for c > 0.

theorem Cslib.MachineLearning.PACBayes.catoniInv_le_linear {c : ℝ} (hc : 0 < c) (y : ℝ) :
catoniInv c y ≤ c * y / (1 - Real.exp (-c))

Linear upper bound: catoniInv c y ≤ c * y / (1 - exp (-c)) (since 1 - exp (-x) ≤ x).

catoniPhi c is convex on [0, 1] for c > 0, as the composition of -log / c with an affine map into (0, ∞).

Exponential moment bounds #

Catoni's PAC-Bayes theorem #

theorem Cslib.MachineLearning.PACBayes.measure_pi_exists_catoniPhi_integral_risk_gt {Θ : Type u_1} {Z : Type u_2} [MeasurableSpace Θ] [MeasurableSpace Z] {D : MeasureTheory.Measure Z} [MeasureTheory.IsProbabilityMeasure D] {ℓ : Θ → Z → ℝ} (hℓ : Measurable (Function.uncurry ℓ)) (hℓ01 : ∀ (θ : Θ) (z : Z), ℓ θ z ∈ Set.Icc 0 1) {m : ℕ} (hm : 0 < m) {c : ℝ} (hc : 0 < c) (P : MeasureTheory.Measure Θ) [MeasureTheory.IsProbabilityMeasure P] {δ : ℝ} (hδ : 0 < δ) :

Catoni's PAC-Bayes bound (Φ_c form) [Catoni2007, Theorem 1.2.6] (locator unverified): for any measurable hypothesis space Θ (countable or uncountable), jointly measurable loss ℓ : Θ → Z → ℝ valued in [0, 1], probability prior P on Θ, m ≥ 1, scale c > 0, and δ > 0, with probability at least 1 - δ over S ~ D^m, every probability posterior Q with KL(Q ‖ P) < ∞ satisfies catoniPhi c (𝔼_Q L_D) ≤ 𝔼_Q L_S + (KL(Q ‖ P) + log (1 / δ)) / (c * m).

theorem Cslib.MachineLearning.PACBayes.measure_pi_exists_catoni_integral_risk_gt {Θ : Type u_1} {Z : Type u_2} [MeasurableSpace Θ] [MeasurableSpace Z] {D : MeasureTheory.Measure Z} [MeasureTheory.IsProbabilityMeasure D] {ℓ : Θ → Z → ℝ} (hℓ : Measurable (Function.uncurry ℓ)) (hℓ01 : ∀ (θ : Θ) (z : Z), ℓ θ z ∈ Set.Icc 0 1) {m : ℕ} (hm : 0 < m) {c : ℝ} (hc : 0 < c) (P : MeasureTheory.Measure Θ) [MeasureTheory.IsProbabilityMeasure P] {δ : ℝ} (hδ : 0 < δ) :

Catoni's PAC-Bayes bound (inverted explicit risk bound) [Catoni2007, Theorem 1.2.6] (locator unverified): for any measurable hypothesis space Θ, scale c > 0, m ≥ 1, and δ > 0, with probability at least 1 - δ, every posterior Q with KL(Q ‖ P) < ∞ satisfies 𝔼_Q L_D ≤ catoniInv c (𝔼_Q L_S + (KL(Q ‖ P) + log (1 / δ)) / (c * m)).

theorem Cslib.MachineLearning.PACBayes.measure_pi_exists_catoni_linear_integral_risk_gt {Θ : Type u_1} {Z : Type u_2} [MeasurableSpace Θ] [MeasurableSpace Z] {D : MeasureTheory.Measure Z} [MeasureTheory.IsProbabilityMeasure D] {ℓ : Θ → Z → ℝ} (hℓ : Measurable (Function.uncurry ℓ)) (hℓ01 : ∀ (θ : Θ) (z : Z), ℓ θ z ∈ Set.Icc 0 1) {m : ℕ} (hm : 0 < m) {c : ℝ} (hc : 0 < c) (P : MeasureTheory.Measure Θ) [MeasureTheory.IsProbabilityMeasure P] {δ : ℝ} (hδ : 0 < δ) :
(MeasureTheory.Measure.pi fun (x : Fin m) => D) {S : Fin m → Z | ∃ (Q : MeasureTheory.Measure Θ), MeasureTheory.IsProbabilityMeasure Q ∧ InformationTheory.klDiv Q P ≠ ⊤ ∧ c / (1 - Real.exp (-c)) * ∫ (θ : Θ), empiricalRisk ℓ S θ ∂Q + ((InformationTheory.klDiv Q P).toReal + Real.log (1 / δ)) / (↑m * (1 - Real.exp (-c))) < ∫ (θ : Θ), trueRisk ℓ D θ ∂Q} ≤ ENNReal.ofReal δ

Linearized Catoni PAC-Bayes bound: replacing catoniInv c y by c * y / (1 - exp (-c)) yields 𝔼_Q L_D ≤ (c / (1 - exp (-c))) * 𝔼_Q L_S + (KL(Q ‖ P) + log (1 / δ)) / (m * (1 - exp (-c))).

theorem Cslib.MachineLearning.PACBayes.measure_pi_exists_realizable_integral_risk_gt {Θ : Type u_1} {Z : Type u_2} [MeasurableSpace Θ] [MeasurableSpace Z] {D : MeasureTheory.Measure Z} [MeasureTheory.IsProbabilityMeasure D] {ℓ : Θ → Z → ℝ} (hℓ : Measurable (Function.uncurry ℓ)) (hℓ01 : ∀ (θ : Θ) (z : Z), ℓ θ z ∈ Set.Icc 0 1) {m : ℕ} (hm : 0 < m) (P : MeasureTheory.Measure Θ) [MeasureTheory.IsProbabilityMeasure P] {δ : ℝ} (hδ : 0 < δ) :

Realizable fast-rate O(1 / m) PAC-Bayes bound (zero log m factor): on an arbitrary measurable hypothesis space Θ, with probability at least 1 - δ over S ~ D^m, every posterior Q with KL(Q ‖ P) < ∞ and zero empirical risk (∫ θ, L_S(θ) ∂Q = 0) satisfies 𝔼_Q L_D ≤ (KL(Q ‖ P) + log (1 / δ)) / m.

Linear PAC-Bayes–Hoeffding (PAC-Bayes-λ) and McAllester bounds #

theorem Cslib.MachineLearning.PACBayes.measure_pi_exists_hoeffding_integral_risk_gt {Θ : Type u_1} {Z : Type u_2} [MeasurableSpace Θ] [MeasurableSpace Z] {D : MeasureTheory.Measure Z} [MeasureTheory.IsProbabilityMeasure D] {ℓ : Θ → Z → ℝ} (hℓ : Measurable (Function.uncurry ℓ)) (hℓ01 : ∀ (θ : Θ) (z : Z), ℓ θ z ∈ Set.Icc 0 1) {m : ℕ} (hm : 0 < m) {lam : ℝ} (hlam : 0 < lam) (P : MeasureTheory.Measure Θ) [MeasureTheory.IsProbabilityMeasure P] {δ : ℝ} (hδ : 0 < δ) :
(MeasureTheory.Measure.pi fun (x : Fin m) => D) {S : Fin m → Z | ∃ (Q : MeasureTheory.Measure Θ), MeasureTheory.IsProbabilityMeasure Q ∧ InformationTheory.klDiv Q P ≠ ⊤ ∧ ∫ (θ : Θ), empiricalRisk ℓ S θ ∂Q + ((InformationTheory.klDiv Q P).toReal + Real.log (1 / δ)) / lam + lam / (8 * ↑m) < ∫ (θ : Θ), trueRisk ℓ D θ ∂Q} ≤ ENNReal.ofReal δ

Linear PAC-Bayes–Hoeffding bound (PAC-Bayes-λ, upper tail) [Cat07] [Alquier2024, Theorem 2.1] (locators unverified): for any measurable Θ, inverse temperature lam > 0, m ≥ 1, and δ > 0, with probability at least 1 - δ, every posterior Q with KL(Q ‖ P) < ∞ satisfies 𝔼_Q L_D ≤ 𝔼_Q L_S + (KL(Q ‖ P) + log (1 / δ)) / lam + lam / (8 * m).

theorem Cslib.MachineLearning.PACBayes.measure_pi_exists_hoeffding_integral_risk_lt {Θ : Type u_1} {Z : Type u_2} [MeasurableSpace Θ] [MeasurableSpace Z] {D : MeasureTheory.Measure Z} [MeasureTheory.IsProbabilityMeasure D] {ℓ : Θ → Z → ℝ} (hℓ : Measurable (Function.uncurry ℓ)) (hℓ01 : ∀ (θ : Θ) (z : Z), ℓ θ z ∈ Set.Icc 0 1) {m : ℕ} (hm : 0 < m) {lam : ℝ} (hlam : 0 < lam) (P : MeasureTheory.Measure Θ) [MeasureTheory.IsProbabilityMeasure P] {δ : ℝ} (hδ : 0 < δ) :
(MeasureTheory.Measure.pi fun (x : Fin m) => D) {S : Fin m → Z | ∃ (Q : MeasureTheory.Measure Θ), MeasureTheory.IsProbabilityMeasure Q ∧ InformationTheory.klDiv Q P ≠ ⊤ ∧ ∫ (θ : Θ), trueRisk ℓ D θ ∂Q + ((InformationTheory.klDiv Q P).toReal + Real.log (1 / δ)) / lam + lam / (8 * ↑m) < ∫ (θ : Θ), empiricalRisk ℓ S θ ∂Q} ≤ ENNReal.ofReal δ

Linear PAC-Bayes–Hoeffding bound (PAC-Bayes-λ, lower tail) [Cat07] [Alquier2024, Theorem 2.1] (locators unverified): with probability at least 1 - δ, every posterior Q with KL(Q ‖ P) < ∞ satisfies 𝔼_Q L_S ≤ 𝔼_Q L_D + (KL(Q ‖ P) + log (1 / δ)) / lam + lam / (8 * m).

Gibbs posterior excess-risk oracle inequalities #

theorem Cslib.MachineLearning.PACBayes.measure_pi_gibbs_oracle_gt {Θ : Type u_1} {Z : Type u_2} [MeasurableSpace Θ] [MeasurableSpace Z] {D : MeasureTheory.Measure Z} [MeasureTheory.IsProbabilityMeasure D] {ℓ : Θ → Z → ℝ} (hℓ : Measurable (Function.uncurry ℓ)) (hℓ01 : ∀ (θ : Θ) (z : Z), ℓ θ z ∈ Set.Icc 0 1) {m : ℕ} (hm : 0 < m) {lam : ℝ} (hlam : 0 < lam) (P : MeasureTheory.Measure Θ) [MeasureTheory.IsProbabilityMeasure P] {δ : ℝ} (hδ : 0 < δ) :
(MeasureTheory.Measure.pi fun (x : Fin m) => D) {S : Fin m → Z | ∃ (Q : MeasureTheory.Measure Θ), MeasureTheory.IsProbabilityMeasure Q ∧ InformationTheory.klDiv Q P ≠ ⊤ ∧ ∫ (θ : Θ), trueRisk ℓ D θ ∂Q + 2 * (InformationTheory.klDiv Q P).toReal / lam + lam / (4 * ↑m) + 2 * Real.log (2 / δ) / lam < ∫ (θ : Θ), trueRisk ℓ D θ ∂P.tilted fun (θ : Θ) => -lam * empiricalRisk ℓ S θ} ≤ ENNReal.ofReal δ

Uniform oracle inequality for the Gibbs posterior [Alq24] [Cat07] (locators unverified): letting Q̂ S := P.tilted (fun θ => -lam * empiricalRisk ℓ S θ), with probability at least 1 - δ over S ~ D^m, simultaneously for every comparator probability measure Q with KL(Q ‖ P) < ∞, 𝔼_{Q̂} L_D ≤ 𝔼_Q L_D + 2 * KL(Q ‖ P) / lam + lam / (4 * m) + 2 * log (2 / δ) / lam.

theorem Cslib.MachineLearning.PACBayes.measure_pi_gibbs_fixed_oracle_gt {Θ : Type u_1} {Z : Type u_2} [MeasurableSpace Θ] [MeasurableSpace Z] {D : MeasureTheory.Measure Z} [MeasureTheory.IsProbabilityMeasure D] {ℓ : Θ → Z → ℝ} (hℓ : Measurable (Function.uncurry ℓ)) (hℓ01 : ∀ (θ : Θ) (z : Z), ℓ θ z ∈ Set.Icc 0 1) {m : ℕ} (hm : 0 < m) {lam : ℝ} (hlam : 0 < lam) (P Q : MeasureTheory.Measure Θ) [MeasureTheory.IsProbabilityMeasure P] [MeasureTheory.IsProbabilityMeasure Q] (hQP : InformationTheory.klDiv Q P ≠ ⊤) {δ : ℝ} (hδ : 0 < δ) :
(MeasureTheory.Measure.pi fun (x : Fin m) => D) {S : Fin m → Z | ∫ (θ : Θ), trueRisk ℓ D θ ∂Q + (InformationTheory.klDiv Q P).toReal / lam + lam / (4 * ↑m) + 2 * Real.log (2 / δ) / lam < ∫ (θ : Θ), trueRisk ℓ D θ ∂P.tilted fun (θ : Θ) => -lam * empiricalRisk ℓ S θ} ≤ ENNReal.ofReal δ

Sharp oracle inequality for the Gibbs posterior against a fixed comparator Q [Alq24] (locator unverified): because Q is fixed before observing S, Hoeffding's lower tail applies with prior Q (KL(Q ‖ Q) = 0), reducing the factor on KL(Q ‖ P) from 2 to 1: 𝔼_{Q̂} L_D ≤ 𝔼_Q L_D + KL(Q ‖ P) / lam + lam / (4 * m) + 2 * log (2 / δ) / lam.