Module es.upm.fi.cig.multictbnc
Package es.upm.fi.cig.multictbnc.models
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>
Implements a continuous-time Bayesian network (CTBN).
-
Constructor Summary
ConstructorDescriptionCTBN
(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.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.Constructor to clone a continuous-time Bayesian network.Constructor to clone a continuous-time Bayesian network.Initialises a continuous-time Bayesian network by receiving a list of nodes and a Bayesian network modelling the class subgraph of a Multi-CTBNC.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. -
Method Summary
Modifier and TypeMethodDescriptionReturns the class subgraph (Bayesian network).Returns aString
that identifies the model.getType()
Provides the type of PGM.void
learnParameters
(Dataset dataset) Learns the parameters of the PGM using the provided dataset.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.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.toString()
Methods inherited from class es.upm.fi.cig.multictbnc.models.AbstractPGM
addNodes, areParametersEstimated, computeSufficientStatistics, display, display, display, getAdjacencyMatrix, getDataset, getHyperparameters, getIndexNodes, getIndexOfNode, getNamesNodesByIndex, getNameVariables, getNodeByIndex, getNodeByName, getNodeClass, getNodeFactory, getNodeIndexer, getNodes, getNumNodes, getParameterLearningAlg, getStructureConstraints, getStructureLearningAlg, initialiseModel, isStructureLegal, learn, learn, learn, learn, learnParameters, learnParameters, learnParameters, learnParameters, learnParameters, removeAllEdges, removeAllNodes, saveGraph, setDataset, setNameVariables, setParameterLearningAlgorithm, setStructure, setStructureConstraints, setStructureLearningAlgorithm, setStructureModifiedNodes
-
Constructor Details
-
CTBN
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 aMultiCTBNC
.- Parameters:
nodes
- nodes that make up the model and define its structurebnClassSubgraph
- a Bayesian network modelling the class subgraph of a Multi-CTBNC (necessary to estimate the conditional log-likelihood)
-
CTBN
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 aMultiCTBNC
.- Parameters:
nodes
- nodes that make up the model and define its structurebnClassSubgraph
- 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 aMultiCTBNC
.- Parameters:
dataset
- dataset used to learn the continuous-time Bayesian networknameVariables
- variables that makeup the modelctbnLearningAlgs
- aCTBNLearningAlgorithms
containing the algorithms for parameter and structure learningstructureConstraints
- structure constraints to take into account during the learning of the continuous-time Bayesian networkbnClassSubgraph
- 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 networknameVariables
- variables that makeup the modelctbnLearningAlgs
- aCTBNLearningAlgorithms
containing the algorithms for parameter and structure learningstructureConstraints
- structure constrains to take into account during the learning of the continuous-time Bayesian networknodeClass
- type of the CTBN nodes
-
CTBN
Constructor to clone a continuous-time Bayesian network.- Parameters:
ctbn
- continuous-time Bayesian network to clonecloneStructure
-true
if the structure of theCTBN
should be cloned,false
to define the model nodes from a dataset contained in theCTBN
, if any, without copying the structure.
-
CTBN
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 networkdataset
- a dataset
-
-
Method Details
-
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
Description copied from interface:PGM
Learns the parameters of the PGM using the provided dataset.- Specified by:
learnParameters
in interfacePGM<NodeType extends Node>
- Overrides:
learnParameters
in classAbstractPGM<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 interfacePGM<NodeType extends Node>
- Overrides:
setStructure
in classAbstractPGM<NodeType extends Node>
- Parameters:
nodeIndex
- node index whose parent set is modifiedadjacencyMatrix
- adjacency matrix of the model containing the new parent set of the specified node
-
setStructure
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 interfacePGM<NodeType extends Node>
- Overrides:
setStructure
in classAbstractPGM<NodeType extends Node>
- Parameters:
nodeIndexes
- node indexes whose parent sets are modifiedadjacencyMatrix
- adjacency matrix of the model containing the new parent set of the specified nodes
-
getModelIdentifier
Description copied from interface:PGM
Returns aString
that identifies the model.- Returns:
String
that identifies the model
-
getType
Description copied from interface:PGM
Provides the type of PGM.- Returns:
- string describing the type of PGM
-
toString
-