Documentation

CslibFrontier.Probability.Product.Estimator

The product estimator #

A product ∏ k, r k of numbers in (0, 1] can be estimated one factor at a time when each factor is close to the probability of an event A k under a distribution μ k that can be sampled. Draw a independent samples from each μ k, take the fraction of them that lie in A k (Cslib.Probability.PMF.empiricalFrequency), and multiply these fractions over the stages (Cslib.Probability.PMF.productEstimate). This is how [LP17], Section 14.4.2, reduces approximate counting of colorings to sampling.

The stages are independent, so the mean and the second moment of the product are the products of the stage means and second moments (Cslib.Probability.PMF.sum_pi_mul_prod). The fraction of a samples in an event of probability p has mean p and second moment p² + p (1 - p) / a. If every r k is at least b > 0 and a is large compared with n / b, where n is the number of stages, the relative variance of the product is small, and Chebyshev's inequality gives the concentration bound Cslib.Probability.PMF.le_toOuterMeasure_productEstimate.

Main definitions #

Main results #

References #

theorem Cslib.Probability.PMF.sum_pi_mul_prod {ι : Type u_1} [Fintype ι] [DecidableEq ι] {α : ι → Type u_2} [(i : ι) → Fintype (α i)] (p : (i : ι) → PMF (α i)) (f : (i : ι) → α i → ℝ) :
∑ x : (i : ι) → α i, ((pi p) x).toReal * ∏ i : ι, f i (x i) = ∏ i : ι, ∑ a : α i, ((p i) a).toReal * f i a

The mean of a product of coordinate functions under the independent product pi p is the product of their means.

theorem Cslib.Probability.PMF.sum_pi_mul_sum_sq {ι : Type u_1} {S : Type u_2} [Fintype ι] [DecidableEq ι] [Fintype S] (μ : PMF S) (g : S → ℝ) :
∑ x : ι → S, ((pi fun (x : ι) => μ) x).toReal * (∑ i : ι, g (x i)) ^ 2 = ↑(Fintype.card ι) * ∑ a : S, (μ a).toReal * g a ^ 2 + ↑(Fintype.card ι) * (↑(Fintype.card ι) - 1) * (∑ a : S, (μ a).toReal * g a) ^ 2

The second moment of a sum of |ι| i.i.d. copies of g: |ι| E[g²] + |ι| (|ι| - 1) (E g)².

noncomputable def Cslib.Probability.PMF.empiricalFrequency {S : Type u_1} {a : ℕ} (A : Set S) [DecidablePred fun (x : S) => x ∈ A] (x : Fin a → S) :

The fraction of the samples x 0, …, x (a - 1) that lie in A (0 when a = 0).

theorem Cslib.Probability.PMF.empiricalFrequency_eq {S : Type u_1} {a : ℕ} (A : Set S) [DecidablePred fun (x : S) => x ∈ A] (x : Fin a → S) :
empiricalFrequency A x = (∑ j : Fin a, if x j ∈ A then 1 else 0) / ↑a

The empirical frequency as an average of indicators.

theorem Cslib.Probability.PMF.sum_pi_mul_empiricalFrequency {S : Type u_1} [Fintype S] (μ : PMF S) (A : Set S) [DecidablePred fun (x : S) => x ∈ A] {a : ℕ} (ha : 0 < a) :
∑ x : Fin a → S, ((pi fun (x : Fin a) => μ) x).toReal * empiricalFrequency A x = (μ.toOuterMeasure A).toReal

The empirical frequency of A among a > 0 i.i.d. samples is an unbiased estimator of the probability of A.

theorem Cslib.Probability.PMF.sum_pi_mul_empiricalFrequency_sq {S : Type u_1} [Fintype S] (μ : PMF S) (A : Set S) [DecidablePred fun (x : S) => x ∈ A] {a : ℕ} (ha : 0 < a) :
∑ x : Fin a → S, ((pi fun (x : Fin a) => μ) x).toReal * empiricalFrequency A x ^ 2 = (μ.toOuterMeasure A).toReal ^ 2 + (μ.toOuterMeasure A).toReal * (1 - (μ.toOuterMeasure A).toReal) / ↑a

The second moment of the empirical frequency of an event of probability P among a > 0 i.i.d. samples is P² + P (1 - P) / a.

noncomputable def Cslib.Probability.PMF.productEstimate {κ : Type u_1} {S : Type u_2} [Fintype κ] {a : ℕ} (A : κ → Set S) [(k : κ) → DecidablePred fun (x : S) => x ∈ A k] (x : κ → Fin a → S) :

The product estimator: the product over the stages k of the empirical frequency of A k among the a samples x k.

theorem Cslib.Probability.PMF.productEstimate_eq {κ : Type u_1} {S : Type u_2} [Fintype κ] {a : ℕ} (A : κ → Set S) [(k : κ) → DecidablePred fun (x : S) => x ∈ A k] (x : κ → Fin a → S) :
productEstimate A x = ∏ k : κ, empiricalFrequency (A k) (x k)
theorem Cslib.Probability.PMF.sum_pi_mul_productEstimate {κ : Type u_1} {S : Type u_2} [Fintype κ] [DecidableEq κ] [Fintype S] (μ : κ → PMF S) (A : κ → Set S) [(k : κ) → DecidablePred fun (x : S) => x ∈ A k] {a : ℕ} (ha : 0 < a) :
∑ x : κ → Fin a → S, ((pi fun (k : κ) => pi fun (x : Fin a) => μ k) x).toReal * productEstimate A x = ∏ k : κ, ((μ k).toOuterMeasure (A k)).toReal

The product estimator with independent stages is an unbiased estimator of the product of the stage probabilities.

theorem Cslib.Probability.PMF.sum_pi_mul_productEstimate_sq {κ : Type u_1} {S : Type u_2} [Fintype κ] [DecidableEq κ] [Fintype S] (μ : κ → PMF S) (A : κ → Set S) [(k : κ) → DecidablePred fun (x : S) => x ∈ A k] {a : ℕ} (ha : 0 < a) :
∑ x : κ → Fin a → S, ((pi fun (k : κ) => pi fun (x : Fin a) => μ k) x).toReal * productEstimate A x ^ 2 = ∏ k : κ, (((μ k).toOuterMeasure (A k)).toReal ^ 2 + ((μ k).toOuterMeasure (A k)).toReal * (1 - ((μ k).toOuterMeasure (A k)).toReal) / ↑a)

The second moment of the product estimator with independent stages.

theorem Cslib.Probability.PMF.le_toOuterMeasure_productEstimate {κ : Type u_1} {S : Type u_2} [Fintype κ] [Finite S] (μ : κ → PMF S) (A : κ → Set S) [(k : κ) → DecidablePred fun (x : S) => x ∈ A k] (r : κ → ℝ) {b ε η : ℝ} {a : ℕ} (hb : 0 < b) (hr : ∀ (k : κ), b ≤ r k) (hε : 0 < ε) (hε1 : ε ≤ 1) (hη : 0 < η) (hp : ∀ (k : κ), |((μ k).toOuterMeasure (A k)).toReal - r k| ≤ ε / (6 * ↑(Fintype.card κ)) * r k) (ha : 48 * ↑(Fintype.card κ) ≤ 5 * η * ε ^ 2 * ↑a * b) :
1 - η ≤ ((pi fun (k : κ) => pi fun (x : Fin a) => μ k).toOuterMeasure {x : κ → Fin a → S | (1 - ε) * ∏ k : κ, r k ≤ productEstimate A x ∧ productEstimate A x ≤ (1 + ε) * ∏ k : κ, r k}).toReal

Concentration of the product estimator. Let n = |κ| be the number of stages. Suppose stage k draws a independent samples from μ k, the probability of A k under μ k is within relative error ε / (6 n) of r k ≥ b > 0, 0 < ε ≤ 1, 0 < η and 48 n ≤ 5 η ε² a b. Then the product estimator lies within relative error ε of ∏ k, r k with probability at least 1 - η. This is the second-moment argument of [LP17], proof of Theorem 14.14, for general stages.