public class ForwardSampler extends java.lang.Object implements SamplingAlgorithm
Constructor and Description |
---|
ForwardSampler(BayesianNetwork network,
java.util.List<? extends Variable> variablesToSampleFrom,
java.util.List<Vertex> topologicallySortedVertices,
KeanuRandom random,
boolean calculateSampleProbability) |
Modifier and Type | Method and Description |
---|---|
NetworkSample |
sample()
Takes a sample with the algorithm and returns the state of the network for that sample.
|
void |
sample(java.util.Map<VariableReference,java.util.List<?>> samples,
java.util.List<java.lang.Double> logOfMasterPForEachSample)
Takes a sample with the algorithm and saves it in the supplied map (creating a new entry in the list if the
Variable already exists).
|
void |
step()
Move forward the state of the Sampling Algorithm by a single step but do not return anything.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
takeSample
public ForwardSampler(BayesianNetwork network, java.util.List<? extends Variable> variablesToSampleFrom, java.util.List<Vertex> topologicallySortedVertices, KeanuRandom random, boolean calculateSampleProbability)
public void step()
SamplingAlgorithm
step
in interface SamplingAlgorithm
public void sample(java.util.Map<VariableReference,java.util.List<?>> samples, java.util.List<java.lang.Double> logOfMasterPForEachSample)
SamplingAlgorithm
sample
in interface SamplingAlgorithm
samples
- map to store sampled variable valueslogOfMasterPForEachSample
- list of log of master probability for each samplepublic NetworkSample sample()
SamplingAlgorithm
sample
in interface SamplingAlgorithm