Module es.upm.fi.cig.multictbnc
Class CTBNHillClimbingIndividual
java.lang.Object
es.upm.fi.cig.multictbnc.learning.structure.optimisation.hillclimbing.implementation.CTBNHillClimbingIndividual
- All Implemented Interfaces:
HillClimbingImplementation
- Direct Known Subclasses:
CTBNHillClimbingHybridAlgorithm
,CTBNTabuSearchIndividual
Implements hill climbing algorithm for CTBNs. This class is used with scores that can be optimised by finding the
best parent set for each node individually.
-
Constructor Summary
ConstructorDescriptionCTBNHillClimbingIndividual
(CTBNScoreFunction scoreFunction) Constructor that receives the score function to optimise. -
Method Summary
Modifier and TypeMethodDescriptionprotected double
computeScore
(CTBN<? extends Node> ctbn, int idxNode, boolean[][] adjacencyMatrix, Map<Long, Double> cache) Computes the score at a certain node given an adjacency matrix.protected HillClimbingSolution
findBestNeighbor
(CTBN<? extends Node> ctbn, int idxNode, boolean[][] adjacencyMatrix, Map<Long, Double> cache) Finds the best neighbour for a CTBN node.findStructure
(PGM<? extends Node> pgm) Finds a structure for a given PGM.findStructure
(PGM<? extends Node> pgm, int idxNode) Finds the local structure of a given node of a PGM.findStructure
(PGM<? extends Node> pgm, List<Integer> idxNodes) Finds the local structure of some given nodes of a PGM.protected boolean[][]
findStructureNode
(CTBN<? extends Node> ctbn, int idxNode, boolean[][] adjacencyMatrix) Optimises the function score to find the parent set of a given node.Returns a unique identifier for the hill climbing-based algorithm.Returns aMap
with the name of the score function that is optimised and the name of the applied penalisation function (if any).Returns the parameters that are used by the hill climbing implementation.protected void
Increases the number of evaluated edges in one.
-
Constructor Details
-
CTBNHillClimbingIndividual
Constructor that receives the score function to optimise.- Parameters:
scoreFunction
- score function for continuous-time Bayesian networks
-
-
Method Details
-
findStructure
Description copied from interface:HillClimbingImplementation
Finds a structure for a given PGM.- Specified by:
findStructure
in interfaceHillClimbingImplementation
- Parameters:
pgm
- a probabilistic graphical model- Returns:
- solution given by the hill climbing algorithm
-
findStructure
Description copied from interface:HillClimbingImplementation
Finds the local structure of a given node of a PGM.- Specified by:
findStructure
in interfaceHillClimbingImplementation
- Parameters:
pgm
- a probabilistic graphical modelidxNode
- node index- Returns:
- a
HillClimbingSolution
-
findStructure
Description copied from interface:HillClimbingImplementation
Finds the local structure of some given nodes of a PGM.- Specified by:
findStructure
in interfaceHillClimbingImplementation
- Parameters:
pgm
- a probabilistic graphical modelidxNodes
- node indexes- Returns:
- a
HillClimbingSolution
-
getIdentifier
Description copied from interface:HillClimbingImplementation
Returns a unique identifier for the hill climbing-based algorithm.- Specified by:
getIdentifier
in interfaceHillClimbingImplementation
- Returns:
- unique identifier for the hill climbing-based algorithm
-
getInfoScoreFunction
Description copied from interface:HillClimbingImplementation
Returns aMap
with the name of the score function that is optimised and the name of the applied penalisation function (if any).- Specified by:
getInfoScoreFunction
in interfaceHillClimbingImplementation
- Returns:
- a
Map
with the name of the score function that is optimised and the name of the penalisation function that is applied
-
getParametersAlgorithm
Description copied from interface:HillClimbingImplementation
Returns the parameters that are used by the hill climbing implementation.- Specified by:
getParametersAlgorithm
in interfaceHillClimbingImplementation
- Returns:
- a
Map
with the parameters used by the algorithm
-
computeScore
protected double computeScore(CTBN<? extends Node> ctbn, int idxNode, boolean[][] adjacencyMatrix, Map<Long, Double> cache) Computes the score at a certain node given an adjacency matrix.- Parameters:
ctbn
- continuous-time Bayesian network that contains the nodeidxNode
- node indexadjacencyMatrix
- evaluated adjacency matrixcache
- cache used to avoid recomputing scores- Returns:
- resulting score
-
findBestNeighbor
protected HillClimbingSolution findBestNeighbor(CTBN<? extends Node> ctbn, int idxNode, boolean[][] adjacencyMatrix, Map<Long, Double> cache) Finds the best neighbour for a CTBN node.- Parameters:
ctbn
- continuous-time Bayesian network that contains the nodeidxNode
- node indexadjacencyMatrix
- current adjacency matrixcache
- cache used to avoid recomputing scores- Returns:
- a
HillClimbingSolution
with the adjacency matrix and score of the best neighbour
-
findStructureNode
protected boolean[][] findStructureNode(CTBN<? extends Node> ctbn, int idxNode, boolean[][] adjacencyMatrix) Optimises the function score to find the parent set of a given node.- Parameters:
ctbn
- continuous-time Bayesian network that contains the nodeidxNode
- index of the nodeadjacencyMatrix
- current adjacency matrix- Returns:
- adjacency matrix that includes the best parent set of the node that was found
-
increaseNumEdgesTested
protected void increaseNumEdgesTested()Increases the number of evaluated edges in one.
-