Did you know ... Search Documentation:
Pack ccprism -- prolog/ccprism/switches.pl
PublicShow source

Switch parameters are represented as a list of pairs:

sw_params == list(pair(switch(_), list(number))).

Each switch term is associated with a list of numbers, one for each value the switch can take. The meaning of the numbers is context dependent, but is usually either a normalised probability distribution over the values or the parameters for a Dirichlet distribution over switch value distributions.

 sw_init(+Spec:sw_init_spec, +SW:switch(A), -SWP:pair(switch(A),list(number))) is det
Initialise parameters for given switch using specification term Spec, which can be:
uniform
Uniform probability distribution over switch's values.
unit
The value 1 for each value the switch can take.
random
Sample probability distribution over switch values from dirichlet([1,1,...]). Requires probabilistic effect sample/2 to be available.
K * Spec
Take the result of Spec and multiply all values by K.
log(Spec)
Take the result of Spec and take the logarithm of each value.
Spec1 + Spec2
Add the results of initialising with Spec1 and Spec2

Undocumented predicates

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

 map_sw(Arg1, Arg2, Arg3)
 map_swc(Arg1, Arg2, Arg3)
 map_sum_sw(Arg1, Arg2, Arg3)
 map_sum_sw(Arg1, Arg2, Arg3, Arg4)
 map_swc(Arg1, Arg2, Arg3, Arg4)
 sw_mode(Arg1, Arg2)
 sw_samples(Arg1, Arg2)
 sw_expectations(Arg1, Arg2)
 sw_log_prob(Arg1, Arg2, Arg3)
 sw_posteriors(Arg1, Arg2, Arg3)
 marg_log_prob(Arg1, Arg2, Arg3)
 dirichlet(Arg1, Arg2)