unbbayes.prs.hybridbn
Class CNNormalDistribution

java.lang.Object
  extended by unbbayes.prs.hybridbn.CNNormalDistribution

public class CNNormalDistribution
extends Object

This class represents the continuous node normal distribution.

Author:
Rommel Carvalho (rommel.carvalho@gmail.com)

Nested Class Summary
protected  class CNNormalDistribution.NormalDistributionFunction
          Follows SumOf(k[i] * CPND[i]) + N(mean, variance), for all continuous node (i).
 
Field Summary
protected  ContinuousNode cNode
           
protected  List<Node> continuousParentList
           
protected  List<Node> discreteParentList
           
protected  int[] factors
           
protected  CNNormalDistribution.NormalDistributionFunction[] ndfList
           
 
Constructor Summary
CNNormalDistribution(ContinuousNode cNode)
           
 
Method Summary
protected  void calculateFactors()
          Calculate the factors necessary to transform the linear coordinate into a multidimensional one (which is the the state for each possible discrete parent node).
 int functionSize()
          Returns the number of normal distribution functions.
 double getConstantAt(int constantIndex, int index)
           
 double getConstantAt(int constantIndex, int[] multidimensionalCoord)
           
 int getConstantListSize()
           
 List<Node> getContinuousParentList()
           
 List<Node> getDiscreteParentList()
           
 int getLinearCoord(int[] multidimensionalCoord)
          Get the linear coordinate from the multidimensional one.
 double getMean(int index)
           
 double getMean(int[] multidimensionalCoord)
           
 int[] getMultidimensionalCoord(int linearCoord)
          Get the multidimensional coordinate from the linear one.
 double getVariance(int index)
           
 double getVariance(int[] multidimensionalCoord)
           
 void refreshParents()
          Must be called when there is some change in the parents.
 void setConstantAt(int constantIndex, double value, int index)
          Set the constant that multiplies the continuous parent node at index to the given value for the given combination of discrete parent node's states, which is the multidimensional coordinate.
 void setConstantAt(int constantIndex, double value, int[] multidimensionalCoord)
          Set the constant that multiplies the continuous parent node at index to the given value for the given combination of discrete parent node's states, which is the multidimensional coordinate.
 void setMean(double mean, int index)
          Set the normal distribution mean for the given combination of discrete parent node's states, which is represented by the given index.
 void setMean(double mean, int[] multidimensionalCoord)
          Set the normal distribution mean for the given combination of discrete parent node's states, which is the multidimensional coordinate.
 void setVariance(double variance, int index)
          Set the normal distribution variance for the given combination of discrete parent node's states, which is represented by the given index.
 void setVariance(double variance, int[] multidimensionalCoord)
          Set the normal distribution variance for the given combination of discrete parent node's states, which is the multidimensional coordinate.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cNode

protected ContinuousNode cNode

ndfList

protected CNNormalDistribution.NormalDistributionFunction[] ndfList

discreteParentList

protected List<Node> discreteParentList

continuousParentList

protected List<Node> continuousParentList

factors

protected int[] factors
Constructor Detail

CNNormalDistribution

public CNNormalDistribution(ContinuousNode cNode)
Method Detail

getDiscreteParentList

public List<Node> getDiscreteParentList()

getContinuousParentList

public List<Node> getContinuousParentList()

refreshParents

public void refreshParents()
Must be called when there is some change in the parents. The order of discrete parents list and continuous parents list is always ascendent by its name. This is important to know to which parent the respective index refers.


setConstantAt

public void setConstantAt(int constantIndex,
                          double value,
                          int[] multidimensionalCoord)
Set the constant that multiplies the continuous parent node at index to the given value for the given combination of discrete parent node's states, which is the multidimensional coordinate.

Parameters:
constantIndex - The continuous parent node index.
value - The new value for the constant.
multidimensionalCoord - The multidimensional coordinate which is the state associated with each possible discrete parent node.

setConstantAt

public void setConstantAt(int constantIndex,
                          double value,
                          int index)
Set the constant that multiplies the continuous parent node at index to the given value for the given combination of discrete parent node's states, which is the multidimensional coordinate.

Parameters:
constantIndex - The continuous parent node index.
value - The new value for the constant.
index - The index which is the state associated with each possible discrete parent node.

getConstantAt

public double getConstantAt(int constantIndex,
                            int[] multidimensionalCoord)

getConstantAt

public double getConstantAt(int constantIndex,
                            int index)

getConstantListSize

public int getConstantListSize()

setMean

public void setMean(double mean,
                    int[] multidimensionalCoord)
Set the normal distribution mean for the given combination of discrete parent node's states, which is the multidimensional coordinate.

Parameters:
mean - The normal distribution mean.
multidimensionalCoord - The multidimensional coordinate which is the state associated with each possible discrete parent node.

setMean

public void setMean(double mean,
                    int index)
Set the normal distribution mean for the given combination of discrete parent node's states, which is represented by the given index.

Parameters:
mean - The normal distribution mean.
index - The index which is the state associated with each possible discrete parent node.

getMean

public double getMean(int[] multidimensionalCoord)

getMean

public double getMean(int index)

setVariance

public void setVariance(double variance,
                        int[] multidimensionalCoord)
Set the normal distribution variance for the given combination of discrete parent node's states, which is the multidimensional coordinate.

Parameters:
variance - The normal distribution variance.
multidimensionalCoord - The multidimensional coordinate which is the state associated with each possible discrete parent node.

setVariance

public void setVariance(double variance,
                        int index)
Set the normal distribution variance for the given combination of discrete parent node's states, which is represented by the given index.

Parameters:
variance - The normal distribution variance.
index - The index which is the state associated with each possible discrete parent node.

getVariance

public double getVariance(int[] multidimensionalCoord)

getVariance

public double getVariance(int index)

calculateFactors

protected void calculateFactors()
Calculate the factors necessary to transform the linear coordinate into a multidimensional one (which is the the state for each possible discrete parent node). FactorForNode[i + 1] = ProductOf(NumberOfStates[i]), for all previous discrete parent nodes (i).


getLinearCoord

public final int getLinearCoord(int[] multidimensionalCoord)
Get the linear coordinate from the multidimensional one. LinearCoord = SumOf(StateOf[i] * FactorOf[i]), for all possible discrete parent nodes (i).

Parameters:
multidimensionalCoord - Multidimensional coordinate (represented by the state for each discrete parent node).
Returns:
The corresponding linear coordinate.

getMultidimensionalCoord

public final int[] getMultidimensionalCoord(int linearCoord)
Get the multidimensional coordinate from the linear one.

Parameters:
linearCoord - The linear coordinate.
Returns:
The corresponding multidimensional coordinate.

functionSize

public int functionSize()
Returns the number of normal distribution functions.

Returns:
The number of normal distribution functions.


Copyright © 2001-2010 University of Brasilia - UnB. All Rights Reserved.