A domain is the HUGIN representation of a network. More...
Public Member Functions | |
void | adapt () |
Adapts this Domain according to the evidence entered. | |
void | adaptClassTablesUsingFractionalUpdate () |
Adapts (using the Fractional Update algorithm) the tables of the nodes in the class with the evidence propagated in this runtime Domain. | |
void | adaptClassTablesUsingOnlineEM (double rho) |
Adapts (using the Online EM algorithm) the tables of the nodes in the class with the evidence propagated in this runtime Domain. | |
void | addCases (DataSet *data_set) |
Add all rows of the DataSet to this Domain as cases. | |
void | addCases (DataSet *data_set, size_t start, size_t count) |
Add the specified range of rows of the DataSet to this Domain as cases. | |
double | approximate (double epsilon) |
Remove "near-zero" probabilities from the clique probability tables. | |
bool | cgEvidenceIsPropagated () const |
Test if CG evidence has been propagated for this Domain. | |
Domain * | clone () const |
Clone a Domain object. | |
void | compile () |
Compile this Domain using the default triangulation method. | |
double | compress () |
Remove the zero entries from the clique and separator tables of the junction trees in this Domain. | |
void | computeDBNPredictions (size_t numberOfTimePoints) |
Computes predictions for numberOfTimePoints time slices beyond the current time window. | |
void | computeSensitivityData (const NodeList &nodes, const std::vector< size_t > &states) |
Compute the constants of the sensitivity functions for the specified output probabilities and all CPT parameters in the network. | |
Domain (const std::string &filename) | |
Construct a domain by loading the corresponding Hugin Knowledge Base (HKB) file. | |
Domain (const std::string &netStringOrFileName, ParseListener *pl) | |
Construct a domain from a NET file or a NET description given as a string. | |
Domain (const Domain *domain) | |
Construct a new domain by cloning an existing domain. | |
Domain () | |
Construct a new, empty Domain object. | |
Domain (const Class *cls) | |
Construct a runtime domain from the given class. | |
Domain (const std::string &filename, const std::string &password) | |
Construct a domain by loading the corresponding password protected Hugin Knowledge Base (HKB) file. | |
Domain (const Class *cls, size_t numberOfSlices) | |
Construct a DBN runtime domain from a Class object. | |
void | enterCase (size_t index) |
Enters a case as evidence. | |
bool | equilibriumIs (Equilibrium eq) const |
Test for Equilibrium type. | |
bool | evidenceIsPropagated () const |
Test if evidence has been propagated for this Domain. | |
bool | evidenceModeIs (EvidenceMode ev) const |
Test for evidence mode. | |
void | findMAPConfigurations (const NodeList &nodes, double minProbability) |
Find all configurations of nodes with probability at least minProbability . | |
void | fineTuneNBTables (Node *target) |
Fine-tune a Naive Bayes (NB) model using training data. | |
double | getAIC () const |
Computes the AIC score (Akaike's Information Criterion) of the case data. | |
double | getApproximationConstant () const |
Return the approximation constant. | |
double | getBIC () const |
Computes the BIC score (Bayesian Information Criterion) of the case data. | |
Number | getCaseCount (size_t index) const |
Return the case count associated with case index in this domain. | |
size_t | getConcurrencyLevel () const |
Get the current level of concurrency. | |
double | getConflict () const |
Return the conflict value. | |
size_t | getDBNWindowOffset () const |
Returns the total number of time steps that the time window of ` this DBN runtime domain has been moved. | |
NodeList | getDConnectedNodes (const NodeList &source, const NodeList &hard, const NodeList &soft) const |
Performs a d-separation test and returns a list of d-connected nodes. | |
NodeList | getDConnectedNodes (const NodeList &source, const NodeList &evidence) const |
Performs a d-separation test and returns a list of d-connected nodes. | |
NodeList | getDSeparatedNodes (const NodeList &source, const NodeList &hard, const NodeList &soft) const |
Performs a d-separation test and returns a list of d-separated nodes. | |
NodeList | getDSeparatedNodes (const NodeList &source, const NodeList &evidence) const |
Performs a d-separation test and returns a list of d-separated nodes. | |
NodeList | getEliminationOrder () const |
Return the triangulation order. | |
size_t | getEMConcurrencyLevel () const |
Return the number of threads to be created by the EM algorithm. | |
Number | getExpectedUtility () const |
Return the total expected utility associated with this Domain. | |
NodeList | getExplanation (size_t index) const |
Return the evidence subset associated with the explanation of rank index computed by the most recent call to DiscreteNode::computeExplanationData. | |
Number | getExplanationScore (size_t index) const |
Return the score of the specified explanation. | |
size_t | getGrainSize () const |
Return the current value of the grain size parameter. | |
JunctionTreeList | getJunctionTrees () const |
Return the JunctionTrees of this Domain. | |
double | getLogLikelihood () const |
Computes the log-likelihood of the case data. | |
double | getLogLikelihoodTolerance () const |
Get current setting of the log-likelihood tolerance in this domain. | |
double | getLogNormalizationConstant () const |
Get the logarithm to the normalization constant. | |
std::vector< size_t > | getMAPConfiguration (size_t index) const |
Return a MAP configuration. | |
Table * | getMarginal (const NodeList &nodes) const |
Compute the marginal distribution for the Nodes provided as argument with respect to the (imaginary) joint potential, determined by the current potentials on the junction tree (s) of this Domain. | |
size_t | getMaxNumberOfEMIterations () const |
Retrieve the current maximum number of iterations for the EM algorithm. | |
size_t | getMaxNumberOfSeparators () const |
Retrieve the current maximum number of separators allowed during a triangulation using the H_TM_TOTAL_WEIGHT triangulation method. | |
size_t | getMaxSeparatorSize () const |
Retrieve the current maximum separator size allowed during a triangulation using the H_TM_TOTAL_WEIGHT triangulation method. | |
size_t | getNBFineTuneIterationsLimit () const |
Return the limit for the number of consecutive failed iterations of the Naive Bayes (NB) fine-tuning algorithm. | |
double | getNBFineTuneLearningRate () const |
Return the learning rate of the Naive Bayes (NB) fine-tuning algorithm. | |
double | getNormalDeviate (double mean, double variance) |
Uses the pseudo-random number generator for this Domain to sample a real number from a normal (aka Gaussian) distribution. | |
double | getNormalizationConstant () const |
Retrieve the normalization constant from the most recent propagation. | |
size_t | getNumberOfCases () const |
Return the number of cases currently allocated for this domain. | |
size_t | getNumberOfExplanations () const |
Return the number of explanations. | |
size_t | getNumberOfMAPConfigurations () const |
Return the number of MAP configurations. | |
double | getProbabilityOfMAPConfiguration (size_t index) const |
Return the probability of a MAP configuration. | |
NodeList | getSensitivitySet () const |
Return the sensitivity set computed by the most recent call to DiscreteChanceNode::computeSensitivityData. | |
NodeList | getSensitivitySet (size_t output) const |
Return the sensitivity set computed by the most recent call to Domain::computeSensitivityData. | |
double | getSignificanceLevel () const |
Get current setting of the significance level in this domain. | |
double | getUniformDeviate () |
Uses the pseudo-random number generator for this Domain to sample a real number from the uniform distribution over the interval [0,1). | |
bool | hasEvidenceToPropagate () const |
Test if evidence has been entered since last propagation. | |
bool | hasTablesToPropagate () const |
Test for new node tables. | |
void | initialize () |
Establish the initial values for all tables of this Domain (which must be compiled). | |
void | initializeDBNWindow () |
Moves the time window of this DBN back to its initial position, and removes all evidence. | |
bool | isCompiled () const |
Test whether this Domain is compiled. | |
bool | isCompressed () const |
Test whether this Domain is compressed. | |
bool | isTriangulated () const |
Test whether this Domain is triangulated. | |
bool | isTriangulatedForBK () const |
Test whether this DBN runtime Domain is triangulated for Boyen-Koller approximate inference. | |
void | learnClassTables () |
Perform EM learning on an OOBN. | |
void | learnHNBStructure (Node *target) |
Learn a Hierarchical Naive Bayes (HNB) model from data. | |
void | learnStructure () |
Learn the structure (graph) of the Bayesian network from data using the PC algorithm. | |
void | learnTables () |
Learn the conditional probability tables for each node in this domain that has an experience table. | |
void | learnTreeStructure () |
Learn a tree-structured network model from data. | |
void | learnTreeStructure (Node *root, Node *target) |
Learn a tree-structured network model from data. | |
void | learnTreeStructure (Node *root) |
Learn a tree-structured network model from data. | |
bool | likelihoodIsPropagated () const |
Test if likelihood eveidence has been propagated for this Domain. | |
void | moveDBNWindow (size_t delta) |
Slides the time window of this DBN delta steps into the future. | |
size_t | newCase () |
Allocate storage within this domain to a new case. | |
void | parseCase (const std::string &filename, ParseListener *pl) |
Parses the case stored in a file with the given filename and enters the associated findings into this Domain. | |
void | parseCases (const std::string &filename, ParseListener *pl) |
Parses a set of cases, stored in a file with the given filename. | |
void | propagate (Equilibrium eq=H_EQUILIBRIUM_SUM, EvidenceMode ev=H_MODE_NORMAL) |
Establish the specified equilibrium using the evidence mode indicated for incorporation of evidence on all junction trees in this Domain. | |
void | resetInferenceEngine () |
Establish the initial state of the inference engine. | |
void | retractFindings () |
Retract (all) findings for all nodes in this Domain. | |
void | saveAsKB (const std::string &filename) |
Save this Domain as a Hugin Knowledge Base (HKB) file. | |
void | saveAsKB (const std::string &filename, const std::string &password) |
Save this Domain as a password protected Hugin Knowledge Base (HKB) file. | |
void | saveCase (const std::string &filename) |
Saves all evidence entered in this Domain in a file with the given file name (if the file exists, it is overwritten). | |
void | saveCases (const std::string &filename, const NodeList &nodes, bool caseCounts, const std::string &separator, const std::string &missingData) |
Saves all cases entered in this Domain in a Hugin data file with the given file name. | |
void | saveCases (const std::string &filename, const NodeList &nodes, const std::vector< size_t > &cases, bool caseCounts, const std::string &separator, const std::string &missingData) |
Save the specified cases entered in this Domain in a Hugin data file with the given file name. | |
void | saveToMemory () |
Create a copy in memory of the belief and junction tree tables of this Domain. | |
void | seedRandom (unsigned int seed) |
Seeds the random number generator. | |
void | setCaseCount (size_t index, Number count) |
Set the case count associated with case index in this domain to count . | |
void | setConcurrencyLevel (size_t level) |
Set the level of concurrency. | |
void | setEMConcurrencyLevel (size_t level) |
Set the number of threads to be created by the EM algorithm. | |
void | setGrainSize (size_t size) |
Set the grains size parameter. | |
void | setInitialTriangulation (const NodeList &order) |
Specify an initial triangulation for this Domain. | |
void | setLogLikelihoodTolerance (double tolerance) |
Specify the tolerance of the log-likelihood. | |
void | setMaxNumberOfEMIterations (size_t iterations) |
Set the maximal number of iterations allowed for the EM algorithm. | |
void | setMaxNumberOfSeparators (size_t separators) |
Set the maximum number of separators allowed during triangulation. | |
void | setMaxSeparatorSize (size_t size) |
Set the maximum separator size for the H_TM_TOTAL_WEIGHT TriangulationMethod. | |
void | setNBFineTuneIterationsLimit (size_t limit) |
Set the limit for the number of consecutive failed iterations of the Naive Bayes (NB) fine-tuning algorithm. | |
void | setNBFineTuneLearningRate (double learningRate) |
Set the learning rate of the Naive Bayes (NB) fine-tuning algorithm. | |
void | setNumberOfCases (size_t number) |
Adjust the storage capacity for cases in this domain. | |
void | setSignificanceLevel (double significancelevel) |
Specify the Significance Level used for the structure learning aglorithm. | |
void | simulate () |
Sample a configuration for this Domain with respect to the current distribution. | |
void | triangulate (const NodeList &order) |
Triangulate the graph of this Domain using the specified elimination order. | |
void | triangulate (TriangulationMethod tm=H_TM_BEST_GREEDY) |
Triangulate the graph of this Domain using the specified triangulation method. | |
void | triangulateDBN (TriangulationMethod tm=H_TM_BEST_GREEDY) |
Triangulate a DBN runtime Domain for exact inference. | |
void | triangulateDBNForBK (TriangulationMethod tm=H_TM_BEST_GREEDY) |
Triangulate a DBN runtime Domain for approximate inference. | |
void | uncompile () |
Uncompiles this Domain. | |
void | updatePolicies () |
Update the policy tables of this domain. | |
~Domain () throw () | |
Destruct a Domain object. |
A domain is the HUGIN representation of a network.
It is one of the principal structures in HUGIN. It must be constructed before any nodes belonging to the network.
HAPI::Domain::Domain | ( | const std::string & | filename ) | [explicit] |
Construct a domain by loading the corresponding Hugin Knowledge Base (HKB) file.
The HKB file must contain a domain.
filename | the name of the HKB file |
HAPI::Domain::Domain | ( | const std::string & | filename, |
const std::string & | password | ||
) |
Construct a domain by loading the corresponding password protected Hugin Knowledge Base (HKB) file.
The HKB file must contain a domain. If the given password does not match the password stored in the HKB file, an exception is thrown.
filename | the name of the HKB file |
password | the password for the file |
HAPI::Domain::Domain | ( | const std::string & | netStringOrFileName, |
ParseListener * | pl | ||
) |
Construct a domain from a NET file or a NET description given as a string.
netStringOrFileName | a string containing a NET description or the name of a NET file |
pl | pointer to object derived from class ParseListener. |
HAPI::Domain::Domain | ( | const Domain * | domain ) |
Construct a new domain by cloning an existing domain.
domain | The domain to be cloned. |
HAPI::Domain::Domain | ( | const Class * | cls ) |
Construct a runtime domain from the given class.
cls | The Class from which to create the runtime domain. |
HAPI::Domain::Domain | ( | const Class * | cls, |
size_t | numberOfSlices | ||
) |
void HAPI::Domain::adaptClassTablesUsingFractionalUpdate | ( | ) |
Adapts (using the Fractional Update algorithm) the tables of the nodes in the class with the evidence propagated in this runtime Domain.
This method must be called on a runtime domain. The evidence propagated in this domain is used to adapt the tables of the class from which this domain was created. The updated tables are copied back to the nodes of the runtime domain.
void HAPI::Domain::adaptClassTablesUsingOnlineEM | ( | double | rho ) |
Adapts (using the Online EM algorithm) the tables of the nodes in the class with the evidence propagated in this runtime Domain.
This method must be called on a runtime domain. The evidence propagated in this domain is used to adapt the tables of the class from which this domain was created. The updated tables are copied back to the nodes of the runtime domain.
rho | the parameter used to determine the "learning rate" of the Online EM algorithm. |
void HAPI::Domain::addCases | ( | DataSet * | data_set, |
size_t | start, | ||
size_t | count | ||
) |
double HAPI::Domain::approximate | ( | double | epsilon ) |
Remove "near-zero" probabilities from the clique probability tables.
For each Clique object in this domain, a value delta is computed such that the sum of all elements less than delta in the (discrete part) of the clique table is less than epsilon. These elements (less than delta) are then set to 0.
epsilon | The threshold value. Maximal probability mass to eradicate from each clique. |
bool HAPI::Domain::cgEvidenceIsPropagated | ( | ) | const |
Test if CG evidence has been propagated for this Domain.
Domain* HAPI::Domain::clone | ( | ) | const |
Clone a Domain object.
This function returns a pointer to a copy of this domain.
void HAPI::Domain::compile | ( | ) |
Compile this Domain using the default triangulation method.
If the domain is already triangulated, nothing is changed. The domain must contain at least one discrete or continuous node.
double HAPI::Domain::compress | ( | ) |
Remove the zero entries from the clique and separator tables of the junction trees in this Domain.
Compression can only be applied to (compiled) ordinary belief networks. Continuous nodes are allowed, but compression only applies to configurations of states of the discrete nodes.
void HAPI::Domain::computeDBNPredictions | ( | size_t | numberOfTimePoints ) |
Computes predictions for numberOfTimePoints
time slices beyond the current time window.
This Domain must have been produced by createDBNDomain, and it must have been triangulated using triangulateDBN. The predictions are accessed using getPredictedBelief, getPredictedMean, getPredictedVariance, and getPredictedValue.
numberOfTimePoints | the number of time slices to compute predictions for (this must be a positive number). |
void HAPI::Domain::computeSensitivityData | ( | const NodeList & | nodes, |
const std::vector< size_t > & | states | ||
) |
Compute the constants of the sensitivity functions for the specified output probabilities and all CPT parameters in the network.
The output probabilities are specified using a list of nodes and a list of corresponding states.
nodes | the list of (output) nodes |
states | a list of states of the nodes in the nodes list |
void HAPI::Domain::enterCase | ( | size_t | index ) |
Enters a case as evidence.
A subsequent propagate operation will perform inference using the case.
index | the index of the case to enter. |
bool HAPI::Domain::equilibriumIs | ( | Equilibrium | eq ) | const |
Test for Equilibrium type.
If the equilibrium of all junction trees of this Domain is eq, return true.
eq | Type of Equilibrium to test for. |
bool HAPI::Domain::evidenceModeIs | ( | EvidenceMode | ev ) | const |
Test for evidence mode.
Test if the equilibrium of all junction trees of this Domain could have been obtained through a propagation using ev as the evidence incorporation mode.
ev | Type of EvidenceMode to test for. |
void HAPI::Domain::findMAPConfigurations | ( | const NodeList & | nodes, |
double | minProbability | ||
) |
Find all configurations of nodes
with probability at least minProbability
.
This method uses a Monte Carlo algorithm to solve a generalized form of the maximum a posteriori (MAP) configuration problem: The MAP configuration problem is the problem of finding the most probable configuration of a set of nodes given evidence on some of the remaining nodes.
The results of this method are provided by Domain::getNumberOfMAPConfigurations, Domain::getMAPConfiguration, and Domain::getProbabilityOfMAPConfiguration.
nodes | a NodeList containing the DiscreteNodes for which to find configurations. |
minProbability | configurations with a lower probability than minProbability are ignored. |
void HAPI::Domain::fineTuneNBTables | ( | Node * | target ) |
Fine-tune a Naive Bayes (NB) model using training data.
The method makes small adjustments to the conditional probabilities of the attribute nodes in order to obtain more correct classifications. If these adjustments do not result in a better model, the original model is preserved.
The domain must represent a Naive Bayes model with initial conditional probability tables (for example, estimated using the EM algorithm). The network must contain only discrete chance nodes. Case data must be specified in advance.
target | the class variable of the Naive Bayes model. |
double HAPI::Domain::getApproximationConstant | ( | ) | const |
Return the approximation constant.
The number returned is based on the most recent (explicit or implicit) approximation operation. An implicit approximation takes place when you change some conditional probability tables of acompressed domain, and then perform a propagation operation. Since some (discrete) state configurations have been removed from a compressed domain, the probability mass of the remaining configurations will typically be less than 1. This probability mass is returned by getApproximationConstant ().
size_t HAPI::Domain::getConcurrencyLevel | ( | ) | const |
Get the current level of concurrency.
double HAPI::Domain::getConflict | ( | ) | const |
Return the conflict value.
The conflict value is valid for this Domain computed during the most recent propagation. If no propagation has been performed, 1 is returned.
NodeList HAPI::Domain::getDConnectedNodes | ( | const NodeList & | source, |
const NodeList & | hard, | ||
const NodeList & | soft | ||
) | const |
Performs a d-separation test and returns a list of d-connected nodes.
Assuming evidence on the specified evidence nodes, this method returns the list of nodes that are d-connected to the specified list of source nodes.
source | list of source nodes |
hard | list of nodes assumed to be instantiated |
soft | list of nodes assumed to have multi-state or likelihood evidence. |
NodeList HAPI::Domain::getDConnectedNodes | ( | const NodeList & | source, |
const NodeList & | evidence | ||
) | const |
Performs a d-separation test and returns a list of d-connected nodes.
Assuming evidence on the specified evidence nodes, this method returns the list of nodes that are d-connected to the specified list of source nodes.
source | list of source nodes |
evidence | list of nodes assumed to be instantiated. |
NodeList HAPI::Domain::getDSeparatedNodes | ( | const NodeList & | source, |
const NodeList & | hard, | ||
const NodeList & | soft | ||
) | const |
Performs a d-separation test and returns a list of d-separated nodes.
Assuming evidence on the specified evidence nodes, this method returns the list of nodes that are d-separated to the specified list of source nodes.
source | list of source nodes |
hard | list of nodes assumed to be instantiated |
soft | list of nodes assumed to have multi-state or likelihood evidence. |
NodeList HAPI::Domain::getDSeparatedNodes | ( | const NodeList & | source, |
const NodeList & | evidence | ||
) | const |
Performs a d-separation test and returns a list of d-separated nodes.
Assuming evidence on the specified evidence nodes, this method returns the list of nodes that are d-separated to the specified list of source nodes.
source | list of source nodes |
evidence | list of nodes assumed to be instantiated. |
NodeList HAPI::Domain::getEliminationOrder | ( | ) | const |
Return the triangulation order.
A NodeList containing the list of nodes in the order used to triangulate the network of this Domain is returned.
size_t HAPI::Domain::getEMConcurrencyLevel | ( | ) | const |
Return the number of threads to be created by the EM algorithm.
NodeList HAPI::Domain::getExplanation | ( | size_t | index ) | const |
Return the evidence subset associated with the explanation of rank index
computed by the most recent call to DiscreteNode::computeExplanationData.
index | specifies that the index th best explanation should be retrieved (the best explanation has index 0, the second best has index 1, etc.) |
Number HAPI::Domain::getExplanationScore | ( | size_t | index ) | const |
Return the score of the specified explanation.
This method returns the score associated with the explanation subset returned by Domain::getExplanation(index).
index | identifies the explanation. |
size_t HAPI::Domain::getGrainSize | ( | ) | const |
Return the current value of the grain size parameter.
JunctionTreeList HAPI::Domain::getJunctionTrees | ( | ) | const |
Return the JunctionTrees of this Domain.
double HAPI::Domain::getLogLikelihood | ( | ) | const |
Computes the log-likelihood of the case data.
std::vector<size_t> HAPI::Domain::getMAPConfiguration | ( | size_t | index ) | const |
Return a MAP configuration.
This method returns the configuration identified by index
among the configurations with probability at least minProbability
— as specified in the most recent successful call to Domain::findMAPConfigurations.
The index
argument must be a nonnegative integer less than Domain::getNumberOfMAPConfigurations: 0 requests the most probable configuration, 1 the second-most probable configuration, etc.
index | identifies the configuration. |
Compute the marginal distribution for the Nodes provided as argument with respect to the (imaginary) joint potential, determined by the current potentials on the junction tree (s) of this Domain.
If nodes
contains continuous nodes, they must be last in the list. This operation is not allowed on compressed domains.
nodes | NodeList containing the Node objects over which to compute the marginal. |
double HAPI::Domain::getNBFineTuneLearningRate | ( | ) | const |
Return the learning rate of the Naive Bayes (NB) fine-tuning algorithm.
The default value is 0.01.
double HAPI::Domain::getNormalDeviate | ( | double | mean, |
double | variance | ||
) |
Uses the pseudo-random number generator for this Domain to sample a real number from a normal (aka Gaussian) distribution.
mean | the mean of the distribution |
variance | the variance of the distribution |
double HAPI::Domain::getNormalizationConstant | ( | ) | const |
Retrieve the normalization constant from the most recent propagation.
For sum-propagation, the normalization constant is equal to the probability of the evidence propagated. For max-propagation, the normalization constant is the probability of the most probable configuration with the evidence incorporated.
size_t HAPI::Domain::getNumberOfExplanations | ( | ) | const |
Return the number of explanations.
This method returns the number of subsets found by the most recent successful call to DiscreteNode::computeExplanationData.
size_t HAPI::Domain::getNumberOfMAPConfigurations | ( | ) | const |
Return the number of MAP configurations.
This method returns the number of configurations found by the most recent successful call to Domain::findMAPConfigurations.
double HAPI::Domain::getProbabilityOfMAPConfiguration | ( | size_t | index ) | const |
Return the probability of a MAP configuration.
This method returns the probability of the configuration returned by Domain::getMAPConfiguration (index).
index | identifies the configuration. |
NodeList HAPI::Domain::getSensitivitySet | ( | ) | const |
Return the sensitivity set computed by the most recent call to DiscreteChanceNode::computeSensitivityData.
If the results produced by that call have been invalidated, a usage exception is thrown.
NodeList HAPI::Domain::getSensitivitySet | ( | size_t | output ) | const |
Return the sensitivity set computed by the most recent call to Domain::computeSensitivityData.
If the results produced by that call have been invalidated, a usage exception is thrown.
output | identifies one of the output probabilities specified in the call to Domain::computeSensitivityData. |
bool HAPI::Domain::hasTablesToPropagate | ( | ) | const |
Test for new node tables.
Are there any nodes in this Domain having (a conditional probability or utility) table that has changed since the most recent compilation or propagation.
void HAPI::Domain::initialize | ( | ) |
Establish the initial values for all tables of this Domain (which must be compiled).
Using this method will erase all evidence previously entered.
void HAPI::Domain::initializeDBNWindow | ( | ) |
Moves the time window of this DBN back to its initial position, and removes all evidence.
This Domain must have been produced by createDBNDomain, and it must have been triangulated using triangulateDBN.
bool HAPI::Domain::isTriangulated | ( | ) | const |
Test whether this Domain is triangulated.
Being "triangulated" means that the junction forest has been created, but not the associated tables.
void HAPI::Domain::learnClassTables | ( | ) |
Perform EM learning on an OOBN.
This requires, that the data matches the domain created from the OOBN, and not the OOBN itself.
void HAPI::Domain::learnHNBStructure | ( | Node * | target ) |
Learn a Hierarchical Naive Bayes (HNB) model from data.
The domain must contain only chance nodes (but continuous nodes are ignored by the HNB algorithm) and no edges. The target
variable must be a discrete node. Case data must be specified in advance.
target | the class variable of the HNB model. |
void HAPI::Domain::learnStructure | ( | ) |
Learn the structure (graph) of the Bayesian network from data using the PC algorithm.
The domain must contain only chance nodes and no edges. Case data must be specified in advance.
void HAPI::Domain::learnTreeStructure | ( | Node * | root ) |
Learn a tree-structured network model from data.
This method uses the Chow-Liu algorithm for learning a tree model with all edges directed away from root
.
The domain must contain only chance nodes and no edges. Case data must be specified in advance.
root | all edges of the tree will be directed away from root |
Learn a tree-structured network model from data.
This method constructs a Tree-Augmented Naive (TAN) Bayes model for classification. First, a Chow-Liu tree model with root
as root is learned. This tree is turned into a TAN model by adding target
as parent of all other nodes of this Domain.
The domain must contain only chance nodes and no edges. Case data must be specified in advance.
root | all edges of the Chow-Liu tree will be directed away from root |
target | the class variable of the TAN model. |
void HAPI::Domain::learnTreeStructure | ( | ) |
Learn a tree-structured network model from data.
This method uses the Rebane-Pearl algorithm for learning a polytree model.
The domain must contain only discrete chance nodes and no edges. Case data must be specified in advance.
void HAPI::Domain::moveDBNWindow | ( | size_t | delta ) |
Slides the time window of this DBN delta
steps into the future.
This Domain must have been produced by createDBNDomain, and it must have been triangulated using triangulateDBN.
delta | the number of time steps to slide the time window (this must be a positive number). |
size_t HAPI::Domain::newCase | ( | ) |
Allocate storage within this domain to a new case.
void HAPI::Domain::parseCase | ( | const std::string & | filename, |
ParseListener * | pl | ||
) |
Parses the case stored in a file with the given filename and enters the associated findings into this Domain.
All existing evidence in the Domain is retracted before entering the case findings.
filename | the name of the file containing the case. |
pl | the ParseListener used for handling parse errors. |
void HAPI::Domain::parseCases | ( | const std::string & | filename, |
ParseListener * | pl | ||
) |
Parses a set of cases, stored in a file with the given filename.
The found cases are entered into the Domain.
filename | the name of the file containing the case. |
pl | the ParseListener used for handling parse errors. |
void HAPI::Domain::propagate | ( | Equilibrium | eq = H_EQUILIBRIUM_SUM , |
EvidenceMode | ev = H_MODE_NORMAL |
||
) |
Establish the specified equilibrium using the evidence mode indicated for incorporation of evidence on all junction trees in this Domain.
Also, revised beliefs will be computed for all nodes.
eq | Equilibrium type. Defaults to H_EQUILIBRIUM_SUM. |
ev | EvidenceMode type. Defaults to H_MODE_NORMAL. |
void HAPI::Domain::resetInferenceEngine | ( | ) |
Establish the initial state of the inference engine.
: sum-equilibrium with no evidence incorporated. Any propagated findings will thus be removed from the junction tree potentials, but entered findings will still be "registred" (i.e., they will be incorporated in the next propagation).
void HAPI::Domain::saveAsKB | ( | const std::string & | filename ) |
Save this Domain as a Hugin Knowledge Base (HKB) file.
filename | name of the HKB file |
void HAPI::Domain::saveAsKB | ( | const std::string & | filename, |
const std::string & | password | ||
) |
Save this Domain as a password protected Hugin Knowledge Base (HKB) file.
filename | name of the HKB file |
password | the password for the HKB file. |
void HAPI::Domain::saveCase | ( | const std::string & | filename ) |
Saves all evidence entered in this Domain in a file with the given file name (if the file exists, it is overwritten).
filename | the name of the file in which the case is going to be saved. |
void HAPI::Domain::saveCases | ( | const std::string & | filename, |
const NodeList & | nodes, | ||
bool | caseCounts, | ||
const std::string & | separator, | ||
const std::string & | missingData | ||
) |
Saves all cases entered in this Domain in a Hugin data file with the given file name.
filename | The name of the file in which the cases will be saved (if the file exists, it is overwritten). |
nodes | A list of the nodes which are to be included in the file. |
caseCounts | If true, include case counts in the data file. If false, case counts will not be included. |
separator | The string used to separate the items in the file. |
missingData | The string used to represent missing data. |
void HAPI::Domain::saveCases | ( | const std::string & | filename, |
const NodeList & | nodes, | ||
const std::vector< size_t > & | cases, | ||
bool | caseCounts, | ||
const std::string & | separator, | ||
const std::string & | missingData | ||
) |
Save the specified cases entered in this Domain in a Hugin data file with the given file name.
filename | The name of the file in which the cases will be saved (if the file exists, it is overwritten). |
nodes | A list of the nodes which are to be included in the file. |
cases | A list of indexes of cases to be included in the file. |
caseCounts | If true, include case counts in the data file. If false, case counts will not be included. |
separator | The string used to separate the items in the file. |
missingData | The string used to represent missing data. |
void HAPI::Domain::saveToMemory | ( | ) |
Create a copy in memory of the belief and junction tree tables of this Domain.
This operation can only be performed if the domain is compiled, the current equilibrium is "sum", and no evidence has been incorporated.
void HAPI::Domain::seedRandom | ( | unsigned int | seed ) |
Seeds the random number generator.
The random number generator, used by HUGIN, generates a sequence of numbers which appears random, but are in fact deterministic. However, "seeding" the generator will change the starting point within the sequence.
seed | determines the starting point of the random number generator. |
void HAPI::Domain::setConcurrencyLevel | ( | size_t | level ) |
Set the level of concurrency.
The level of concurrency specifies the maximum number of threads to create when performing a specific table operation. Setting the level of concurrency to 1 will cause all table operations to be performed sequentially. The initial parameter value is 1.
void HAPI::Domain::setEMConcurrencyLevel | ( | size_t | level ) |
Set the number of threads to be created by the EM algorithm.
The EM algorithm exploits concurrency by partitioning the set of cases into subsets of approximately equal size. Each subset is then processed by a thread that has a copy of the (compiled) domain, enabling the threads to perform inference in parallel.
Setting this parameter to 1 causes the EM algorithm to execute single-threaded. The initial value of this parameter is 1.
level | the level of concurrency (must be a positive number). |
void HAPI::Domain::setGrainSize | ( | size_t | size ) |
Set the grains size parameter.
The grain size parameter specifies a lower limit of the tasks to be performed by each thread. The size of a task is approximately equal to the number of floating-point operations needed to perform the task (e.g., the number of elements to sum when performing a marginalization task).
The initial value of the grain size parameter is 10000.
void HAPI::Domain::setInitialTriangulation | ( | const NodeList & | order ) |
Specify an initial triangulation for this Domain.
This triangulation will be used by the H_TM_TOTAL_WEIGHT triangulation method. The purpose is to (1) improve the generated triangulation, and (2) to reduce the run-time of the algorithm. The triangulation must be specified in the form of an elimination sequence.
order | a NodeList containing the Nodes of the network in the order of elimination |
void HAPI::Domain::setLogLikelihoodTolerance | ( | double | tolerance ) |
Specify the tolerance of the log-likelihood.
Terminate the EM learning when the relative difference between the log-likelihood of two successive iterations becomes less than tolerance.
void HAPI::Domain::setMaxNumberOfEMIterations | ( | size_t | iterations ) |
Set the maximal number of iterations allowed for the EM algorithm.
The algorithm termnates when this number is reached or when the relative improvement becomes lower than the log-likelihood tolerance.
iterations | Maximum allowed number of iterations. |
void HAPI::Domain::setMaxNumberOfSeparators | ( | size_t | separators ) |
Set the maximum number of separators allowed during triangulation.
separators | Maximum number of separators allowed during triangulation. |
void HAPI::Domain::setMaxSeparatorSize | ( | size_t | size ) |
Set the maximum separator size for the H_TM_TOTAL_WEIGHT
TriangulationMethod.
If a positive maximum separator size is specified, then separators larger than the specified size will be discarded by the separator generation algorithm. However, separators implied by the initial triangulation will be retained (regardless of size). This feature can be used to triangulate much larger graphs (without splitting them into smaller subgraphs). But notice that not all separators up to the specified limit are necessarily generated.
An initial triangulation is required in order to use this feature, see setInitialTriangulation.
If zero is specified for the maximum separator size, then no separators will be discarded.
void HAPI::Domain::setNBFineTuneIterationsLimit | ( | size_t | limit ) |
Set the limit for the number of consecutive failed iterations of the Naive Bayes (NB) fine-tuning algorithm.
When limit
iterations over the training data, showing no improvements of the classification accuracy, have been performed, the algorithm terminates.
The default value is 1.
limit | a positive integer. |
void HAPI::Domain::setNBFineTuneLearningRate | ( | double | learningRate ) |
Set the learning rate of the Naive Bayes (NB) fine-tuning algorithm.
The default value is 0.01.
learningRate | a number between 0 and 1. |
void HAPI::Domain::setNumberOfCases | ( | size_t | number ) |
Adjust the storage capacity for cases in this domain.
number | Storage capacity. |
void HAPI::Domain::simulate | ( | ) |
Sample a configuration for this Domain with respect to the current distribution.
The current distribution must be in sum-equilibrium and with evidence incorporated in normal mode.
void HAPI::Domain::triangulate | ( | const NodeList & | order ) |
Triangulate the graph of this Domain using the specified elimination order.
The elimination order must contain each discrete and each continuous node of this Domain exactly once, and continuous nodes must appear before discrete nodes.
order | a NodeList containing the Nodes of the network in the order of elimination |
void HAPI::Domain::triangulate | ( | TriangulationMethod | tm = H_TM_BEST_GREEDY ) |
Triangulate the graph of this Domain using the specified triangulation method.
tm | the TriangulationMethod to use. |
void HAPI::Domain::triangulateDBN | ( | TriangulationMethod | tm = H_TM_BEST_GREEDY ) |
Triangulate a DBN runtime Domain for exact inference.
tm | the TriangulationMethod to use. |
void HAPI::Domain::triangulateDBNForBK | ( | TriangulationMethod | tm = H_TM_BEST_GREEDY ) |
Triangulate a DBN runtime Domain for approximate inference.
Boyen-Koller approximate inference is applied to the interfaces between the time slices of the time window.
tm | the TriangulationMethod to use. |
void HAPI::Domain::uncompile | ( | ) |
Uncompiles this Domain.
The data structures of this Domain produced by a triangulation or a compilation are deleted. Note that pointers to objects within the compiled structure (e.g., Cliques and JunctionTrees) are invalidated. Also note that many of the editing functions automatically performs an uncompile() operation. When this happens, the domain must be compiled again before it can be used for inference.
void HAPI::Domain::updatePolicies | ( | ) |
Update the policy tables of this domain.
The policies of all unmade decisions are updated. The new policies maximize the overall expected utility.