org.encog.ml.bayesian.query.sample
Class SamplingQuery
java.lang.Object
org.encog.ml.bayesian.query.BasicQuery
org.encog.ml.bayesian.query.sample.SamplingQuery
- All Implemented Interfaces:
- Serializable, Cloneable, BayesianQuery
public class SamplingQuery
- extends BasicQuery
- implements Serializable
A sampling query allows probabilistic queries on a Bayesian network. Sampling
works by actually simulating the probabilities using a random number
generator. A sample size must be specified. The higher the sample size, the
more accurate the probability will be. However, the higher the sampling size,
the longer it takes to run the query.
An enumeration query is more precise than the sampling query. However, the
enumeration query will become slow as the size of the Bayesian network grows.
Sampling can often be used for a quick estimation of a probability.
- See Also:
- Serialized Form
Methods inherited from class org.encog.ml.bayesian.query.BasicQuery |
defineEventType, finalizeStructure, getEvents, getEventState, getEventType, getEvidenceEvents, getNetwork, getOutcomeEvents, getProblem, isNeededEvidence, locateEventTypes, reset, satisfiesDesiredOutcome, setEventValue, setEventValue |
DEFAULT_SAMPLE_SIZE
public static final int DEFAULT_SAMPLE_SIZE
- The default sample size.
- See Also:
- Constant Field Values
SamplingQuery
public SamplingQuery(BayesianNetwork theNetwork)
- Construct a sampling query.
- Parameters:
theNetwork
- The network that will be queried.
getSampleSize
public int getSampleSize()
- Returns:
- the sampleSize
setSampleSize
public void setSampleSize(int sampleSize)
- Parameters:
sampleSize
- the sampleSize to set
execute
public void execute()
- Execute the query.
- Specified by:
execute
in interface BayesianQuery
getProbability
public double getProbability()
-
- Specified by:
getProbability
in interface BayesianQuery
- Returns:
- Obtains the probability after execute has been called.
dumpCurrentState
public String dumpCurrentState()
- Returns:
- The current state as a string.
clone
public SamplingQuery clone()
- Specified by:
clone
in interface BayesianQuery
- Overrides:
clone
in class BasicQuery
toString
public String toString()
-
- Overrides:
toString
in class Object
Copyright © 2014. All Rights Reserved.