java.lang.Object
es.upm.fi.cig.multictbnc.learning.structure.constraintlearning.PC.CTPC
All Implemented Interfaces:
StructureLearningAlgorithm
Direct Known Subclasses:
CTPCHybridAlgorithm, MarkovBlanketCTPC

public class CTPC extends Object implements StructureLearningAlgorithm
Implementation of the CTPC algorithm for Multi-CTBNCs.
  • Constructor Details

    • CTPC

      public CTPC(double sigTimeTransitionHypothesis, double sigStateToStateTransitionHypothesis)
      Initialises the CTPC algorithm by providing the significance levels to be used.
      Parameters:
      sigTimeTransitionHypothesis - significance level used for the null time to transition hypothesis
      sigStateToStateTransitionHypothesis - significance level used for the null state-to-state transition hypothesis
  • Method Details

    • getIdentifier

      public String getIdentifier()
      Description copied from interface: StructureLearningAlgorithm
      Returns a unique identifier for the structure learning algorithm.
      Specified by:
      getIdentifier in interface StructureLearningAlgorithm
      Returns:
      unique identifier for the structure learning algorithm
    • getParametersAlgorithm

      public Map<String,String> getParametersAlgorithm()
      Description copied from interface: StructureLearningAlgorithm
      Returns the parameters that are used by the algorithm.
      Specified by:
      getParametersAlgorithm in interface StructureLearningAlgorithm
      Returns:
      a Map with the parameters used by the algorithm
    • learn

      public void learn(PGM<? extends Node> pgm, List<Integer> idxNodes)
      Description copied from interface: StructureLearningAlgorithm
      Learns the local structure of certain nodes of a PGM.
      Specified by:
      learn in interface StructureLearningAlgorithm
      Parameters:
      pgm - a probabilistic graphical model
      idxNodes - node indexes
    • learn

      public void learn(PGM<? extends Node> pgm) throws ErroneousValueException
      Description copied from interface: StructureLearningAlgorithm
      Learns the structure of a certain PGM.
      Specified by:
      learn in interface StructureLearningAlgorithm
      Parameters:
      pgm - a probabilistic graphical model
      Throws:
      ErroneousValueException - if a parameter provided is invalid for the requested task
    • learn

      public void learn(PGM<? extends Node> pgm, int idxNode)
      Description copied from interface: StructureLearningAlgorithm
      Learn the local structure of a certain node of a PGM.
      Specified by:
      learn in interface StructureLearningAlgorithm
      Parameters:
      pgm - a probabilistic graphical model
      idxNode - node index
    • addSepSetAndNodeAsParents

      protected void addSepSetAndNodeAsParents(PGM<? extends Node> pgm, CIMNode node, List<Integer> sepSet, int idxParentNode)
      Defines a node, which is being studied as a possible parent node, and a separating set as parents of an evaluated node. This is done to compute the parameters and sufficient statistics.
      Parameters:
      pgm - probabilistic graphical model that contains the nodes
      node - evaluated node
      sepSet - indexes of the nodes in the separating set
      idxParentNode - index of the node being studied as a possible parent node
    • addSepSetAsParents

      protected void addSepSetAsParents(PGM<? extends Node> pgm, CIMNode node, List<Integer> sepSet)
      Defines a separating set as parents of an evaluated node. This is done to compute the parameters and sufficient statistics.
      Parameters:
      pgm - probabilistic graphical model that contains the nodes
      node - evaluated node
      sepSet - indexes of the nodes in the separating set
    • buildCompleteStructure

      protected boolean[][] buildCompleteStructure(PGM<? extends Node> pgm)
      Returns the adjacency matrix of a PGM with a complete structure.
      Parameters:
      pgm - probabilistic graphical model
      Returns:
      adjacency matrix
    • getIdxFeatureVariables

      protected List<Integer> getIdxFeatureVariables(PGM<? extends Node> pgm)
      Returns the indexes of the feature nodes in a PGM.
      Parameters:
      pgm - a probabilistic graphical model
      Returns:
      indexes of the feature nodes in a PGM
    • getIdxParentsNode

      protected List<Integer> getIdxParentsNode(int idxNode, boolean[][] adjacencyMatrix)
      Returns the indexes of a node's parents.
      Parameters:
      idxNode - node index
      adjacencyMatrix - adjacency matrix
      Returns:
      indexes of a node's parents
    • learnParentSetNode

      protected void learnParentSetNode(PGM<? extends Node> pgm, int idxNode, boolean[][] adjacencyMatrix) throws ErroneousValueException
      Learns the parent set of a node.
      Parameters:
      pgm - probabilistic graphical model that contains the node
      idxNode - index of the node whose parent set is being learnt
      adjacencyMatrix - current adjacency matrix
      Throws:
      ErroneousValueException - if a provided parameter is erroneous for the requested task
    • retrieveParametersAndSuffStatistics

      protected void retrieveParametersAndSuffStatistics(PGM<? extends Node> pgm, int idxNode, Map<String,List<Object>> cache, List<Integer> idxSepSet, Integer... idxParents)
      Retrieves the parameter and sufficient statistics of a node. The method searches in a given cache first in case they were already computed.
      Parameters:
      pgm - probabilistic graphical model that contains the node
      idxNode - index of the node
      cache - cache with parameters and sufficient statistics of previous tests
      idxSepSet - indexes of the nodes in the separating set
      idxParents - indexes of the parent nodes
    • testNullStateToStateTransitionHypForGivenSepSet

      protected boolean testNullStateToStateTransitionHypForGivenSepSet(CIMNode node, CIMNode parentNode, List<String> nameNodesSepSet, CTBNSufficientStatistics suffStatSepSet, CTBNSufficientStatistics suffStatSepSetAndParent)
      Evaluates null state-to-state transition hypothesis for a given node and parent node given a certain separating set. Returns true if the null hypothesis is not rejected, false otherwise.
      Parameters:
      node - evaluate node
      parentNode - parent node
      nameNodesSepSet - names of the nodes in the separating set
      suffStatSepSet - sufficient statistics of the node given the separating set
      suffStatSepSetAndParent - sufficient statistics of the node given the parent and the separating set
      Returns:
      true if the null hypothesis is not rejected, false otherwise.
    • testNullTimeToTransitionHypForGivenSepSet

      protected boolean testNullTimeToTransitionHypForGivenSepSet(CIMNode node, CIMNode parentNode, List<String> nameNodesSepSet, double[][] qxSepSet, CTBNSufficientStatistics suffStatSepSet, double[][] qxSepSetAndParent, CTBNSufficientStatistics suffStatSepSetAndParent) throws ErroneousValueException
      Evaluate null time to transition hypothesis for a given node and parent given a certain separating set. Returns true if the null hypothesis is not rejected, false otherwise.
      Parameters:
      node - evaluated node
      parentNode - node's parent
      nameNodesSepSet - names of the nodes in the separating set
      qxSepSet - parameters of the node given the separating set
      suffStatSepSet - sufficient statistics of the node given the separating set
      qxSepSetAndParent - parameters of the node given the parent and the separating set
      suffStatSepSetAndParent - sufficient statistics of the node given the parent and the separating set
      Returns:
      true if the null hypothesis is not rejected, false otherwise
      Throws:
      ErroneousValueException - if a provided parameter is erroneous for the requested task