java.lang.Object
es.upm.fi.cig.multictbnc.learning.structure.optimisation.hillclimbing.implementation.CTBNHillClimbingIndividual
All Implemented Interfaces:
HillClimbingImplementation
Direct Known Subclasses:
CTBNHillClimbingHybridAlgorithm, CTBNTabuSearchIndividual

public class CTBNHillClimbingIndividual extends Object implements HillClimbingImplementation
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 Details

    • CTBNHillClimbingIndividual

      public CTBNHillClimbingIndividual(CTBNScoreFunction scoreFunction)
      Constructor that receives the score function to optimise.
      Parameters:
      scoreFunction - score function for continuous-time Bayesian networks
  • Method Details

    • findStructure

      public HillClimbingSolution findStructure(PGM<? extends Node> pgm)
      Description copied from interface: HillClimbingImplementation
      Finds a structure for a given PGM.
      Specified by:
      findStructure in interface HillClimbingImplementation
      Parameters:
      pgm - a probabilistic graphical model
      Returns:
      solution given by the hill climbing algorithm
    • findStructure

      public HillClimbingSolution findStructure(PGM<? extends Node> pgm, int idxNode)
      Description copied from interface: HillClimbingImplementation
      Finds the local structure of a given node of a PGM.
      Specified by:
      findStructure in interface HillClimbingImplementation
      Parameters:
      pgm - a probabilistic graphical model
      idxNode - node index
      Returns:
      a HillClimbingSolution
    • findStructure

      public HillClimbingSolution findStructure(PGM<? extends Node> pgm, List<Integer> idxNodes)
      Description copied from interface: HillClimbingImplementation
      Finds the local structure of some given nodes of a PGM.
      Specified by:
      findStructure in interface HillClimbingImplementation
      Parameters:
      pgm - a probabilistic graphical model
      idxNodes - node indexes
      Returns:
      a HillClimbingSolution
    • getIdentifier

      public String getIdentifier()
      Description copied from interface: HillClimbingImplementation
      Returns a unique identifier for the hill climbing-based algorithm.
      Specified by:
      getIdentifier in interface HillClimbingImplementation
      Returns:
      unique identifier for the hill climbing-based algorithm
    • getInfoScoreFunction

      public Map<String,String> getInfoScoreFunction()
      Description copied from interface: HillClimbingImplementation
      Returns a Map with the name of the score function that is optimised and the name of the applied penalisation function (if any).
      Specified by:
      getInfoScoreFunction in interface HillClimbingImplementation
      Returns:
      a Map with the name of the score function that is optimised and the name of the penalisation function that is applied
    • getParametersAlgorithm

      public Map<String,String> getParametersAlgorithm()
      Description copied from interface: HillClimbingImplementation
      Returns the parameters that are used by the hill climbing implementation.
      Specified by:
      getParametersAlgorithm in interface HillClimbingImplementation
      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 node
      idxNode - node index
      adjacencyMatrix - evaluated adjacency matrix
      cache - 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 node
      idxNode - node index
      adjacencyMatrix - current adjacency matrix
      cache - 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 node
      idxNode - index of the node
      adjacencyMatrix - 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.