COM.hugin.HAPI
Class ContinuousChanceNode

java.lang.Object
  extended byCOM.hugin.HAPI.Node
      extended byCOM.hugin.HAPI.ContinuousChanceNode
All Implemented Interfaces:
java.lang.Cloneable

public class ContinuousChanceNode
extends Node

Represents continuous chance nodes with (conditional) Gaussian distributions. Continuous chance nodes are also sometimes called CG nodes (CG for conditional Gaussian).


Constructor Summary
ContinuousChanceNode(NetworkModel belongsTo)
          Constructs a new continuous chance node.
 
Method Summary
 boolean caseIsSet(int c)
          Returns true if a value has been set for this ContinuousChanceNode in case c; otherwise, returns false.
 void enterValue(double value)
          Enters evidence (observation of the value) for this ContinuousChanceNode.
 double getAlpha(int i)
          Returns the alpha component of the CG distribution of this ContinuousChanceNode given the discrete parent configuration corresponding to i.
 double getBeta(ContinuousChanceNode parent, int i)
          Returns the beta component of the CG distribution of this ContinuousChanceNode given a continuous parent and the discrete parent configuration corresponding to i.
 double getCaseValue(int c)
          Returns the value set for this ContinuousChanceNode in case c.
 NetworkModel.Category getCategory()
          Returns the Category of this ContinuousChanceNode.
 Table getDistribution()
          Returns the distribution for this continuous node.
 double getEnteredValue()
          Returns the evidence (value) entered for this ContinuousChanceNode.
 Table getExperienceTable()
          Returns the experience table of this ContinuousChanceNode.
 double getGamma(int i)
          Returns the gamma component of the CG distribution of this ContinuousChanceNode given the discrete parent configuration corresponding to i.
 NetworkModel.Kind getKind()
          Returns the Kind of this ContinuousChanceNode.
 double getMean()
          Returns the mean of the marginal distribution of this ContinuousChanceNode.
 double getPropagatedValue()
          Retrieves the value that has been propagated for this ContinuousChanceNode.
 double getSampledValue()
          Returns the value of this ContinuousChanceNode for the configuration generated by the most recent call to Domain.simulate().
 double getVariance()
          Returns the variance of the marginal distribution of this ContinuousChanceNode.
 boolean hasExperienceTable()
          Returns true if this ContinuousChanceNode has an experience table; returns false otherwise.
 void retractFindings()
          Retracts the evidence (value) entered for this ContinuousChanceNode.
 void setAlpha(double alpha, int i)
          Sets the alpha component of the CG distribution of this ContinuousChanceNode given the discrete parent configuration corresponding to i.
 void setBeta(double beta, ContinuousChanceNode parent, int i)
          Sets the beta component of the CG distribution of this ContinuousChanceNode given a continuous parent and the discrete parent configuration corresponding to i.
 void setCaseValue(int c, double value)
          Sets the value of this ContinuousChanceNode to value in case c.
 void setGamma(double gamma, int i)
          Sets the gamma component of the CG distribution of this ContinuousChanceNode given the discrete parent configuration corresponding to i.
 void unsetCase(int c)
          Specifies that the value of this ContinuousChanceNode is "unknown" for case c.
 
Methods inherited from class COM.hugin.HAPI.Node
addParent, addToInputs, addToOutputs, clone, delete, evidenceIsEntered, evidenceIsPropagated, evidenceToPropagate, getAttribute, getAttributes, getChildren, getDomain, getEdgeConstraint, getHome, getHomeClass, getHomeDomain, getInstance, getJunctionTree, getLabel, getMaster, getModel, getName, getParents, getPosition, getSource, getTable, getUserData, isAlive, likelihoodIsEntered, likelihoodIsPropagated, removeFromInputs, removeFromOutputs, removeParent, reverseEdge, setAttribute, setAttributes, setEdgeConstraint, setLabel, setName, setPosition, setUserData, switchParent
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContinuousChanceNode

public ContinuousChanceNode(NetworkModel belongsTo)
                     throws ExceptionHugin
Constructs a new continuous chance node.

Parameters:
belongsTo - the NetworkModel (i.e., Class or Domain) to which the new node should belong.
Method Detail

getDistribution

public Table getDistribution()
                      throws ExceptionHugin
Returns the distribution for this continuous node. The distribution for a continuous chance node is in general a mixture of several Gaussian distributions. This method actually computes a joint distribution of this CG node and a set of discrete nodes. These discrete nodes are chosen such that the computed marginal is a strong marginal, but it is not necessarily minimal.

Returns:
A Table holding a strong marginal of this node and a set of discrete nodes.
Throws:
ExceptionHugin

getMean

public double getMean()
               throws ExceptionHugin
Returns the mean of the marginal distribution of this ContinuousChanceNode.

Returns:
A real number (double precision) expressing the mean.
Throws:
ExceptionHugin

getVariance

public double getVariance()
                   throws ExceptionHugin
Returns the variance of the marginal distribution of this ContinuousChanceNode.

Returns:
A real number (double precision) expressing the variance.
Throws:
ExceptionHugin

getAlpha

public double getAlpha(int i)
                throws ExceptionHugin
Returns the alpha component of the CG distribution of this ContinuousChanceNode given the discrete parent configuration corresponding to i.

Parameters:
i - the index of a discrete parent configuration.
Returns:
the alpha component.
Throws:
ExceptionHugin

getBeta

public double getBeta(ContinuousChanceNode parent,
                      int i)
               throws ExceptionHugin
Returns the beta component of the CG distribution of this ContinuousChanceNode given a continuous parent and the discrete parent configuration corresponding to i.

Parameters:
parent - a ContinuousChanceNode parent of this ContinuousChanceNode.
i - the index of a discrete parent configuration.
Returns:
the beta component.
Throws:
ExceptionHugin

getGamma

public double getGamma(int i)
                throws ExceptionHugin
Returns the gamma component of the CG distribution of this ContinuousChanceNode given the discrete parent configuration corresponding to i.

Parameters:
i - the index of a discrete parent configuration.
Returns:
the gamma component.
Throws:
ExceptionHugin

setAlpha

public void setAlpha(double alpha,
                     int i)
              throws ExceptionHugin
Sets the alpha component of the CG distribution of this ContinuousChanceNode given the discrete parent configuration corresponding to i.

Parameters:
alpha - the value of the alpha component.
i - the index of a discrete parent configuration.
Throws:
ExceptionHugin

setBeta

public void setBeta(double beta,
                    ContinuousChanceNode parent,
                    int i)
             throws ExceptionHugin
Sets the beta component of the CG distribution of this ContinuousChanceNode given a continuous parent and the discrete parent configuration corresponding to i.

Parameters:
beta - the value of the beta component.
parent - a ContinuousChanceNode parent of this ContinuousChanceNode.
i - the index of a discrete parent configuration.
Throws:
ExceptionHugin

setGamma

public void setGamma(double gamma,
                     int i)
              throws ExceptionHugin
Sets the gamma component of the CG distribution of this ContinuousChanceNode given the discrete parent configuration corresponding to i.

Parameters:
gamma - the value of the gamma component.
i - the index of a discrete parent configuration.
Throws:
ExceptionHugin

enterValue

public void enterValue(double value)
                throws ExceptionHugin
Enters evidence (observation of the value) for this ContinuousChanceNode.

Parameters:
value - a real number representing the observation.
Throws:
ExceptionHugin

getEnteredValue

public double getEnteredValue()
                       throws ExceptionHugin
Returns the evidence (value) entered for this ContinuousChanceNode. If no value has been entered, an ExceptionHugin is thrown.

Returns:
A real number (double precision) expressing the value entered.
Throws:
ExceptionHugin

getExperienceTable

public Table getExperienceTable()
                         throws ExceptionHugin
Returns the experience table of this ContinuousChanceNode.

Throws:
ExceptionHugin

hasExperienceTable

public boolean hasExperienceTable()
                           throws ExceptionHugin
Returns true if this ContinuousChanceNode has an experience table; returns false otherwise.

Throws:
ExceptionHugin

retractFindings

public void retractFindings()
                     throws ExceptionHugin
Retracts the evidence (value) entered for this ContinuousChanceNode.

Throws:
ExceptionHugin

getPropagatedValue

public double getPropagatedValue()
                          throws ExceptionHugin
Retrieves the value that has been propagated for this ContinuousChanceNode. That is, the value incorporated in the current JunctionTree potentials as the state of this node.

Returns:
A real number (double precision) expressing the propagated value.
Throws:
ExceptionHugin

getCategory

public NetworkModel.Category getCategory()
Returns the Category of this ContinuousChanceNode.

Specified by:
getCategory in class Node
Returns:
NetworkModel.H_CATEGORY_CHANCE.

getKind

public NetworkModel.Kind getKind()
Returns the Kind of this ContinuousChanceNode.

Specified by:
getKind in class Node
Returns:
NetworkModel.H_KIND_CONTINUOUS.

setCaseValue

public void setCaseValue(int c,
                         double value)
                  throws ExceptionHugin
Sets the value of this ContinuousChanceNode to value in case c.

Parameters:
c - the case index represented as an integer.
value - the value represented as a real number.
Throws:
ExceptionHugin

unsetCase

public void unsetCase(int c)
               throws ExceptionHugin
Specifies that the value of this ContinuousChanceNode is "unknown" for case c.

Parameters:
c - the case index (an integer in the range 0, ..., number of cases)
Throws:
ExceptionHugin

caseIsSet

public boolean caseIsSet(int c)
                  throws ExceptionHugin
Returns true if a value has been set for this ContinuousChanceNode in case c; otherwise, returns false.

Parameters:
c - the case index represented as an integer.
Throws:
ExceptionHugin

getCaseValue

public double getCaseValue(int c)
                    throws ExceptionHugin
Returns the value set for this ContinuousChanceNode in case c.

Throws:
ExceptionHugin

getSampledValue

public double getSampledValue()
                       throws ExceptionHugin
Returns the value of this ContinuousChanceNode for the configuration generated by the most recent call to Domain.simulate().

Throws:
ExceptionHugin