This class is the ancestor of all discrete nodes. More...
Public Member Functions | |
bool | caseIsSet (size_t index) const |
Test whether the value of this node in case index currently is set. | |
void | computeExplanationData (size_t x, DiscreteNode *Y, size_t y, size_t maxSubsetSize) |
Compute Bayes factor data for all (nonempty) subsets of evidence nodes up to the specified maximum size. | |
void | computeExplanationData (size_t state, size_t maxSubsetSize) |
Compute "normalized likelihoods" for the specified hypothesis and all (nonempty) subsets of evidence nodes up to the specified maximum size. | |
void | enterFinding (size_t state, Number value) |
This method specifies a finding value for the specified state and all other states are not effected. | |
Number | getBelief (size_t state) const |
Return the belief of the specified state. | |
size_t | getCaseState (size_t index) const |
Retrieve the state value of this node associated with the case index. | |
Number | getEnteredFinding (size_t state) const |
Retrieve the finding currently registered at this node for state. | |
double | getEntropy () const |
Compute the entropy of this node. | |
Number | getExpectedUtility (size_t state) const |
Return the expected utility associated with the specified state. | |
Kind | getKind () const |
Return the node kind. | |
double | getMutualInformation (const DiscreteNode *node) const |
Compute the mutual information between this node and the specified node. | |
size_t | getNumberOfStates () const |
Return the number of states of this node. | |
Number | getPredictedBelief (size_t state, size_t time) const |
Return the predicted belief for the specified state of this DiscreteNode at the specified time point. | |
Number | getPropagatedFinding (size_t state) const |
Retrieve the propagated finding. | |
size_t | getSampledState () const |
Returns the state sampled for this node. | |
NumberList | getSensitivityConstants (size_t input, size_t output) const |
Return the four constants of the specified sensitivity function. | |
NumberList | getSensitivityConstants (size_t input) const |
Return the four constants of the specified sensitivity function. | |
Index | getStateIndex (const std::string &label) const |
Return the index of the state matching the specified label. | |
Index | getStateIndex (const char *label) const |
Return the index of the state matching the specified label. | |
std::string | getStateLabel (size_t state) const |
Return the label of state. | |
bool | isEvidenceEntered () const |
Test whether evidence is entered into this node. | |
bool | isEvidencePropagated () const |
Test whether evidence has been propagated from this node. | |
void | retractFindings () |
Retract all findings for this node. | |
void | selectState (size_t state) |
Select the specified state of this node. | |
void | setCaseState (size_t index, size_t state) |
Specify the case state of this node associated with case index to be state. | |
void | setNumberOfStates (size_t states) |
Set the number of states of this node to states. | |
void | setStateLabel (size_t state, const char *label) |
Set the state label of the node. | |
void | setStateLabel (size_t state, const std::string &label) |
Set the state label of the node. | |
void | unsetCase (size_t index) |
Specify that the value of this node for case index is unknown. |
This class is the ancestor of all discrete nodes.
bool HAPI::DiscreteNode::caseIsSet | ( | size_t | index ) | const |
Test whether the value of this node in case index currently is set.
index | Case index. |
void HAPI::DiscreteNode::computeExplanationData | ( | size_t | x, |
DiscreteNode * | Y, | ||
size_t | y, | ||
size_t | maxSubsetSize | ||
) |
Compute Bayes factor data for all (nonempty) subsets of evidence nodes up to the specified maximum size.
Two hypotheses are compared: (this node)=x and Y=y. For each subset of evidence nodes (up to the specified maximum size), the Bayes factor (the support for the first hypothesis relative to the second hypothesis) is computed. The results of the computations can be accessed using Domain::getExplanation and Domain::getExplanationScore.
x | state of the primary hypothesis node (this node) |
Y | the alternative hypothesis node |
y | state of the alternative hypothesis node |
maxSubsetSize | data for all subsets of evidence nodes up to this size are computed |
void HAPI::DiscreteNode::computeExplanationData | ( | size_t | state, |
size_t | maxSubsetSize | ||
) |
Compute "normalized likelihoods" for the specified hypothesis and all (nonempty) subsets of evidence nodes up to the specified maximum size.
For each subset of evidence nodes (up to the specified maximum size), the normalized likelihood of the hypothesis is computed. The results of the computations can be accessed using Domain::getExplanation and Domain::getExplanationScore.
state | state of the hypothesis node (this node) |
maxSubsetSize | data for all subsets of evidence nodes up to this size are computed |
void HAPI::DiscreteNode::enterFinding | ( | size_t | state, |
Number | value | ||
) |
This method specifies a finding value for the specified state and all other states are not effected.
state | An integer designating which state to be selected. States are numbered consecutively from 0 and upwards. |
value | A non-negative real number as the finding value. |
Number HAPI::DiscreteNode::getBelief | ( | size_t | state ) | const |
Return the belief of the specified state.
Note that if findings have been entered since the most recent propagation, the beliefs returned may not be up-to-date.
state | An integer value designating which state to examine. |
Number HAPI::DiscreteNode::getEnteredFinding | ( | size_t | state ) | const |
Retrieve the finding currently registered at this node for state.
state | An integer designating the state to be examined. |
Number HAPI::DiscreteNode::getExpectedUtility | ( | size_t | state ) | const |
Return the expected utility associated with the specified state.
state | An integer value designating which state to examine. |
Kind HAPI::DiscreteNode::getKind | ( | ) | const [inline, virtual] |
double HAPI::DiscreteNode::getMutualInformation | ( | const DiscreteNode * | node ) | const |
Compute the mutual information between this node and the specified node.
node | the other node |
size_t HAPI::DiscreteNode::getNumberOfStates | ( | ) | const |
Return the number of states of this node.
The states are numbered from 0 to N-1.
Number HAPI::DiscreteNode::getPredictedBelief | ( | size_t | state, |
size_t | time | ||
) | const |
Return the predicted belief for the specified state of this DiscreteNode at the specified time point.
This method accesses the predictions computed by a previous call to computeDBNPredictions.
state | an integer value representing which state to examine. |
time | time slice index (a nonnegative integer less than the number of predicted time slices) |
Number HAPI::DiscreteNode::getPropagatedFinding | ( | size_t | state ) | const |
Retrieve the propagated finding.
That is, retrieve the finding value incorporated within the current junction tree potentials for the specified state of this node.
state | An integer designating the state to be examined. |
NumberList HAPI::DiscreteNode::getSensitivityConstants | ( | size_t | input, |
size_t | output | ||
) | const |
Return the four constants of the specified sensitivity function.
The output probability of this function must be one of the output probabilities specified in the preceding call to Domain::computeSensitivityData. If the results produced by that call have been invalidated, a usage exception is thrown.
input | specifies a conditional probability (or policy) parameter of this node (i.e., input is the index of an entry in the CPT/policy of this node). |
output | identifies one of the output probabilities specified in the call to Domain::computeSensitivityData. |
NumberList HAPI::DiscreteNode::getSensitivityConstants | ( | size_t | input ) | const |
Return the four constants of the specified sensitivity function.
The output probability of the sensitivity function was specified in the preceding call to DiscreteChanceNode::computeSensitivityData. If the results produced by that call have been invalidated, a usage exception is thrown.
input | specifies a conditional probability (or policy) parameter of this node (i.e., input is the index of an entry in the CPT/policy of this node). |
Index HAPI::DiscreteNode::getStateIndex | ( | const std::string & | label ) | const |
Return the index of the state matching the specified label.
If there is no (unique) state with the specified state label, -1 is returned.
label | the state label to search for |
Index HAPI::DiscreteNode::getStateIndex | ( | const char * | label ) | const |
Return the index of the state matching the specified label.
If there is no (unique) state with the specified state label, -1 is returned.
label | the state label to search for |
std::string HAPI::DiscreteNode::getStateLabel | ( | size_t | state ) | const |
Return the label of state.
0 < state < N, where N is the number of states in the node.
bool HAPI::DiscreteNode::isEvidencePropagated | ( | ) | const |
Test whether evidence has been propagated from this node.
void HAPI::DiscreteNode::retractFindings | ( | ) |
Retract all findings for this node.
This is equivalent to setting the finding value to 1 for all states of this node.
void HAPI::DiscreteNode::selectState | ( | size_t | state ) |
Select the specified state of this node.
This is equivalent to specifying the finding value 1 for the specified state and 0 for all other states.
state | An integer designating which state to be selected. States are numbered consecutively from 0 and upwards. |
void HAPI::DiscreteNode::setCaseState | ( | size_t | index, |
size_t | state | ||
) |
Specify the case state of this node associated with case index to be state.
index | The case index. |
state | The node state. |
void HAPI::DiscreteNode::setNumberOfStates | ( | size_t | states ) |
Set the number of states of this node to states.
The underlying domain will be uncompiled.
void HAPI::DiscreteNode::setStateLabel | ( | size_t | state, |
const char * | label | ||
) |
Set the state label of the node.
state | The state number. |
label | The desired state label. |
void HAPI::DiscreteNode::setStateLabel | ( | size_t | state, |
const std::string & | label | ||
) |
Set the state label of the node.
state | The state number. |
label | The desired state label. |