Did you know ... Search Documentation:
Pack plrand -- prolog/prob/rmemo.pl
PublicShow source

This module provides memoisation services for predicates that run in the strand store + random state DCG. Memoisation of sampling predicates can be used to do lazy sampling and implement random world semantics. Stochastic memoisation is used to implement Dirichlet Processes and Pitman Yor processes.

 memo(+F:dcg(A,B,strand), -G:dcg(A,B,strand))// is det
Runs in strand DCG. Produces G, a callable which is a memoised version of F, both of which are binary DCG goals.
 memo_lookup(+G:dcg(A,B,strand), -X:A, -Y:B)// is nondet
Looks up previously memoised computations of G.
 gdp(+GEM:gem_param, +Base:dcg(-A,strand), -CRP:dcg(-A,strand))// is det
Generalised Dirichlet process: builds a CRP (so-called Chinese Restaurant Process) representing the distribution obtained by sampling from a Dirichlet or Pitman-Yor process with given parameter and base distribution.
 gdpmem(+GEM:gem_param, +Base:dcg(+B,-A,strand), -CRP:dcg(+B,-A,strand))// is det
Stochastic memosation based on generalised Dirichlet processes: Base is binary DCG goal in strand such that call(Base,X,Y) samples Y from some distribtion depending on X. gdpmem//3 produces a stochastically memoised version of Base that defines a GDP for each distinct value of X, created on demand the first time that X is supplied. See gdp//3 for more info.

Undocumented predicates

The following predicates are exported, but not or incorrectly documented.

 gdp2(Arg1, Arg2, Arg3, Arg4, Arg5)
 lazy(Arg1, Arg2, Arg3, Arg4)
 gdp_info(Arg1, Arg2, Arg3)
 gdp_info(Arg1, Arg2, Arg3, Arg4, Arg5)
 gdpmem_info(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6)