All Implemented Interfaces:
Node

public class CIMNode extends DiscreteStateNode
Extends the DiscreteNode class to store a CIM and the sufficient statistics for a CTBN.
  • Constructor Details

    • CIMNode

      public CIMNode(String name, List<String> states)
      Constructs a CIMNode given its name and possible states.
      Parameters:
      name - name of the node
      states - list of strings representing the states that the variable related to the node can take
    • CIMNode

      public CIMNode(String name, List<String> states, boolean isClassVariable)
      Initialises a CIMNode given its name, possible states and if it is a class variable.
      Parameters:
      name - name of the node
      states - list of strings representing the states that the variable related to the node can take
      isClassVariable - true if the node represent a class variable, false otherwise
    • CIMNode

      public CIMNode(CIMNode node)
      Constructor to clone a CIM node. The parameters and sufficient statistics are not cloned.
      Parameters:
      node - a CIMNode
  • 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 parents
      idxFromStateNode - leaving state index
      idxToStateNode - 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 parents
      idxStateNode - 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

      public CTBNSufficientStatistics getSufficientStatistics()
      Gets the sufficient statistics of a CIM node.
      Returns:
      sufficient statistics.
    • sampleNextState

      public State sampleNextState(double percentageNoisyTransitions)
      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 instantiation
      Oxy - 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

      public void setSufficientStatistics(SufficientStatistics sufficientStatistics)
      Description copied from interface: Node
      Establishes the sufficient statistics of the node.
      Parameters:
      sufficientStatistics - sufficient statistics
    • toString

      public String toString()
      Overrides:
      toString in class DiscreteStateNode