Class CTBN<NodeType extends Node>

java.lang.Object
es.upm.fi.cig.multictbnc.models.AbstractPGM<NodeType>
es.upm.fi.cig.multictbnc.models.CTBN<NodeType>
Type Parameters:
NodeType - type of the nodes of the CTBN (e.g. nodes that learn a CIM)
All Implemented Interfaces:
PGM<NodeType>

public class CTBN<NodeType extends Node> extends AbstractPGM<NodeType>
Implements a continuous-time Bayesian network (CTBN).
  • Constructor Details

    • CTBN

      public CTBN(List<NodeType> nodes, BN<? extends Node> bnClassSubgraph)
      Initialises a continuous-time Bayesian network by receiving a list of nodes and a Bayesian network modelling the class subgraph of a Multi-CTBNC. This constructor is used when the structure of the model is provided and to build a MultiCTBNC.
      Parameters:
      nodes - nodes that make up the model and define its structure
      bnClassSubgraph - a Bayesian network modelling the class subgraph of a Multi-CTBNC (necessary to estimate the conditional log-likelihood)
    • CTBN

      public CTBN(List<NodeType> nodes, BN<? extends Node> bnClassSubgraph, Dataset dataset)
      Initialises a continuous-time Bayesian network by receiving a list of nodes, a Bayesian network modelling the class subgraph of a Multi-CTBNC and a training dataset. This constructor is used when the structure of the model is provided and to build a MultiCTBNC.
      Parameters:
      nodes - nodes that make up the model and define its structure
      bnClassSubgraph - a Bayesian network modelling the class subgraph of a Multi-CTBNC (necessary to estimate the conditional log-likelihood)
      dataset - dataset used to learn the continuous-time Bayesian network
    • CTBN

      public CTBN(Dataset dataset, List<String> nameVariables, CTBNLearningAlgorithms ctbnLearningAlgs, StructureConstraints structureConstraints, BN<? extends Node> bnClassSubgraph, Class<NodeType> nodeClass)
      Initialises a continuous-time Bayesian network given a dataset, the list of variables to use and the algorithms for parameter and structure learning. This constructor was thought to be used by a MultiCTBNC.
      Parameters:
      dataset - dataset used to learn the continuous-time Bayesian network
      nameVariables - variables that makeup the model
      ctbnLearningAlgs - a CTBNLearningAlgorithms containing the algorithms for parameter and structure learning
      structureConstraints - structure constraints to take into account during the learning of the continuous-time Bayesian network
      bnClassSubgraph - a Bayesian network modelling the class subgraph of a Multi-CTBNC (necessary to estimate the conditional log-likelihood)
      nodeClass - type of the CTBN nodes
    • CTBN

      public CTBN(Dataset dataset, List<String> nameVariables, CTBNLearningAlgorithms ctbnLearningAlgs, StructureConstraints structureConstraints, Class<NodeType> nodeClass)
      Initialises a continuous-time Bayesian network given a dataset, the list of variables to use and the algorithms for parameter and structure learning.
      Parameters:
      dataset - dataset used to learn the continuous-time Bayesian network
      nameVariables - variables that makeup the model
      ctbnLearningAlgs - a CTBNLearningAlgorithms containing the algorithms for parameter and structure learning
      structureConstraints - structure constrains to take into account during the learning of the continuous-time Bayesian network
      nodeClass - type of the CTBN nodes
    • CTBN

      public CTBN(CTBN<NodeType> ctbn, boolean cloneStructure)
      Constructor to clone a continuous-time Bayesian network.
      Parameters:
      ctbn - continuous-time Bayesian network to clone
      cloneStructure - true if the structure of the CTBN should be cloned, false to define the model nodes from a dataset contained in the CTBN, if any, without copying the structure.
    • CTBN

      public CTBN(CTBN<NodeType> ctbn, Dataset dataset)
      Constructor to clone a continuous-time Bayesian network. It clones the nodes of the CTBN and save the provided dataset.
      Parameters:
      ctbn - continuous-time Bayesian network
      dataset - a dataset
  • Method Details

    • getBnClassSubgraph

      public BN<? extends Node> getBnClassSubgraph()
      Returns the class subgraph (Bayesian network). This is necessary when the structure is defined by optimising the conditional log-likelihood.
      Returns:
      Bayesian network modelling the class subgraph
    • learnParameters

      public void learnParameters(Dataset dataset)
      Description copied from interface: PGM
      Learns the parameters of the PGM using the provided dataset.
      Specified by:
      learnParameters in interface PGM<NodeType extends Node>
      Overrides:
      learnParameters in class AbstractPGM<NodeType extends Node>
      Parameters:
      dataset - dataset used to learn the parameters
    • setStructure

      public void setStructure(int nodeIndex, boolean[][] adjacencyMatrix)
      Modifies the structure of the continuous-time Bayesian network by changing the parent set of a specified node and updates its parameters. This method is necessary to learn the model structure by optimising the parent set of its nodes.
      Specified by:
      setStructure in interface PGM<NodeType extends Node>
      Overrides:
      setStructure in class AbstractPGM<NodeType extends Node>
      Parameters:
      nodeIndex - node index whose parent set is modified
      adjacencyMatrix - adjacency matrix of the model containing the new parent set of the specified node
    • setStructure

      public void setStructure(List<Integer> nodeIndexes, boolean[][] adjacencyMatrix)
      Modifies the structure of the continuous-time Bayesian network by changing the parent set of some specified nodes and updates their parameters.
      Specified by:
      setStructure in interface PGM<NodeType extends Node>
      Overrides:
      setStructure in class AbstractPGM<NodeType extends Node>
      Parameters:
      nodeIndexes - node indexes whose parent sets are modified
      adjacencyMatrix - adjacency matrix of the model containing the new parent set of the specified nodes
    • getModelIdentifier

      public String getModelIdentifier()
      Description copied from interface: PGM
      Returns a String that identifies the model.
      Returns:
      String that identifies the model
    • getType

      public String getType()
      Description copied from interface: PGM
      Provides the type of PGM.
      Returns:
      string describing the type of PGM
    • toString

      public String toString()
      Overrides:
      toString in class Object