public final class DataSampler extends Object
takeSample(com.bayesserver.inference.Evidence, com.bayesserver.RandomNumberGenerator, com.bayesserver.data.sampling.DataSamplingOptions)
for sample code.Constructor and Description |
---|
DataSampler(Network network)
Initializes a new instance of the
DataSampler class. |
DataSampler(Network network,
Evidence fixedData)
Initializes a new instance of the
DataSampler class. |
Modifier and Type | Method and Description |
---|---|
Network |
getNetwork()
Gets the Bayesian network or Dynamic Bayesian network that was used in the constructor.
|
void |
setFixedData(Evidence value)
Sets any evidence that should be fixed for each sample.
|
void |
takeSample(Evidence sampleData,
RandomNumberGenerator random,
DataSamplingOptions options)
Generates sample data from the Bayesian network or Dynamic Bayesian network.
|
public DataSampler(Network network)
DataSampler
class.network
- The Bayesian network or Dynamic Bayesian network the samples will be taken from.public DataSampler(Network network, Evidence fixedData)
DataSampler
class.network
- The Bayesian network or Dynamic Bayesian network the samples will be taken from.fixedData
- Any data that is fixed. Can be null.public Network getNetwork()
public void takeSample(Evidence sampleData, RandomNumberGenerator random, DataSamplingOptions options) throws InconsistentEvidenceException
takeSample(com.bayesserver.inference.Evidence, com.bayesserver.RandomNumberGenerator, com.bayesserver.data.sampling.DataSamplingOptions)
generates a single sample. Call repeatedly to generate multiple samples.
For Dynamic Bayesian networks, see DataSamplingOptions.getSequenceLength()
to change the length of generated sequences.
sampleData
- Evidence instance to hold the sample data.random
- Random number generator.options
- The sampling options.InconsistentEvidenceException
- Raised if the generation of a sample leads to inconsistent evidence.public void setFixedData(Evidence value)
Copyright © 2023. All rights reserved.