Module Ppl.Inference

Implementation of inference algorithms

Inference algorithms to be called on probabilistic models defined using Dist. The infer method can be used to call all the inference algorithms listed, but the underlying method is also exposed for convenience. The

exception Undefined
type 'a samples = ('a * Dist.prob) list

Helpers

val unduplicate : 'a samples -> 'a samples
val resample : 'a samples -> 'a samples Dist.dist
val normalise : 'a samples -> 'a samples
val flatten : ('a samples * Dist.prob) list -> 'a samples

Exact Inference

val enumerate : 'a Dist.dist -> float -> 'a samples
val exact_inference : 'a Dist.dist -> 'a Dist.dist

Importance Sampling

val importance : int -> 'a Dist.dist -> 'a samples Dist.dist

Rejetion Sampling

type rejection_type =
| Hard
| Soft
val pp_rejection_type : Stdlib.Format.formatter -> rejection_type -> unit
val show_rejection_type : rejection_type -> string
val rejection : ?⁠n:int -> rejection_type -> 'a Dist.dist -> 'a Dist.dist

Sequential Monte Carlo

val smcStandard' : int -> 'a Dist.dist -> 'a Dist.dist
val smcMultiple' : int -> int -> 'a Dist.dist -> 'a Dist.dist

Metropolis Hastings

val mh' : int -> 'a Dist.dist -> 'a Dist.dist

Particle Independent Metropolis Hastings

val pimh' : int -> int -> 'a Dist.dist -> 'a Dist.dist

Particle Cascade

val cascade' : int -> 'a Dist.dist -> 'a Dist.dist

Common

type infer_strat =
| MH of int
| SMC of int
| PC of int
| PIMH of int
| Importance of int
| Rejection of int * rejection_type
| Prior
| Enum
| Forward
val pp_infer_strat : Stdlib.Format.formatter -> infer_strat -> unit
val infer : 'a Dist.dist -> infer_strat -> 'a Dist.dist
val infer_sampler : 'a Dist.dist -> infer_strat -> unit -> 'a