The median trick #
The median trick [Chakrabarti2025, Section 2.4] amplifies the success probability of any
estimator: if an estimate misses its target by more than t with probability at most 1 / 3,
the median of 2 r independent estimates misses by more than t with probability at most
(8 / 9) ^ r.
This holds for any estimate, whatever its distribution; algorithms such as Count-Sketch and KMV distinct elements use it for estimators that are not averages.
Main results #
Cslib.Probability.dens_abs_median_sub_gt_le: the median of2 rindependent estimates that each missμby more thantwith probability at most1 / 3missesμby more thantwith probability at most(8 / 9) ^ r.
References #
theorem Cslib.Probability.dens_abs_median_sub_gt_le {Ω : Type u_1} [Fintype Ω] [Nonempty Ω] (g : Ω → ℝ) {μ t : ℝ} (hg : ↑{x : Ω | t < |g x - μ|}.dens ≤ 1 / 3) (r : ℕ) :
The median trick [Chakrabarti2025, Section 2.4]: if the estimate g x misses μ by more
than t for at most a third of the samples x, the median of 2 r independent estimates misses
μ by more than t for at most an (8 / 9) ^ r fraction of the samples.