org.encog.ml.bayesian.query

## Class BasicQuery

- java.lang.Object
- - org.encog.ml.bayesian.query.BasicQuery

- All Implemented Interfaces:
    Serializable, Cloneable, BayesianQuery
  Direct Known Subclasses:
    EnumerationQuery, SamplingQuery

      public abstract class BasicQuery
      extends Object
      implements BayesianQuery, Serializable

  Provides basic functionality for a Bayesian query. This class is abstract, and is not used directly. Rather, other queries make use of it.
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `BasicQuery()` Default constructor.
    `BasicQuery(BayesianNetwork theNetwork)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `BayesianQuery` | `clone()`
    `void` | `defineEventType(BayesianEvent event, EventType et)` Define an event type to be either hidden(default), evidence(input) or outcome (output).
    `void` | `finalizeStructure()`
    `Map<BayesianEvent,EventState>` | `getEvents()`
    `EventState` | `getEventState(BayesianEvent event)` Get the event state for a given event.
    `EventType` | `getEventType(BayesianEvent event)` Get the event type.
    `List<BayesianEvent>` | `getEvidenceEvents()`
    `BayesianNetwork` | `getNetwork()`
    `List<BayesianEvent>` | `getOutcomeEvents()`
    `String` | `getProblem()`
    `protected boolean` | `isNeededEvidence()`
    `void` | `locateEventTypes()` Called to locate the evidence and outcome events.
    `void` | `reset()` Reset all event types back to hidden.
    `protected boolean` | `satisfiesDesiredOutcome()`
    `void` | `setEventValue(BayesianEvent event, boolean b)` Set the event value to a boolean.
    `void` | `setEventValue(BayesianEvent event, int d)` Set the event value as a class item.

    - ### Methods inherited from class java.lang.Object

      `equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface org.encog.ml.bayesian.query.BayesianQuery

      `execute, getProbability`

- - ### Constructor Detail

    - #### BasicQuery

          public BasicQuery()

      Default constructor.

    - #### BasicQuery

          public BasicQuery(BayesianNetwork theNetwork)

  - ### Method Detail

    - #### finalizeStructure

          public void finalizeStructure()

      Specified by:
        `finalizeStructure` in interface `BayesianQuery`

    - #### getNetwork

          public BayesianNetwork getNetwork()

      Specified by:
        `getNetwork` in interface `BayesianQuery`
      Returns:
        The Bayesian network that we are using this query for.

    - #### getEvents

          public Map<BayesianEvent,EventState> getEvents()

      Specified by:
        `getEvents` in interface `BayesianQuery`
      Returns:
        A mapping of events to event states.

    - #### getEvidenceEvents

          public List<BayesianEvent> getEvidenceEvents()

      Specified by:
        `getEvidenceEvents` in interface `BayesianQuery`
      Returns:
        The evidence events (inputs).

    - #### getOutcomeEvents

          public List<BayesianEvent> getOutcomeEvents()

      Specified by:
        `getOutcomeEvents` in interface `BayesianQuery`
      Returns:
        The outcome events (outputs).

    - #### locateEventTypes

          public void locateEventTypes()

      Called to locate the evidence and outcome events.
      Specified by:
        `locateEventTypes` in interface `BayesianQuery`

    - #### reset

          public void reset()

      Reset all event types back to hidden.
      Specified by:
        `reset` in interface `BayesianQuery`

    - #### defineEventType

          public void defineEventType(BayesianEvent event,
                             EventType et)

      Define an event type to be either hidden(default), evidence(input) or outcome (output).
      Specified by:
        `defineEventType` in interface `BayesianQuery`
      Parameters:
        `event` - The event to define.
        `et` - THe new event type.

    - #### getEventState

          public EventState getEventState(BayesianEvent event)

      Get the event state for a given event.
      Specified by:
        `getEventState` in interface `BayesianQuery`
      Parameters:
        `event` - The event to get the state for.
      Returns:
        The event state.

    - #### getEventType

          public EventType getEventType(BayesianEvent event)

      Get the event type.
      Specified by:
        `getEventType` in interface `BayesianQuery`
      Parameters:
        `event` - The event to check.
      Returns:
        The current event type for this event.

    - #### isNeededEvidence

          protected boolean isNeededEvidence()

      Returns:
        Determines if the evidence events have values that satisfy the needed case. This is used for sampling.

    - #### satisfiesDesiredOutcome

          protected boolean satisfiesDesiredOutcome()

      Returns:
        True, if the current state satisifies the desired outcome.

    - #### setEventValue

          public void setEventValue(BayesianEvent event,
                           boolean b)

      Set the event value to a boolean.
      Specified by:
        `setEventValue` in interface `BayesianQuery`
      Parameters:
        `event` - The event.
        `b` - The value.

    - #### setEventValue

          public void setEventValue(BayesianEvent event,
                           int d)

      Set the event value as a class item.
      Specified by:
        `setEventValue` in interface `BayesianQuery`
      Parameters:
        `event` - The event to set.
        `d` - An integer class item.

    - #### getProblem

          public String getProblem()

      Specified by:
        `getProblem` in interface `BayesianQuery`
      Returns:
        Return a string that represents this query as a probability "problem".

    - #### clone

          public BayesianQuery clone()

      Specified by:
        `clone` in interface `BayesianQuery`
      Overrides:
        `clone` in class `Object`

Copyright © 2014. All Rights Reserved.