sample
public static <ValueType> java.util.ArrayList<DefaultWeightedValue<ValueType>> sample(ProbabilityDensityFunction<ValueType> importanceDistribution,
Evaluator<ValueType,java.lang.Double> targetDistribution,
java.util.Random random,
int numSamples)
Importance sampling is a technique for estimating properties of
a target distribution, while only having samples generated from an
"importance" distribution rather than the target distribution.
Typically, the importance distribution is easy to sample from, while the
target distribution is difficult to sample from, and the importance
distribution has support everywhere that the target distribution has
support. Then, this results in an weighted set of samples
that are an unbiased sampling of the target distribution.
- Type Parameters:
ValueType
- Domain type of the distributions.
- Parameters:
importanceDistribution
- Easy-to-sample-from distribution that will generate the samples.
targetDistribution
- The hard-to-sample-from distribution that is desired.
random
- Random number generator.
numSamples
- Number of samples to create.
- Returns:
- Weighted samples that are an unbiased estimate of the target
distribution.