Module es.upm.fi.cig.multictbnc
Package es.upm.fi.cig.multictbnc.models
Class BN<NodeType extends Node>
java.lang.Object
es.upm.fi.cig.multictbnc.models.AbstractPGM<NodeType>
es.upm.fi.cig.multictbnc.models.BN<NodeType>
- Type Parameters:
NodeType
- type of the nodes of the BN, e.g., nodes with conditional probability table (CPTNode)
- All Implemented Interfaces:
PGM<NodeType>
Implements a Bayesian network (BN).
-
Constructor Summary
ConstructorDescriptionBN
(Dataset dataset, List<String> nameVariables, BNLearningAlgorithms bnLearningAlgs, StructureConstraints structureConstraints, Class<NodeType> nodeClass) Initialises a Bayesian network by receiving a dataset, a list of variables to use and the algorithms for parameter and structure learning.Constructor to clone a Bayesian network.Initialises a Bayesian network by receiving a list of nodes.Initialises a Bayesian network by receiving a list of nodes and a dataset. -
Method Summary
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, learnParameters, removeAllEdges, removeAllNodes, saveGraph, setDataset, setNameVariables, setParameterLearningAlgorithm, setStructure, setStructure, setStructure, setStructureConstraints, setStructureLearningAlgorithm, setStructureModifiedNodes
-
Constructor Details
-
BN
Initialises a Bayesian network by receiving a list of nodes.- Parameters:
nodes
- list of nodes
-
BN
Initialises a Bayesian network by receiving a list of nodes and a dataset. This constructor was thought to be used byMultiCTBNC
.- Parameters:
nodes
- list of nodesdataset
- dataset used to learn the Bayesian network
-
BN
public BN(Dataset dataset, List<String> nameVariables, BNLearningAlgorithms bnLearningAlgs, StructureConstraints structureConstraints, Class<NodeType> nodeClass) Initialises a Bayesian network by receiving a dataset, a list of variables to use and the algorithms for parameter and structure learning. This constructor was thought to be used byMultiCTBNC
.- Parameters:
dataset
- dataset used to learn the Bayesian networknameVariables
- name of the variablesbnLearningAlgs
- parameter and structure learning algorithmsstructureConstraints
- structure constrains to take into account during the learning of the Bayesian networknodeClass
- type of the BN nodes
-
BN
Constructor to clone a Bayesian network.- Parameters:
bn
- Bayesian network to clonecloneStructure
-true
if the structure of theBN
should be clone,false
to define the model nodes from a dataset contained in theBN
, if any, without copying the structure.
-
-
Method Details
-
getLearntNodes
Returns the nodes with the learnt parameters. This can be, for example, a list of CPTNode objects that store conditional probability tables.- Returns:
- nodes with learnt parameters
-
getTopologicalOrdering
Obtains the topological ordering of the nodes with the Kahn's algorithm.- Returns:
- sorted nodes
-
toString
-
getType
Description copied from interface:PGM
Provides the type of PGM.- Returns:
- string describing the type of PGM
-
getModelIdentifier
Description copied from interface:PGM
Returns aString
that identifies the model.- Returns:
String
that identifies the model
-