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:
- java.io.Serializable, java.lang.Cloneable, BayesianQuery
public class SamplingQuery extends BasicQuery implements java.io.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
-
-
Field Summary
Fields Modifier and Type Field and Description static intDEFAULT_SAMPLE_SIZEThe default sample size.
-
Constructor Summary
Constructors Constructor and Description SamplingQuery(BayesianNetwork theNetwork)Construct a sampling query.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description SamplingQueryclone()java.lang.StringdumpCurrentState()voidexecute()Execute the query.doublegetProbability()intgetSampleSize()voidsetSampleSize(int sampleSize)java.lang.StringtoString()-
Methods inherited from class org.encog.ml.bayesian.query.BasicQuery
defineEventType, finalizeStructure, getEvents, getEventState, getEventType, getEvidenceEvents, getNetwork, getOutcomeEvents, getProblem, locateEventTypes, reset, setEventValue, setEventValue
-
-
-
-
Field Detail
-
DEFAULT_SAMPLE_SIZE
public static final int DEFAULT_SAMPLE_SIZE
The default sample size.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SamplingQuery
public SamplingQuery(BayesianNetwork theNetwork)
Construct a sampling query.- Parameters:
theNetwork- The network that will be queried.
-
-
Method Detail
-
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:
executein interfaceBayesianQuery
-
getProbability
public double getProbability()
- Specified by:
getProbabilityin interfaceBayesianQuery- Returns:
- Obtains the probability after execute has been called.
-
dumpCurrentState
public java.lang.String dumpCurrentState()
- Returns:
- The current state as a string.
-
clone
public SamplingQuery clone()
- Specified by:
clonein interfaceBayesianQuery- Overrides:
clonein classBasicQuery
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-
DMelt 3.0 © DataMelt by jWork.ORG