Quelle Basic.lean
Sprache: Lean
|
|
/-
Copyright (c) 2025 Rémy Degenne. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Rémy Degenne, Lorenzo Luccioli
-/
module
public import Mathlib.Probability.Decision.Risk.Defs
public import Mathlib.Probability.Kernel.Composition.MeasureComp
/-!
# Basic properties of the risk of an estimator
## Main statements
* `iSup_bayesRisk_le_minimaxRisk`: the maximal Bayes risk is less than or equal to the minimax risk.
* `bayesRisk_le_bayesRisk_comp`: data-processing inequality for the Bayes risk with respect to a
prior: if we compose the data generating kernel `P` with a Markov kernel, then the Bayes risk
increases.
* `minimaxRisk_le_minimaxRisk_comp`, `minimaxRisk_le_minimaxRisk_map`,
`minimaxRisk_compProd_le_minimaxRisk`: analogous data-processing inequalities for the minimax
risk.
* `bayesRisk_le_iInf`: for `P` a Markov kernel, the Bayes risk is less than `⨅ y, ∫⁻ θ, ℓ θ y ∂π`.
In several cases, there is no information in the data about the parameter and the Bayes risk takes
its maximal value.
* `bayesRisk_const`: if the data generating kernel is constant, then the Bayes risk is equal to
`⨅ y, ∫⁻ θ, ℓ θ y ∂π`.
* `bayesRisk_of_subsingleton`: if the observation space is a subsingleton, then the Bayes risk is
equal to `⨅ y, ∫⁻ θ, ℓ θ y ∂π`.
## TODO
In many cases, the maximal Bayes risk and the minimax risk are equal
(by a so-called minimax theorem).
-/
public section
open MeasureTheory Function
open scoped ENNReal NNReal
namespace ProbabilityTheory
variable {Θ ' : Type*} {mΘ : MeasurableSpace Θ}
{m : MeasurableSpace } {m' : MeasurableSpace '} {m : MeasurableSpace }
{ℓ : Θ → → ℝ≥0∞} {P : Kernel Θ } {κ : Kernel } {π : Measure Θ}
section BayesRiskLeMinimaxRisk
lemma avgRisk_le_iSup_risk (ℓ : Θ → → ℝ≥0∞) (P : Kernel Θ ) (κ : Kernel )
(π : Measure Θ) [IsProbabilityMeasure π] :
avgRisk ℓ P κ π ≤ ⨆ θ, ∫⁻ y, ℓ θ y ∂((κ ∘ₖ P) θ) := lintegral_le_iSup _
lemma bayesRisk_le_avgRisk (ℓ : Θ → → ℝ≥0∞) (P : Kernel Θ ) (κ : Kernel )
(π : Measure Θ) [hκ : IsMarkovKernel κ] :
bayesRisk ℓ P π ≤ avgRisk ℓ P κ π := iInf₂_le κ hκ
lemma bayesRisk_le_minimaxRisk (ℓ : Θ → → ℝ≥0∞) (P : Kernel Θ )
(π : Measure Θ) [IsProbabilityMeasure π] :
bayesRisk ℓ P π ≤ minimaxRisk ℓ P := iInf₂_mono fun _ _ ↦ avgRisk_le_iSup_risk _ _ _ _
/-- The maximal Bayes risk is less than or equal to the minimax risk. -/
lemma iSup_bayesRisk_le_minimaxRisk (ℓ : Θ → → ℝ≥0∞) (P : Kernel Θ ) :
⨆ (π : Measure Θ) (_ : IsProbabilityMeasure π), bayesRisk ℓ P π
≤ minimaxRisk ℓ P := iSup₂_le fun _ _ ↦ bayesRisk_le_minimaxRisk _ _ _
end BayesRiskLeMinimaxRisk
section Const
/-- See `avgRisk_const_left'` for a similar result with integrals swapped. -/
lemma avgRisk_const_left (ℓ : Θ → → ℝ≥0∞) (μ : Measure ) (κ : Kernel ) (π : Measure Θ) :
avgRisk ℓ (Kernel.const Θ μ) κ π = ∫⁻ θ, ∫⁻ y, ℓ θ y ∂(κ ∘ₘ μ) ∂π := by
simp [avgRisk]
/-- See `avgRisk_const_left` for a similar result with integrals swapped. -/
lemma avgRisk_const_left' (hl : Measurable (uncurry ℓ)) (μ : Measure ) [SFinite μ]
(κ : Kernel ) [IsSFiniteKernel κ] (π : Measure Θ) [SFinite π] :
avgRisk ℓ (Kernel.const Θ μ) κ π = ∫⁻ y, ∫⁻ θ, ℓ θ y ∂π ∂(κ ∘ₘ μ) := by
rw [avgRisk_const_left, lintegral_lintegral_swap (by fun_prop)]
/-- See `avgRisk_const_right` for a simpler result when `P` is a Markov kernel. -/
lemma avgRisk_const_right' (ℓ : Θ → → ℝ≥0∞) (P : Kernel Θ ) (ν : Measure ) (π : Measure Θ) :
avgRisk ℓ P (Kernel.const ν) π = ∫⁻ θ, P θ .univ * ∫⁻ y, ℓ θ y ∂ν ∂π := by
simp [avgRisk, Kernel.const_comp]
/-- See `avgRisk_const_right'` for a similar result when `P` is not a Markov kernel. -/
lemma avgRisk_const_right (ℓ : Θ → → ℝ≥0∞) (P : Kernel Θ ) [IsMarkovKernel P]
(ν : Measure ) (π : Measure Θ) :
avgRisk ℓ P (Kernel.const ν) π = ∫⁻ θ, ∫⁻ y, ℓ θ y ∂ν ∂π := by
simp [avgRisk_const_right']
/-- See `bayesRisk_le_iInf` for a simpler result when `P` is a Markov kernel. -/
lemma bayesRisk_le_iInf' (hl : Measurable (uncurry ℓ)) (P : Kernel Θ ) (π : Measure Θ) :
bayesRisk ℓ P π ≤ ⨅ y, ∫⁻ θ, ℓ θ y * P θ .univ ∂π := by
simp_rw [le_iInf_iff, bayesRisk]
refine fun y ↦ iInf_le_of_le (Kernel.const _ (Measure.dirac y)) ?_
simp only [iInf_pos, avgRisk_const_right', mul_comm]
gcongr with θ
rw [lintegral_dirac' _ (by fun_prop)]
/-- See `bayesRisk_le_iInf'` for a similar result when `P` is not a Markov kernel. -/
lemma bayesRisk_le_iInf (hl : Measurable (uncurry ℓ)) (P : Kernel Θ ) [IsMarkovKernel P]
(π : Measure Θ) :
bayesRisk ℓ P π ≤ ⨅ y, ∫⁻ θ, ℓ θ y ∂π :=
(bayesRisk_le_iInf' hl P π).trans_eq (by simp)
lemma bayesRisk_const' (hl : Measurable (uncurry ℓ))
(μ : Measure ) [SFinite μ] (π : Measure Θ) [SFinite π]
(hl_pos : μ .univ = ∞ → ⨅ y, ∫⁻ θ, ℓ θ y ∂π = 0 → ∃ y, ∫⁻ θ, ℓ θ y ∂π = 0)
(h_zero : μ = 0 → Nonempty ) :
bayesRisk ℓ (Kernel.const Θ μ) π = ⨅ y, ∫⁻ θ, ℓ θ y * μ .univ ∂π := by
refine le_antisymm ((bayesRisk_le_iInf' hl _ _).trans_eq (by simp)) ?_
simp_rw [bayesRisk, le_iInf_iff]
intro κ hκ
rw [avgRisk_const_left' hl]
refine le_trans ?_ (iInf_mul_le_lintegral (fun y ↦ ∫⁻ θ, ℓ θ y ∂π))
rw [Measure.comp_apply_univ, ENNReal.iInf_mul' hl_pos (fun hμ ↦ h_zero (by simpa using hμ))]
gcongr with y
rw [lintegral_mul_const]
fun_prop
lemma bayesRisk_const_of_neZero (hl : Measurable (uncurry ℓ))
(μ : Measure ) [NeZero μ] [IsFiniteMeasure μ] (π : Measure Θ) [SFinite π] :
bayesRisk ℓ (Kernel.const Θ μ) π = ⨅ y, ∫⁻ θ, ℓ θ y * μ .univ ∂π :=
bayesRisk_const' hl μ π (by simp) (by simp [NeZero.out])
lemma bayesRisk_const_of_nonempty [Nonempty ] (hl : Measurable (uncurry ℓ))
(μ : Measure ) [IsFiniteMeasure μ] (π : Measure Θ) [SFinite π] :
bayesRisk ℓ (Kernel.const Θ μ) π = ⨅ y, ∫⁻ θ, ℓ θ y * μ .univ ∂π :=
bayesRisk_const' hl μ π (by simp) (fun _ ↦ inferInstance)
lemma bayesRisk_const (hl : Measurable (uncurry ℓ))
(μ : Measure ) [IsProbabilityMeasure μ] (π : Measure Θ) [SFinite π] :
bayesRisk ℓ (Kernel.const Θ μ) π = ⨅ y, ∫⁻ θ, ℓ θ y ∂π := by
simp [bayesRisk_const_of_neZero hl μ π]
end Const
section Bounds
/-- See `avgRisk_le_mul` for the usual case in which `π` is a probability measure and the kernels
are Markov. -/
lemma avgRisk_le_mul' (P : Kernel Θ ) (κ : Kernel ) (π : Measure Θ)
{C : ℝ≥0} (hℓC : ∀ θ y, ℓ θ y ≤ C) :
avgRisk ℓ P κ π ≤ C * κ.bound * P.bound * π Set.univ :=
calc ∫⁻ θ, ∫⁻ y, ℓ θ y ∂(κ ∘ₖ P) θ ∂π
_ ≤ ∫⁻ θ, ∫⁻ y, C ∂(κ ∘ₖ P) θ ∂π := by gcongr with θ y; exact hℓC θ y
_ = ∫⁻ θ, C * ∫⁻ x, κ x .univ ∂P θ ∂π := by simp [Kernel.comp_apply' _ _ _ .univ]
_ ≤ ∫⁻ θ, C * ∫⁻ x, κ.bound ∂P θ ∂π := by
gcongr with θ x
exact Kernel.measure_le_bound κ x Set.univ
_ ≤ ∫⁻ θ, C * κ.bound * P.bound ∂π := by
conv_lhs => simp only [lintegral_const, ← mul_assoc]
gcongr with θ
exact Kernel.measure_le_bound P θ Set.univ
_ = C * κ.bound * P.bound * π Set.univ := by simp
lemma avgRisk_le_mul (P : Kernel Θ ) [IsMarkovKernel P] (κ : Kernel ) [IsMarkovKernel κ]
(π : Measure Θ) [IsProbabilityMeasure π] {C : ℝ≥0} (hℓC : ∀ θ y, ℓ θ y ≤ C) :
avgRisk ℓ P κ π ≤ C := by
refine (avgRisk_le_mul' P κ π hℓC).trans ?_
rcases isEmpty_or_nonempty Θ
· simp
· rcases isEmpty_or_nonempty <;> simp
/-- For a bounded loss, the Bayes risk with respect to a prior is bounded by a constant.
See `bayesRisk_le_mul` for the usual cases where all measures are probability measures. -/
lemma bayesRisk_le_mul' [h : Nonempty ] (P : Kernel Θ ) (π : Measure Θ)
{C : ℝ≥0} (hℓC : ∀ θ y, ℓ θ y ≤ C) :
bayesRisk ℓ P π ≤ C * P.bound * π Set.univ := by
refine (bayesRisk_le_avgRisk ℓ P (Kernel.const (Measure.dirac h.some)) π).trans ?_
refine (avgRisk_le_mul' P (Kernel.const (Measure.dirac h.some)) π hℓC).trans ?_
rcases isEmpty_or_nonempty <;> simp
/-- For a bounded loss, the Bayes risk with respect to a prior is bounded by a constant. -/
lemma bayesRisk_le_mul [Nonempty ] (P : Kernel Θ ) [IsMarkovKernel P]
(π : Measure Θ) [IsProbabilityMeasure π] {C : ℝ≥0} (hℓC : ∀ θ y, ℓ θ y ≤ C) :
bayesRisk ℓ P π ≤ C := by
refine (bayesRisk_le_mul' P π hℓC).trans ?_
rcases isEmpty_or_nonempty Θ <;> simp
/-- For a bounded loss, the Bayes risk with respect to a prior is finite. -/
lemma bayesRisk_lt_top [Nonempty ] (P : Kernel Θ )
[IsFiniteKernel P] (π : Measure Θ) [IsFiniteMeasure π] {C : ℝ≥0} (hℓC : ∀ θ y, ℓ θ y ≤ C) :
bayesRisk ℓ P π < ∞ := by
refine (bayesRisk_le_mul' P π hℓC).trans_lt ?_
simp [ENNReal.mul_lt_top_iff, P.bound_lt_top]
end Bounds
lemma bayesRisk_discard (hl : Measurable (uncurry ℓ)) (π : Measure Θ) [SFinite π] :
bayesRisk ℓ (Kernel.discard Θ) π = ⨅ y, ∫⁻ θ, ℓ θ y ∂π := by
rw [Kernel.discard_eq_const, bayesRisk_const hl]
section Subsingleton
variable [Subsingleton ] [Nonempty ]
lemma bayesRisk_eq_iInf_measure_of_subsingleton :
bayesRisk ℓ P π
= ⨅ (μ : Measure ) (_ : IsProbabilityMeasure μ), avgRisk ℓ P (Kernel.const μ) π := by
rcases isEmpty_or_nonempty with hX | hX
· simp [iInf_subtype']
obtain x := hX.some
rw [bayesRisk, iInf_subtype', iInf_subtype']
let e : {κ : Kernel // IsMarkovKernel κ} ≃ {μ : Measure // IsProbabilityMeasure μ} :=
{ toFun κ := ⟨κ.1 x, κ.2.isProbabilityMeasure x⟩
invFun μ := ⟨Kernel.const μ, ⟨fun _ ↦ μ.2⟩⟩
left_inv κ := by ext y; simp only [Kernel.const_apply, Subsingleton.elim x y]
right_inv μ := by simp }
rw [← Equiv.iInf_comp e.symm]
rfl
lemma bayesRisk_of_subsingleton' [SFinite π] (hl : Measurable (uncurry ℓ)) :
bayesRisk ℓ P π = ⨅ y, ∫⁻ θ, ℓ θ y * P θ .univ ∂π := by
refine le_antisymm (bayesRisk_le_iInf' hl _ _) ?_
rw [bayesRisk_eq_iInf_measure_of_subsingleton]
simp only [avgRisk_const_right', le_iInf_iff]
refine fun μ hμ ↦ (iInf_le_lintegral (μ := μ) _).trans_eq ?_
rw [lintegral_lintegral_swap]
· congr with θ
rw [lintegral_mul_const _ (by fun_prop), mul_comm]
· have := P.measurable_coe .univ
fun_prop
lemma bayesRisk_of_subsingleton [IsMarkovKernel P] [SFinite π] (hl : Measurable (uncurry ℓ)) :
bayesRisk ℓ P π = ⨅ y, ∫⁻ θ, ℓ θ y ∂π := by
simp [bayesRisk_of_subsingleton' hl]
end Subsingleton
section Compositions
/-- **Data processing inequality** for the Bayes risk with respect to a prior: composition of the
data generating kernel by a Markov kernel increases the risk. -/
lemma bayesRisk_le_bayesRisk_comp (ℓ : Θ → → ℝ≥0∞) (P : Kernel Θ )
(π : Measure Θ) (η : Kernel ') [IsMarkovKernel η] :
bayesRisk ℓ P π ≤ bayesRisk ℓ (η ∘ₖ P) π := by
simp only [bayesRisk, avgRisk, le_iInf_iff]
intro κ hκ
rw [← κ.comp_assoc η]
exact iInf_le_of_le (κ ∘ₖ η) (iInf_le_of_le inferInstance le_rfl)
/-- **Data processing inequality** for the Bayes risk with respect to a prior: taking the map of
the data generating kernel by a function increases the risk. -/
lemma bayesRisk_le_bayesRisk_map (ℓ : Θ → → ℝ≥0∞) (P : Kernel Θ )
(π : Measure Θ) {f : → '} (hf : Measurable f) :
bayesRisk ℓ P π ≤ bayesRisk ℓ (P.map f) π := by
rw [← Kernel.deterministic_comp_eq_map hf]
exact bayesRisk_le_bayesRisk_comp _ _ _ _
lemma bayesRisk_compProd_le_bayesRisk (ℓ : Θ → → ℝ≥0∞) (P : Kernel Θ )
[IsSFiniteKernel P] (π : Measure Θ) (η : Kernel (Θ × ) ') [IsMarkovKernel η] :
bayesRisk ℓ (P ⊗ₖ η) π ≤ bayesRisk ℓ P π := by
have : P = (Kernel.deterministic Prod.fst (by fun_prop)) ∘ₖ (P ⊗ₖ η) := by
rw [Kernel.deterministic_comp_eq_map, ← Kernel.fst_eq, Kernel.fst_compProd]
nth_rw 2 [this]
exact bayesRisk_le_bayesRisk_comp _ _ _ _
/-- **Data processing inequality** for the minimax risk: composition of the data generating
kernel by a Markov kernel increases the risk. -/
lemma minimaxRisk_le_minimaxRisk_comp (ℓ : Θ → → ℝ≥0∞) (P : Kernel Θ )
(η : Kernel ') [IsMarkovKernel η] :
minimaxRisk ℓ P ≤ minimaxRisk ℓ (η ∘ₖ P) := by
simp only [minimaxRisk, le_iInf_iff]
intro κ hκ
rw [← κ.comp_assoc η]
exact iInf_le_of_le (κ ∘ₖ η) (iInf_le_of_le inferInstance le_rfl)
/-- **Data processing inequality** for the minimax risk: taking the map of the data generating
kernel by a function increases the risk. -/
lemma minimaxRisk_le_minimaxRisk_map (ℓ : Θ → → ℝ≥0∞) (P : Kernel Θ )
{f : → '} (hf : Measurable f) :
minimaxRisk ℓ P ≤ minimaxRisk ℓ (P.map f) := by
rw [← Kernel.deterministic_comp_eq_map hf]
exact minimaxRisk_le_minimaxRisk_comp _ _ _
/-- Observing richer data cannot increase the minimax risk: the enriched experiment `P ⊗ₖ η` has
minimax risk at most that of `P`. -/
lemma minimaxRisk_compProd_le_minimaxRisk (ℓ : Θ → → ℝ≥0∞) (P : Kernel Θ )
[IsSFiniteKernel P] (η : Kernel (Θ × ) ') [IsMarkovKernel η] :
minimaxRisk ℓ (P ⊗ₖ η) ≤ minimaxRisk ℓ P := by
have : P = (Kernel.deterministic Prod.fst (by fun_prop)) ∘ₖ (P ⊗ₖ η) := by
rw [Kernel.deterministic_comp_eq_map, ← Kernel.fst_eq, Kernel.fst_compProd]
nth_rw 2 [this]
exact minimaxRisk_le_minimaxRisk_comp _ _ _
end Compositions
end ProbabilityTheory
¤ Dauer der Verarbeitung: 0.2 Sekunden
(vorverarbeitet am 2026-11-24)
¤
*© Formatika GbR, Deutschland
|
|
2026-11-24
|