#include <auxfactor.h>
Inheritance diagram for AuxFactor:
Public Member Functions | |
AuxFactor (Array< Predicate * > *formula) | |
~AuxFactor () | |
double | getProb () |
Computes the probability of this auxiliary factor. | |
Array< Predicate * > * | getFormula () |
Definition at line 75 of file auxfactor.h.
double AuxFactor::getProb | ( | ) | [inline] |
Computes the probability of this auxiliary factor.
This is the product of the probabilities of the attached nodes.
Definition at line 102 of file auxfactor.h.
References Node::getProbs(), Predicate::getSense(), Factor::links_, and Array< Type >::size().
Referenced by BP::infer().
00103 { 00104 Node* node; 00105 double prob = 1.0; 00106 for (int lno = 0; lno < links_->size(); lno++) 00107 { 00108 int predIndex = (*links_)[lno]->getPredIndex(); 00109 node = (*links_)[lno]->getNode(); 00110 double probs[2]; 00111 node->getProbs(probs); 00112 00113 Predicate *pred = (*formula_)[predIndex]; 00114 if (pred->getSense()) prob *= probs[1]; 00115 else prob *= probs[0]; 00116 } 00117 return prob; 00118 }