org.encog.ml.bayesian.query.enumerate
Class EnumerationQuery
- java.lang.Object
-
- org.encog.ml.bayesian.query.BasicQuery
-
- org.encog.ml.bayesian.query.enumerate.EnumerationQuery
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, BayesianQuery
public class EnumerationQuery extends BasicQuery implements java.io.Serializable
An enumeration query allows probabilistic queries on a Bayesian network. Enumeration works by calculating every combination of hidden nodes and using total probability. This results in an accurate deterministic probability. However, enumeration can be slow for large Bayesian networks. For a quick estimate of probability the sampling query can be used.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description EnumerationQuery()Default constructor.EnumerationQuery(BayesianNetwork theNetwork)Construct the enumeration query.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description EnumerationQueryclone()voidexecute()Execute the query.booleanforward()Roll the enumeration events forward by one.doublegetProbability()voidresetEnumeration(boolean includeEvidence, boolean includeOutcome)Reset the enumeration events.static booleanroll(java.util.List<BayesianEvent> enumerationEvents, int[] args)Roll the enumeration events forward by one.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
-
-
-
-
Constructor Detail
-
EnumerationQuery
public EnumerationQuery(BayesianNetwork theNetwork)
Construct the enumeration query.- Parameters:
theNetwork- The Bayesian network to query.
-
EnumerationQuery
public EnumerationQuery()
Default constructor.
-
-
Method Detail
-
resetEnumeration
public void resetEnumeration(boolean includeEvidence, boolean includeOutcome)Reset the enumeration events. Always reset the hidden events. Optionally reset the evidence and outcome.- Parameters:
includeEvidence- True if the evidence is to be reset.includeOutcome- True if the outcome is to be reset.
-
forward
public boolean forward()
Roll the enumeration events forward by one.- Returns:
- False if there are no more values to roll into, which means we're done.
-
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.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
roll
public static boolean roll(java.util.List<BayesianEvent> enumerationEvents, int[] args)
Roll the enumeration events forward by one.- Parameters:
enumerationEvents- The enumeration events.args- The arguments.- Returns:
- False if there are no more values to roll into, which means we're done.
-
clone
public EnumerationQuery clone()
- Specified by:
clonein interfaceBayesianQuery- Overrides:
clonein classBasicQuery- Returns:
- A clone of this object.
-
-
DMelt 3.0 © DataMelt by jWork.ORG