Documentation

Mathlib.Probability.Decision.BayesEstimator

Bayes estimator #

Let ฮ˜ be a parameter space, ๐“ง a data space, ๐“จ a prediction space, P : Kernel ฮ˜ ๐“ง a data generating kernel, ฯ€ a prior on the parameter space, and โ„“ : ฮ˜ โ†’ ๐“จ โ†’ โ„โ‰ฅ0โˆž a loss function.

An estimator (a Kernel ๐“ง ๐“จ) is said to be a Bayes estimator if it attains the Bayes risk for the estimation problem. It can be written as a measurable function x โ†ฆ argmin_y Pโ€ ฯ€(x)[ฮธ โ†ฆ โ„“ ฮธ y] for (P โˆ˜โ‚˜ ฯ€)-almost every x, where Pโ€ ฯ€ is the posterior kernel, whenever we can select the argmin in a measurable way.

Main definitions #

Main statements #

TODO #

Once Mathlib has measurable selection theorems, we will be able to prove HasArgminEstimator under general conditions on the measurable spaces ๐“ง and/or ๐“จ.

theorem ProbabilityTheory.avgRisk_eq_lintegral_posterior_prod {ฮ˜ : Type u_1} {๐“ง : Type u_2} {๐“จ : Type u_3} {mฮ˜ : MeasurableSpace ฮ˜} {m๐“ง : MeasurableSpace ๐“ง} {m๐“จ : MeasurableSpace ๐“จ} {โ„“ : ฮ˜ โ†’ ๐“จ โ†’ ENNReal} [StandardBorelSpace ฮ˜] [Nonempty ฮ˜] (hl : Measurable (Function.uncurry โ„“)) (P : Kernel ฮ˜ ๐“ง) [IsFiniteKernel P] (ฮบ : Kernel ๐“ง ๐“จ) [IsSFiniteKernel ฮบ] (ฯ€ : MeasureTheory.Measure ฮ˜) [MeasureTheory.IsFiniteMeasure ฯ€] :
avgRisk โ„“ P ฮบ ฯ€ = โˆซโป (ฮธy : ฮ˜ ร— ๐“จ), โ„“ ฮธy.1 ฮธy.2 โˆ‚(ฯ€.bind โ‡‘P).bind โ‡‘((posterior P ฯ€).prod ฮบ)

The average risk of an estimator ฮบ with respect to a prior ฯ€ can be expressed as an integral in the following way: R_ฯ€(ฮบ) = ((Pโ€ ฯ€ ร— ฮบ) โˆ˜ P โˆ˜ ฯ€)[(ฮธ, y) โ†ฆ โ„“ ฮธ y].

theorem ProbabilityTheory.avgRisk_eq_lintegral_lintegral_lintegral {ฮ˜ : Type u_1} {๐“ง : Type u_2} {๐“จ : Type u_3} {mฮ˜ : MeasurableSpace ฮ˜} {m๐“ง : MeasurableSpace ๐“ง} {m๐“จ : MeasurableSpace ๐“จ} {โ„“ : ฮ˜ โ†’ ๐“จ โ†’ ENNReal} [StandardBorelSpace ฮ˜] [Nonempty ฮ˜] (hl : Measurable (Function.uncurry โ„“)) (P : Kernel ฮ˜ ๐“ง) [IsFiniteKernel P] (ฮบ : Kernel ๐“ง ๐“จ) [IsSFiniteKernel ฮบ] (ฯ€ : MeasureTheory.Measure ฮ˜) [MeasureTheory.IsFiniteMeasure ฯ€] :
avgRisk โ„“ P ฮบ ฯ€ = โˆซโป (x : ๐“ง), โˆซโป (y : ๐“จ), โˆซโป (ฮธ : ฮ˜), โ„“ ฮธ y โˆ‚(posterior P ฯ€) x โˆ‚ฮบ x โˆ‚ฯ€.bind โ‡‘P
theorem ProbabilityTheory.lintegral_iInf_posterior_le_avgRisk {ฮ˜ : Type u_1} {๐“ง : Type u_2} {๐“จ : Type u_3} {mฮ˜ : MeasurableSpace ฮ˜} {m๐“ง : MeasurableSpace ๐“ง} {m๐“จ : MeasurableSpace ๐“จ} {โ„“ : ฮ˜ โ†’ ๐“จ โ†’ ENNReal} [StandardBorelSpace ฮ˜] [Nonempty ฮ˜] (hl : Measurable (Function.uncurry โ„“)) (P : Kernel ฮ˜ ๐“ง) [IsFiniteKernel P] (ฮบ : Kernel ๐“ง ๐“จ) [IsMarkovKernel ฮบ] (ฯ€ : MeasureTheory.Measure ฮ˜) [MeasureTheory.IsFiniteMeasure ฯ€] :
โˆซโป (x : ๐“ง), โจ… (y : ๐“จ), โˆซโป (ฮธ : ฮ˜), โ„“ ฮธ y โˆ‚(posterior P ฯ€) x โˆ‚ฯ€.bind โ‡‘P โ‰ค avgRisk โ„“ P ฮบ ฯ€
theorem ProbabilityTheory.lintegral_iInf_posterior_le_bayesRisk {ฮ˜ : Type u_1} {๐“ง : Type u_2} {๐“จ : Type u_3} {mฮ˜ : MeasurableSpace ฮ˜} {m๐“ง : MeasurableSpace ๐“ง} {m๐“จ : MeasurableSpace ๐“จ} {โ„“ : ฮ˜ โ†’ ๐“จ โ†’ ENNReal} [StandardBorelSpace ฮ˜] [Nonempty ฮ˜] (hl : Measurable (Function.uncurry โ„“)) (P : Kernel ฮ˜ ๐“ง) [IsFiniteKernel P] (ฯ€ : MeasureTheory.Measure ฮ˜) [MeasureTheory.IsFiniteMeasure ฯ€] :
โˆซโป (x : ๐“ง), โจ… (y : ๐“จ), โˆซโป (ฮธ : ฮ˜), โ„“ ฮธ y โˆ‚(posterior P ฯ€) x โˆ‚ฯ€.bind โ‡‘P โ‰ค bayesRisk โ„“ P ฯ€
def ProbabilityTheory.IsBayesEstimator {ฮ˜ : Type u_1} {๐“ง : Type u_2} {๐“จ : Type u_3} {mฮ˜ : MeasurableSpace ฮ˜} {m๐“ง : MeasurableSpace ๐“ง} {m๐“จ : MeasurableSpace ๐“จ} (โ„“ : ฮ˜ โ†’ ๐“จ โ†’ ENNReal) (P : Kernel ฮ˜ ๐“ง) (ฮบ : Kernel ๐“ง ๐“จ) (ฯ€ : MeasureTheory.Measure ฮ˜) :

An estimator is a Bayes estimator for a prior ฯ€ if it attains the Bayes risk for ฯ€.

Equations
Instances For
    structure ProbabilityTheory.IsArgminEstimator {ฮ˜ : Type u_1} {๐“ง : Type u_2} {mฮ˜ : MeasurableSpace ฮ˜} {m๐“ง : MeasurableSpace ๐“ง} [StandardBorelSpace ฮ˜] [Nonempty ฮ˜] {๐“จ : Type u_4} [MeasurableSpace ๐“จ] (โ„“ : ฮ˜ โ†’ ๐“จ โ†’ ENNReal) (P : Kernel ฮ˜ ๐“ง) [IsFiniteKernel P] (ฯ€ : MeasureTheory.Measure ฮ˜) [MeasureTheory.IsFiniteMeasure ฯ€] (f : ๐“ง โ†’ ๐“จ) :

    We say that a measurable function f : ๐“ง โ†’ ๐“จ is an argmin estimator with respect to the prior ฯ€ if for (P โˆ˜โ‚˜ ฯ€)-almost every x it is of the form x โ†ฆ argmin_y Pโ€ ฯ€(x)[ฮธ โ†ฆ โ„“ ฮธ y].

    Instances For
      @[reducible, inline]
      noncomputable abbrev ProbabilityTheory.IsArgminEstimator.kernel {ฮ˜ : Type u_1} {๐“ง : Type u_2} {๐“จ : Type u_3} {mฮ˜ : MeasurableSpace ฮ˜} {m๐“ง : MeasurableSpace ๐“ง} {m๐“จ : MeasurableSpace ๐“จ} {โ„“ : ฮ˜ โ†’ ๐“จ โ†’ ENNReal} {P : Kernel ฮ˜ ๐“ง} {ฯ€ : MeasureTheory.Measure ฮ˜} [StandardBorelSpace ฮ˜] [Nonempty ฮ˜] {f : ๐“ง โ†’ ๐“จ} [IsFiniteKernel P] [MeasureTheory.IsFiniteMeasure ฯ€] (h : IsArgminEstimator โ„“ P ฯ€ f) :
      Kernel ๐“ง ๐“จ

      Given an argmin estimator f, we can define a deterministic kernel.

      Equations
      Instances For
        theorem ProbabilityTheory.IsArgminEstimator.avgRisk_eq_lintegral_iInf {ฮ˜ : Type u_1} {๐“ง : Type u_2} {๐“จ : Type u_3} {mฮ˜ : MeasurableSpace ฮ˜} {m๐“ง : MeasurableSpace ๐“ง} {m๐“จ : MeasurableSpace ๐“จ} {โ„“ : ฮ˜ โ†’ ๐“จ โ†’ ENNReal} {P : Kernel ฮ˜ ๐“ง} {ฯ€ : MeasureTheory.Measure ฮ˜} [StandardBorelSpace ฮ˜] [Nonempty ฮ˜] {f : ๐“ง โ†’ ๐“จ} [IsFiniteKernel P] [MeasureTheory.IsFiniteMeasure ฯ€] (hf : IsArgminEstimator โ„“ P ฯ€ f) (hl : Measurable (Function.uncurry โ„“)) :
        avgRisk โ„“ P hf.kernel ฯ€ = โˆซโป (x : ๐“ง), โจ… (y : ๐“จ), โˆซโป (ฮธ : ฮ˜), โ„“ ฮธ y โˆ‚(posterior P ฯ€) x โˆ‚ฯ€.bind โ‡‘P

        The risk of an argmin estimator is the risk lower bound โˆซโป x, โจ… z, โˆซโป ฮธ, โ„“ ฮธ z โˆ‚(Pโ€ ฯ€) x โˆ‚(P โˆ˜โ‚˜ ฯ€).

        theorem ProbabilityTheory.IsArgminEstimator.isBayesEstimator {ฮ˜ : Type u_1} {๐“ง : Type u_2} {๐“จ : Type u_3} {mฮ˜ : MeasurableSpace ฮ˜} {m๐“ง : MeasurableSpace ๐“ง} {m๐“จ : MeasurableSpace ๐“จ} {โ„“ : ฮ˜ โ†’ ๐“จ โ†’ ENNReal} {P : Kernel ฮ˜ ๐“ง} {ฯ€ : MeasureTheory.Measure ฮ˜} [StandardBorelSpace ฮ˜] [Nonempty ฮ˜] {f : ๐“ง โ†’ ๐“จ} [IsFiniteKernel P] [MeasureTheory.IsFiniteMeasure ฯ€] (hf : IsArgminEstimator โ„“ P ฯ€ f) (hl : Measurable (Function.uncurry โ„“)) :
        IsBayesEstimator โ„“ P hf.kernel ฯ€

        An argmin estimator is a Bayes estimator: that is, it minimizes the Bayesian risk.

        structure ProbabilityTheory.HasArgminEstimator {ฮ˜ : Type u_1} {๐“ง : Type u_2} {mฮ˜ : MeasurableSpace ฮ˜} {m๐“ง : MeasurableSpace ๐“ง} [StandardBorelSpace ฮ˜] [Nonempty ฮ˜] {๐“จ : Type u_4} [MeasurableSpace ๐“จ] (โ„“ : ฮ˜ โ†’ ๐“จ โ†’ ENNReal) (P : Kernel ฮ˜ ๐“ง) [IsFiniteKernel P] (ฯ€ : MeasureTheory.Measure ฮ˜) [MeasureTheory.IsFiniteMeasure ฯ€] :

        The estimation problem admits an argmin estimator with respect to the prior ฯ€. That is, we can choose the argmin of the posterior expected loss in a measurable way.

        • exists_isArgminEstimator : โˆƒ (f : ๐“ง โ†’ ๐“จ), IsArgminEstimator โ„“ P ฯ€ f
        Instances For
          noncomputable def ProbabilityTheory.HasArgminEstimator.argminEstimator {ฮ˜ : Type u_1} {๐“ง : Type u_2} {๐“จ : Type u_3} {mฮ˜ : MeasurableSpace ฮ˜} {m๐“ง : MeasurableSpace ๐“ง} {m๐“จ : MeasurableSpace ๐“จ} {โ„“ : ฮ˜ โ†’ ๐“จ โ†’ ENNReal} {P : Kernel ฮ˜ ๐“ง} {ฯ€ : MeasureTheory.Measure ฮ˜} [StandardBorelSpace ฮ˜] [Nonempty ฮ˜] [IsFiniteKernel P] [MeasureTheory.IsFiniteMeasure ฯ€] (h : HasArgminEstimator โ„“ P ฯ€) :
          ๐“ง โ†’ ๐“จ

          An estimator for an estimation problem that for (P โˆ˜โ‚˜ ฯ€)-almost every x is of the form x โ†ฆ argmin_y Pโ€ ฯ€(x)[ฮธ โ†ฆ โ„“ ฮธ y].

          Equations
          Instances For
            theorem ProbabilityTheory.HasArgminEstimator.isArgminEstimator_argminEstimator {ฮ˜ : Type u_1} {๐“ง : Type u_2} {๐“จ : Type u_3} {mฮ˜ : MeasurableSpace ฮ˜} {m๐“ง : MeasurableSpace ๐“ง} {m๐“จ : MeasurableSpace ๐“จ} {โ„“ : ฮ˜ โ†’ ๐“จ โ†’ ENNReal} {P : Kernel ฮ˜ ๐“ง} {ฯ€ : MeasureTheory.Measure ฮ˜} [StandardBorelSpace ฮ˜] [Nonempty ฮ˜] [IsFiniteKernel P] [MeasureTheory.IsFiniteMeasure ฯ€] (h : HasArgminEstimator โ„“ P ฯ€) :
            theorem ProbabilityTheory.HasArgminEstimator.bayesRisk_eq {ฮ˜ : Type u_1} {๐“ง : Type u_2} {๐“จ : Type u_3} {mฮ˜ : MeasurableSpace ฮ˜} {m๐“ง : MeasurableSpace ๐“ง} {m๐“จ : MeasurableSpace ๐“จ} {โ„“ : ฮ˜ โ†’ ๐“จ โ†’ ENNReal} {P : Kernel ฮ˜ ๐“ง} {ฯ€ : MeasureTheory.Measure ฮ˜} [StandardBorelSpace ฮ˜] [Nonempty ฮ˜] [IsFiniteKernel P] [MeasureTheory.IsFiniteMeasure ฯ€] (hl : Measurable (Function.uncurry โ„“)) (h : HasArgminEstimator โ„“ P ฯ€) :
            bayesRisk โ„“ P ฯ€ = โˆซโป (x : ๐“ง), โจ… (y : ๐“จ), โˆซโป (ฮธ : ฮ˜), โ„“ ฮธ y โˆ‚(posterior P ฯ€) x โˆ‚ฯ€.bind โ‡‘P

            If the estimation problem admits an argmin estimator, then the Bayesian risk attains the risk lower bound โˆซโป x, โจ… y, โˆซโป ฮธ, โ„“ ฮธ y โˆ‚((Pโ€ ฯ€) x) โˆ‚(P โˆ˜โ‚˜ ฯ€).