Uniform Probability Mass Functions #
THIS FILE IS SYNCHRONIZED WITH MATHLIB4. Any changes to this file require a corresponding PR to mathlib4.
This file defines a number of uniform pmf
distributions from various inputs,
uniformly drawing from the corresponding object.
pmf.uniform_of_finset
gives each element in the set equal probability,
with 0
probability for elements not in the set.
pmf.uniform_of_fintype
gives all elements equal probability,
equal to the inverse of the size of the fintype
.
pmf.of_multiset
draws randomly from the given multiset
, treating duplicate values as distinct.
Each probability is given by the count of the element divided by the size of the multiset
Uniform distribution taking the same non-zero probability on the nonempty finset s
Equations
- pmf.uniform_of_finset s hs = pmf.of_finset (λ (a : α), ite (a ∈ s) (↑(s.card))⁻¹ 0) s _ _
The uniform pmf taking the same uniform value on all of the fintype α
Given a non-empty multiset s
we construct the pmf
which sends a
to the fraction of
elements in s
that are a
.
Equations
- pmf.of_multiset s hs = ⟨λ (a : α), ↑(multiset.count a s) / ↑(⇑multiset.card s), _⟩