java.lang.Object
es.upm.fi.cig.multictbnc.nodes.AbstractNode
es.upm.fi.cig.multictbnc.nodes.DiscreteStateNode
es.upm.fi.cig.multictbnc.nodes.CIMNode
- All Implemented Interfaces:
Node
Extends the DiscreteNode class to store a CIM and the sufficient statistics for a CTBN.
-
Constructor Summary
ConstructorDescriptionConstructor to clone a CIM node.Constructs a CIMNode given its name and possible states.Initialises a CIMNode given its name, possible states and if it is a class variable. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Returns true if the parameters of the node were estimated.double
Returns the local log-likelihood for the node.double[][][]
getOxy()
Return matrix with the probabilities of the variable leaving a certain state for another one while their parents take a certain instantiationdouble
getOxy
(int idxStateParents, int idxFromStateNode, int idxToStateNode) Returns the probability of the variable leaving a state for a certain one given the state of its parentsdouble[][]
getQx()
Return matrix with the intensities of the variables leaving a certain state while their parents take a certain instantiation.double
getQx
(int idxStateParents, int idxStateNode) Returns the intensity of the variable leaving a certain state given the state of its parentsGets the sufficient statistics of a CIM node.sampleNextState
(double percentageNoisyTransitions) Samples the next state of the node given the current one and that of its parents.double
sampleTimeState
(double stdDeviationGaussianNoiseWaitingTime) Samples the time that the node stays in its current state given the state of its parents.void
setParameters
(double[][] Qx, double[][][] Oxy) Sets the parameters of a node.void
setSufficientStatistics
(SufficientStatistics sufficientStatistics) Establishes the sufficient statistics of the node.toString()
Methods inherited from class es.upm.fi.cig.multictbnc.nodes.DiscreteStateNode
clearParentAndChildrenSets, getIdxState, getIdxStateParents, getIdxStateParents, getNumStates, getNumStatesParents, getState, getStates, removeParent, setParent, setState, setState, setStateParents
Methods inherited from class es.upm.fi.cig.multictbnc.nodes.AbstractNode
equals, getChildren, getName, getNumParents, getParents, hasChildren, hasClassVariableAsParent, hasClassVariableAsSpouse, hashCode, hasParents, isClassVariable, isClassVariable, isDisconnected, isInMarkovBlanketClassVariable, removeAllEdges, removeChild, removeChildren, removeParents, setChild
-
Constructor Details
-
CIMNode
Constructs a CIMNode given its name and possible states.- Parameters:
name
- name of the nodestates
- list of strings representing the states that the variable related to the node can take
-
CIMNode
Initialises a CIMNode given its name, possible states and if it is a class variable.- Parameters:
name
- name of the nodestates
- list of strings representing the states that the variable related to the node can takeisClassVariable
- true if the node represent a class variable, false otherwise
-
CIMNode
Constructor to clone a CIM node. The parameters and sufficient statistics are not cloned.- Parameters:
node
- aCIMNode
-
-
Method Details
-
getOxy
public double[][][] getOxy()Return matrix with the probabilities of the variable leaving a certain state for another one while their parents take a certain instantiation- Returns:
- probability matrix
-
getOxy
public double getOxy(int idxStateParents, int idxFromStateNode, int idxToStateNode) Returns the probability of the variable leaving a state for a certain one given the state of its parents- Parameters:
idxStateParents
- index of the state of the node's parentsidxFromStateNode
- leaving state indexidxToStateNode
- incoming state index- Returns:
- parameter Oxy
-
getQx
public double getQx(int idxStateParents, int idxStateNode) Returns the intensity of the variable leaving a certain state given the state of its parents- Parameters:
idxStateParents
- index of the state of the node's parentsidxStateNode
- leaving state index- Returns:
- parameter Qx
-
getQx
public double[][] getQx()Return matrix with the intensities of the variables leaving a certain state while their parents take a certain instantiation.- Returns:
- intensity matrix
-
getSufficientStatistics
Gets the sufficient statistics of a CIM node.- Returns:
- sufficient statistics.
-
sampleNextState
Samples the next state of the node given the current one and that of its parents. Returns null if not all the * parents were instantiated.- Parameters:
percentageNoisyTransitions
- value from 0 to 1 representing the probability of randomly sampling the next state of the variable- Returns:
- sampled state
-
sampleTimeState
public double sampleTimeState(double stdDeviationGaussianNoiseWaitingTime) Samples the time that the node stays in its current state given the state of its parents.- Parameters:
stdDeviationGaussianNoiseWaitingTime
- standard deviation of a Gaussian distribution used to sample noise. If zero, no noise is added- Returns:
- sampled time
-
setParameters
public void setParameters(double[][] Qx, double[][][] Oxy) Sets the parameters of a node.- Parameters:
Qx
- intensity of the variable leaving a certain state while its parents take a certain instantiationOxy
- probability of the variable leaving a certain state for another one while its parents take a certain instantiation
-
areParametersEstimated
public boolean areParametersEstimated()Description copied from interface:Node
Returns true if the parameters of the node were estimated.- Returns:
- true if the parameters of the node were estimated, false otherwise
-
estimateLogLikelihood
public double estimateLogLikelihood()Description copied from interface:Node
Returns the local log-likelihood for the node.- Returns:
- local log-likelihood
-
setSufficientStatistics
Description copied from interface:Node
Establishes the sufficient statistics of the node.- Parameters:
sufficientStatistics
- sufficient statistics
-
toString
- Overrides:
toString
in classDiscreteStateNode
-