org.encog.ml.bayesian.query.enumerate
Class EnumerationQuery

java.lang.Object
  extended by org.encog.ml.bayesian.query.BasicQuery
      extended by org.encog.ml.bayesian.query.enumerate.EnumerationQuery
All Implemented Interfaces:
Serializable, Cloneable, BayesianQuery

public class EnumerationQuery
extends BasicQuery
implements 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
EnumerationQuery()
          Default constructor.
EnumerationQuery(BayesianNetwork theNetwork)
          Construct the enumeration query.
 
Method Summary
 EnumerationQuery clone()
           
 void execute()
          Execute the query.
 boolean forward()
          Roll the enumeration events forward by one.
 double getProbability()
          
 void resetEnumeration(boolean includeEvidence, boolean includeOutcome)
          Reset the enumeration events.
static boolean roll(List<BayesianEvent> enumerationEvents, int[] args)
          Roll the enumeration events forward by one.
 String toString()
          
 
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
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

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:
execute in interface BayesianQuery

getProbability

public double getProbability()

Specified by:
getProbability in interface BayesianQuery
Returns:
Obtains the probability after execute has been called.

toString

public String toString()

Overrides:
toString in class Object

roll

public static boolean roll(List<BayesianEvent> enumerationEvents,
                           int[] args)
Roll the enumeration events forward by one.

Returns:
False if there are no more values to roll into, which means we're done.

clone

public EnumerationQuery clone()
Specified by:
clone in interface BayesianQuery
Overrides:
clone in class BasicQuery
Returns:
A clone of this object.


Copyright © 2014. All Rights Reserved.