Module type Empirical.S

type 'a t
val from_dist : ?⁠n:int -> 'a Ppl.Dist.dist -> 'a t

Create a empirical distribution from a distribution object, using n samples to approximate it

val empty : 'a t

Create an empty distribution

val add_sample : 'a t -> 'a -> 'a t

Add another sample to the distribution

val get_num : 'a t -> 'a -> int

Get the numer of samples with the value

val get_prob : 'a t -> 'a -> float

Get the probability of a particular value

val to_pdf : 'a t -> 'a -> float

Create a pdf function

val print_map : (module Core.Pretty_printer.S with type t = 'a) -> 'a t -> unit

print the entire distribution

val to_arr : 'a t -> ('a * int) array

Get array of samples

val support : 'a t -> 'a list

Get the set of values for the distribution