Documentation

CslibFrontier.MachineLearning.PACLearning.MDL

The minimum description length bound #

A prefix-free description of a class C assigns each hypothesis h ∈ C a binary word d h so that no description of a hypothesis of C is a prefix of the description of a different one [ShalevShwartzBenDavid2014, Section 7.3]. By Kraft's inequality [Kra49] [ShalevShwartzBenDavid2014, Lemma 7.6] the weights 2^-|d h| sum to at most 1, so they form a weighting of C, and the SRM bound for the singletons {h} with Hoeffding rates gives the minimum description length (MDL) bound [ShalevShwartzBenDavid2014, Theorem 7.7]: with probability at least 1 - δ, every h ∈ C has

L_D(h) ≤ L_S(h) + √((|d h| log 2 + log (2 / δ)) / (2 m)).

The source states the numerator as |h| + ln (2 / δ); the form here is sharper because log 2 < 1. Kraft's inequality for an arbitrary prefix-free set of words is Mathlib's InformationTheory.IsPrefixFree.tsum_one_div_card_pow_length_le_one; this library's Huffman development (CslibFrontier.Algorithms.Lean.Huffman.Kraft) adds the finite converse, which is not needed here. A class with a prefix-free description is countable, and the hypotheses need measurable misclassification sets; domain and labels are arbitrary measurable spaces.

Main definitions #

Main results #

References #

def Cslib.MachineLearning.PACLearning.IsPrefixFreeDescription {α : Type u_1} {β : Type u_2} (C : ConceptClass α β) (d : (α → β) → List Bool) :

d is a prefix-free description of the class C [ShalevShwartzBenDavid2014, Section 7.3]: whenever the description of h ∈ C is a prefix of the description of h' ∈ C, the two hypotheses are equal.

theorem Cslib.MachineLearning.PACLearning.IsPrefixFreeDescription.injOn {α : Type u_1} {β : Type u_2} {C : ConceptClass α β} {d : (α → β) → List Bool} (hd : IsPrefixFreeDescription C d) :

A prefix-free description is injective on the class.

The descriptions of a class form a prefix-free code.

A class with a prefix-free description is countable.

noncomputable def Cslib.MachineLearning.PACLearning.IsPrefixFreeDescription.weighting {α : Type u_1} {β : Type u_2} {C : ConceptClass α β} {d : (α → β) → List Bool} (hd : IsPrefixFreeDescription C d) :

The Kraft weighting h ↦ 2^-|d h| of a class with a prefix-free description: by Kraft's inequality [Kra49] the weights sum to at most 1.

@[simp]
theorem Cslib.MachineLearning.PACLearning.IsPrefixFreeDescription.weighting_apply {α : Type u_1} {β : Type u_2} {C : ConceptClass α β} {d : (α → β) → List Bool} (hd : IsPrefixFreeDescription C d) (h : ↑C) :
hd.weighting.toFun h = (1 / 2) ^ (d ↑h).length
theorem Cslib.MachineLearning.PACLearning.IsPrefixFreeDescription.measure_pi_exists_le_abs_sub_le {α : Type u_1} {β : Type u_2} {C : ConceptClass α β} {d : (α → β) → List Bool} [MeasurableSpace α] [MeasurableSpace β] [DecidableEq β] (hd : IsPrefixFreeDescription C d) (hmeas : ∀ h ∈ C, MeasurableSet {p : α × β | h p.1 ≠ p.2}) (D : MeasureTheory.Measure (α × β)) [MeasureTheory.IsProbabilityMeasure D] {m : ℕ} (hm : 0 < m) {δ : ℝ} (hδ : 0 < δ) :
(MeasureTheory.Measure.pi fun (x : Fin m) => D) {S : Fin m → α × β | ∃ h ∈ C, √((↑(d h).length * Real.log 2 + Real.log (2 / δ)) / (2 * ↑m)) < |↑(empiricalMiscount h S) / ↑m - (error D h).toReal|} ≤ ENNReal.ofReal δ

The MDL bound, two-sided form: for a class with a prefix-free description d whose hypotheses have measurable misclassification sets, with probability at least 1 - δ every h ∈ C has |L_S(h) - L_D(h)| ≤ √((|d h| log 2 + log (2 / δ)) / (2 m)).

theorem Cslib.MachineLearning.PACLearning.IsPrefixFreeDescription.mdl_bound {α : Type u_1} {β : Type u_2} {C : ConceptClass α β} {d : (α → β) → List Bool} [MeasurableSpace α] [MeasurableSpace β] [DecidableEq β] (hd : IsPrefixFreeDescription C d) (hmeas : ∀ h ∈ C, MeasurableSet {p : α × β | h p.1 ≠ p.2}) (D : MeasureTheory.Measure (α × β)) [MeasureTheory.IsProbabilityMeasure D] {m : ℕ} (hm : 0 < m) {δ : ℝ} (hδ : 0 < δ) :
(MeasureTheory.Measure.pi fun (x : Fin m) => D) {S : Fin m → α × β | ∃ h ∈ C, ↑(empiricalMiscount h S) / ↑m + √((↑(d h).length * Real.log 2 + Real.log (2 / δ)) / (2 * ↑m)) < (error D h).toReal} ≤ ENNReal.ofReal δ

The MDL bound [ShalevShwartzBenDavid2014, Theorem 7.7]: for a class with a prefix-free description d whose hypotheses have measurable misclassification sets, with probability at least 1 - δ every h ∈ C has L_D(h) ≤ L_S(h) + √((|d h| log 2 + log (2 / δ)) / (2 m)).