Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## 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

Field Summary
`static int` | `DEFAULT_SAMPLE_SIZE` The default sample size.

Constructor Summary
`SamplingQuery(BayesianNetwork theNetwork)` Construct a sampling query.

Method Summary
`SamplingQuery` | `clone()`
`String` | `dumpCurrentState()`
`void` | `execute()` Execute the query.
`double` | `getProbability()`
`int` | `getSampleSize()`
`void` | `setSampleSize(int sampleSize)`
`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`

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:
    `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`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2012. All Rights Reserved.