The predicate computes the probability of the query Query
If Query is not ground, it considers it as an existential query
and returns the probability that there is a satisfying assignment to
the query.
Options is a list of options, the following are recognised by mc_prob/3:
- bar(-BarChart:dict)
- BarChart is a dict for rendering with c3 as a bar chart with a bar for the
probability of success and a bar for the probability of failure.
The predicate samples Query a number of Samples times and returns
the resulting Probability (Successes/Samples)
If Query is not ground, it considers it as an existential query
Options is a list of options, the following are recognised by mc_sample/4:
- successes(-Successes:int)
- Number of successes
- failures(-Failures:int)
- Number of failures
- bar(-BarChart:dict)
- BarChart is a dict for rendering with c3 as a bar chart with a bar for the
number of successes and a bar for the number of failures.
The predicate samples Query a number of Samples times given that Evidence
is true and returns
the Probability of Query.
It performs rejection sampling: if in a sample Evidence is false, the
sample is discarded.
If Query/Evidence are not ground, it considers them an existential queries.
Options is a list of options, the following are recognised by mc_rejection_sample/5:
- successes(-Successes:int)
- Number of succeses
- failures(-Failures:int)
- Number of failueres
The predicate samples Query a number of Mix+Samples (Mix is set with the options, default value 0)
times.
The first Mix (that is set with the options, default value 0) samples are discarded (mixing time).
It performs Gibbs sampling: each sample is obtained from the previous one by resampling
a variable given the values of the variables in its Markov blanket.
If Query/Evidence are not ground, it considers them as existential queries.
Options is a list of options, the following are recognised by mc_gibbs_sample/4:
- block(+Block:int)
- Perform blocked Gibbs: Block variables are sampled together, default value 1
- mix(+Mix:int)
- The first Mix samples are discarded (mixing time), default value 0
- successes(-Successes:int)
- Number of succeses
- failures(-Failures:int)
- Number of failueres
The predicate samples Query a number of Mix+Samples (Mix is set with the options, default value 0) times given that
Evidence
is true and returns
the number of Successes, of Failures and the
Probability (Successes/Samples).
The first Mix (that is set with the options, default value 0) samples are discarded (mixing time).
It performs Gibbs sampling: each sample is obtained from the previous one by resampling
a variable given the values of the variables in its Markov blanket.
If Query/Evidence are not ground, it considers them as existential queries.
Options is a list of options, the following are recognised by mc_gibbs_sample/5:
- block(+Block:int)
- Perform blocked Gibbs: Block variables are sampled together, default value 1
- mix(+Mix:int)
- The first Mix samples are discarded (mixing time), default value 0
- successes(-Successes:int)
- Number of succeses
- failures(-Failures:int)
- Number of failueres
The predicate samples Query a number of Samples times.
Arg should be a variable in Query.
The predicate returns in Values a list of couples L-N where
L is the list of values of Arg for which Query succeeds in
a world sampled at random and N is the number of samples
returning that list of values.
The first Mix (that is set with the options, default value 0) samples are discarded (mixing time).
It performs Gibbs sampling: each sample is obtained from the previous one by resampling
a variable given the values of the variables in its Markov blanket.
Options is a list of options, the following are recognised by mc_gibbs_sample_arg/5:
- block(+Block:int)
- Perform blocked Gibbs: Block variables are sampled together, default value 1
- mix(+Mix:int)
- The first Mix samples are discarded (mixing time), default value 0
- bar(-BarChar:dict)
- BarChart is a dict for rendering with c3 as a bar chart with
a bar for each possible value of L,
the list of value of Arg for which Query succeeds in
a world sampled at random.
The predicate samples Query a number of Samples times given that Evidence
is true.
Arg should be a variable in Query.
The predicate returns in Values a list of couples L-N where
L is the list of values of Arg for which Query succeeds in
a world sampled at random and N is the number of samples
returning that list of values.
The first Mix (that is set with the options, default value 0) samples are discarded (mixing time).
It performs Gibbs sampling: each sample is obtained from the previous one by resampling
a variable given the values of the variables in its Markov blanket.
Options is a list of options, the following are recognised by mc_gibbs_sample_arg/6:
- block(+Block:int)
- Perform blocked Gibbs: Block variables are sampled together, default value 1
- mix(+Mix:int)
- The first Mix samples are discarded (mixing time), default value 0
- bar(-BarChar:dict)
- BarChart is a dict for rendering with c3 as a bar chart with
a bar for each possible value of L,
the list of value of Arg for which Query succeeds in
a world sampled at random.
The predicate samples Query a number of Mix+Samples (Mix is set with the options, default value 0) times given that
Evidence
is true and returns
the number of Successes, of Failures and the
Probability (Successes/Samples).
The first Mix (that is set with the options, default value 0) samples are discarded (mixing time).
It performs Metropolis/Hastings sampling: between each sample, Lag (that is set with the options, default value 1) sampled
choices are forgotten and each sample is accepted with a certain probability.
If Query/Evidence are not ground, it considers them as existential queries.
Options is a list of options, the following are recognised by mc_mh_sample/5:
- mix(+Mix:int)
- The first Mix samples are discarded (mixing time), default value 0
- lag(+Lag:int)
- lag between each sample, Lag sampled choices are forgotten, default value 1
- successes(-Successes:int)
- Number of succeses
- failures(-Failures:int)
- Number of failueres
The predicate samples Query a number of Samples times.
Arg should be a variable in Query.
The predicate returns in Values a list of couples L-N where
L is the list of values of Arg for which Query succeeds in
a world sampled at random and N is the number of samples
returning that list of values.
Options is a list of options, the following are recognised by mc_sample_arg/5:
- bar(-BarChar:dict)
- BarChart is a dict for rendering with c3 as a bar chart with
a bar for each possible value of L,
the list of value of Arg for which Query succeeds in
a world sampled at random.
The predicate samples Query a number of Samples times given that
Evidence is true.
Arg should be a variable in Query.
The predicate returns in Values a list of couples L-N where
L is the list of values of Arg for which Query succeeds in
a world sampled at random and N is the number of samples
returning that list of values.
Rejection sampling is performed.
Options is a list of options, the following are recognised by mc_rejection_sample_arg/6:
- bar(-BarChar:dict)
- BarChart is a dict for rendering with c3 as a bar chart with
a bar for each possible value of L,
the list of value of Arg for which Query succeeds in
a world sampled at random.
The predicate samples Query a number of Samples times given that Evidence
is true.
Arg should be a variable in Query.
The predicate returns in Values a list of couples L-N where
L is the list of values of Arg for which Query succeeds in
a world sampled at random and N is the number of samples
returning that list of values.
The first Mix (that is set with the options, default value 0) samples are discarded (mixing time).
It performs Metropolis/Hastings sampling: between each sample, Lag (that is set with the options, default value 1) sampled
choices are forgotten and each sample is accepted with a certain probability.
Options is a list of options, the following are recognised by mc_mh_sample_arg/6:
- mix(+Mix:int)
- The first Mix samples are discarded (mixing time), default value 0
- lag(+Lag:int)
- lag between each sample, Lag sampled choices are forgotten, default value 1
- bar(-BarChar:dict)
- BarChart is a dict for rendering with c3 as a bar chart with
a bar for each possible value of L,
the list of value of Arg for which Query succeeds in
a world sampled at random.
The predicate samples Query a number of Samples times.
Arg should be a variable in Query.
The predicate returns in Values a list of couples V-N where
V is the value of Arg returned as the first answer by Query in
a world sampled at random and N is the number of samples
returning that value.
V is failure if the query fails.
Options is a list of options, the following are recognised by mc_sample_arg_first/5:
- bar(-BarChar:dict)
- BarChart is a dict for rendering with c3 as a bar chart with
with a bar for each value of Arg returned as a first answer by Query in
a world sampled at random.
The size of the bar is the number of samples that returned that value.
The predicate samples Query a number of Samples times.
Arg should be a variable in Query.
The predicate returns in Values a list of couples V-N where
V is a value of Arg sampled with uniform probability from those returned
by Query in a world sampled at random and N is the number of samples
returning that value.
V is failure if the query fails.
Options is a list of options, the following are recognised by mc_sample_arg_one/5:
- bar(-BarChar:dict)
- BarChart is a dict for rendering with c3 as a bar chart
with a bar for each value of Arg returned by sampling with uniform
probability one answer from those returned by Query in a world sampled
at random.
The size of the bar is the number of samples.
The predicate computes the expected value of Arg in Query by
Gibbs sampling.
It takes N samples of Query and sums up the value of Arg for
each sample. The overall sum is divided by N to give Exp.
Arg should be a variable in Query.
Options is a list of options, the following are recognised by mc_mh_expectation/6:
- block(+Block:int)
- Perform blocked Gibbs: Block variables are sampled together, default value 1
- mix(+Mix:int)
- The first Mix samples are discarded (mixing time), default value 0
The predicate computes the expected value of Arg in Query by
Metropolis Hastings sampling.
It takes N samples of Query and sums up the value of Arg for
each sample. The overall sum is divided by N to give Exp.
Arg should be a variable in Query.
Options is a list of options, the following are recognised by mc_mh_expectation/6:
- mix(+Mix:int)
- The first Mix samples are discarded (mixing time), default value 0
- lag(+Lag:int)
- lag between each sample, Lag sampled choices are forgotten, default value 1