include Stats_intf.Fin_dist with type r = Q.t and type state = Random.State.t
type state = Random.State.t
type r = Q.t
The type of finite probability measures with domain
'a and range
from_fun len f constructs a finite function with support
0; ...; len-1.
from_array a returns a finite function wrapping the array
val of_assoc : (module Hashtbl.S with type key = 'k) -> ('k * r) array -> ( 'k, r ) Stats_intf.fin_fun
from_assoc h a returns a finite function constructed from the bindings in
a. The finite function is backed by a hash table whose implementation is given through the first class module
h. The behaviour of the function if elements in the support appear more than once is unspecified.
Constructing measures and probabilities
Creates a finitely supported measure from a finite function. A measure is not necessarily normalized.
Creates a finitely supported probability from a finite function. A probability is normalized.
Forgetful map from the type of finite probabilities to the type of measures.
Computes the empirical measure of an array of elements. Each element present in the array is mapped to its count.
val uniform : 't array -> 't prb
Finitely supported uniform distribution.
binomial p n returns the probability of having
k successes over
n experiments, according to a biased coin
Using measures and probabilities
Integrates a function against a finitely supported measure.
Evaluates a finitely supported probability on argument. Returns 0 if the argument is out of the support.
Evaluates a finitely supported measure on argument. Returns 0 if the argument is out of the support.
Iterates the given function on the support of the probability.
Iterates the given function on the support of the measure.
Samples from a finitely supported distribution presented as an unnormalized measure. This is mostly useful when sampling only once or twice from a distribution: consider converting to a categorical sampler when sampling repeatedly. Complexity: O(n) with
n the cardinality of the support.
val mean_generic : (module Basic_structures.Basic_intf.Module with type t = 't and type R.t = r) -> 't mes -> 't
Compute the mean of a finite measure supported on an
val quantile : (module Basic_structures.Basic_intf.Ordered with type t = 'elt) -> 'elt mes -> r -> 'elt
quantile ord mes p computes the
pth quantile of
mes. The underlying data is totally ordered by
Returns the raw data underlying a finitely supported measure.
Returns the raw data underlying a finitely supported probability.
type 'a pp := Format.formatter -> 'a -> unit
Pretty print a measure, with elements sorted according to the order relation on the support.
Pretty print a measure, with elements sorted by increasing measure..
module Dist : sig ... end