Library
Module
Module type
Parameter
Class
Class type
Incremental lightweight Metropolis-Hastings
include sig ... end
include Intf.S
Core constructs of the DSL
sample dist
builds a computation that samples from dist
. Note that dist
must be a pure computation.
samplei dist
is similar to sample
except that dist
can be an impure computation (ie computing the distribution can involve sampling from other distributions).
map_score m f
behaves similarly to m
except that the associated computation will be reweighted according to the result of evaluating f
on the value of m
.
val map_log_score : 'a t -> ('a -> Log_space.t) -> 'a t
Same as map_score
excepts that a log-space likelihood is expected.
val score : float -> unit t
score s
reweights the computation by s
.
val log_score : Log_space.t -> unit t
log_score
behaves as score
except that a log-space weight is expected.
module List_ops : Intf.Foldable with type 'a t = 'a list and type 'a m := 'a t
module Array_ops :
Intf.Foldable with type 'a t = 'a array and type 'a m := 'a t
Extra constructs of the incremental backend
The incremental backend can perform inference on models featuring explicit sharing of sub-computations. In practice, this allows to construct complex graphical models without having to use the (costlier) bind
of the core language.
The type of a shared sub-expression.
with_shared m f
allows to access a shareable representation of the computation m
in the scope defined by f
.
with_shared_list m f
is equivalent to folding with_shared
on a list of computations.
with_shared_array m f
is equivalent to folding with_shared
on an array of computations.
use shared
reifies a shareable representation of a computation as a bona fide computation of the same type.
val to_dot : string -> 'a t -> unit
to_dot file model
generates the graph of the model
in graphviz format and saves it to file
.
module Infix : sig ... end
Samples from the posterior described by a computation. Note that calling stream_samples
when building a model is incorrect.
Experimental features
Make_shared
allows to construct with
operators for any mappable type.