Module es.upm.fi.cig.multictbnc
Class CTPC
java.lang.Object
es.upm.fi.cig.multictbnc.learning.structure.constraintlearning.PC.CTPC
- All Implemented Interfaces:
StructureLearningAlgorithm
- Direct Known Subclasses:
CTPCHybridAlgorithm
,MarkovBlanketCTPC
Implementation of the CTPC algorithm for Multi-CTBNCs.
-
Constructor Summary
ConstructorDescriptionCTPC
(double sigTimeTransitionHypothesis, double sigStateToStateTransitionHypothesis) Initialises the CTPC algorithm by providing the significance levels to be used. -
Method Summary
Modifier and TypeMethodDescriptionprotected 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.protected void
Defines a separating set as parents of an evaluated node.protected boolean[][]
buildCompleteStructure
(PGM<? extends Node> pgm) Returns the adjacency matrix of a PGM with a complete structure.Returns a unique identifier for the structure learning algorithm.getIdxFeatureVariables
(PGM<? extends Node> pgm) Returns the indexes of the feature nodes in a PGM.getIdxParentsNode
(int idxNode, boolean[][] adjacencyMatrix) Returns the indexes of a node's parents.Returns the parameters that are used by the algorithm.void
Learns the structure of a certain PGM.void
Learn the local structure of a certain node of a PGM.void
Learns the local structure of certain nodes of a PGM.protected void
learnParentSetNode
(PGM<? extends Node> pgm, int idxNode, boolean[][] adjacencyMatrix) Learns the parent set of a node.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.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.protected boolean
testNullTimeToTransitionHypForGivenSepSet
(CIMNode node, CIMNode parentNode, List<String> nameNodesSepSet, double[][] qxSepSet, CTBNSufficientStatistics suffStatSepSet, double[][] qxSepSetAndParent, CTBNSufficientStatistics suffStatSepSetAndParent) Evaluate null time to transition hypothesis for a given node and parent given a certain separating set.
-
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 hypothesissigStateToStateTransitionHypothesis
- significance level used for the null state-to-state transition hypothesis
-
-
Method Details
-
getIdentifier
Description copied from interface:StructureLearningAlgorithm
Returns a unique identifier for the structure learning algorithm.- Specified by:
getIdentifier
in interfaceStructureLearningAlgorithm
- Returns:
- unique identifier for the structure learning algorithm
-
getParametersAlgorithm
Description copied from interface:StructureLearningAlgorithm
Returns the parameters that are used by the algorithm.- Specified by:
getParametersAlgorithm
in interfaceStructureLearningAlgorithm
- Returns:
- a
Map
with the parameters used by the algorithm
-
learn
Description copied from interface:StructureLearningAlgorithm
Learns the local structure of certain nodes of a PGM.- Specified by:
learn
in interfaceStructureLearningAlgorithm
- Parameters:
pgm
- a probabilistic graphical modelidxNodes
- node indexes
-
learn
Description copied from interface:StructureLearningAlgorithm
Learns the structure of a certain PGM.- Specified by:
learn
in interfaceStructureLearningAlgorithm
- Parameters:
pgm
- a probabilistic graphical model- Throws:
ErroneousValueException
- if a parameter provided is invalid for the requested task
-
learn
Description copied from interface:StructureLearningAlgorithm
Learn the local structure of a certain node of a PGM.- Specified by:
learn
in interfaceStructureLearningAlgorithm
- Parameters:
pgm
- a probabilistic graphical modelidxNode
- 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 nodesnode
- evaluated nodesepSet
- indexes of the nodes in the separating setidxParentNode
- index of the node being studied as a possible parent node
-
addSepSetAsParents
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 nodesnode
- evaluated nodesepSet
- indexes of the nodes in the separating set
-
buildCompleteStructure
Returns the adjacency matrix of a PGM with a complete structure.- Parameters:
pgm
- probabilistic graphical model- Returns:
- adjacency matrix
-
getIdxFeatureVariables
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
Returns the indexes of a node's parents.- Parameters:
idxNode
- node indexadjacencyMatrix
- 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 nodeidxNode
- index of the node whose parent set is being learntadjacencyMatrix
- 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 nodeidxNode
- index of the nodecache
- cache with parameters and sufficient statistics of previous testsidxSepSet
- indexes of the nodes in the separating setidxParents
- 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. Returnstrue
if the null hypothesis is not rejected,false
otherwise.- Parameters:
node
- evaluate nodeparentNode
- parent nodenameNodesSepSet
- names of the nodes in the separating setsuffStatSepSet
- sufficient statistics of the node given the separating setsuffStatSepSetAndParent
- 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. Returnstrue
if the null hypothesis is not rejected,false
otherwise.- Parameters:
node
- evaluated nodeparentNode
- node's parentnameNodesSepSet
- names of the nodes in the separating setqxSepSet
- parameters of the node given the separating setsuffStatSepSet
- sufficient statistics of the node given the separating setqxSepSetAndParent
- parameters of the node given the parent and the separating setsuffStatSepSetAndParent
- 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
-