Incremental mode improves efficiency by rejecting samples before
execution reaches the end of the program where possible. This
requires every call to factor(score) in the program (across all
possible executions) to have score<=0.

Specifying an importance distribution can be useful when you
know something about the posterior distribution, as
specifying an importance distribution that is closer to the
posterior than the prior will improve the statistical
efficiency of inference.

This option accepts the following values:

'default': When a random choice has a guide
distribution specified, use that as the
importance distribution. For all other random choices, use
the prior.

'ignoreGuide': Use the prior as the importance
distribution for all random choices.

This method performs inference by optimizing
the parameters of the guide program. The marginal distribution is a
histogram constructed from samples drawn from the guide program
using the optimized parameters.

The following options are supported:

samples

The number of samples used to construct the marginal
distribution.

Default: 100

onlyMAP

When true, only the sample with the highest score is
retained. The marginal is a delta distribution on this value.

Default: false

In addition, all of the options supported by Optimize are also supported here.

This method builds a histogram of return values obtained by
repeatedly executing the program given by model, ignoring any
factor statements encountered while doing so. Since
condition and observe are written in terms of factor,
they are also effectively ignored.

This means that unlike all other methods described here, forward
sampling does not perform marginal inference. However, sampling
from a model without any factors etc. taken into account is often
useful in practice, and this method is provided as a convenient way
to achieve that.

The following options are supported:

samples

The number of samples to take.

Default: 100

guide

When true, sample random choices from the guide. A
default guide distribution is used for
random choices that do not have a guide distribution specified
explicitly.

When false, sample from the model.

Default: false

onlyMAP

When true, only the sample with the highest score is
retained. The marginal is a delta distribution on this value.