evaluate (interesting that this is not even defined in BayesNet, should move there?)
parent
b819b7c446
commit
8b6c1a0b9d
|
|
@ -36,6 +36,15 @@ namespace gtsam {
|
|||
bayesNet.push_back(boost::make_shared<DiscreteConditional>(s));
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
double evaluate(const DiscreteBayesNet& bn, const DiscreteConditional::Values & values) {
|
||||
// evaluate all conditionals and multiply
|
||||
double result = 1.0;
|
||||
BOOST_FOREACH(DiscreteConditional::shared_ptr conditional, bn)
|
||||
result *= (*conditional)(values);
|
||||
return result;
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
DiscreteFactor::sharedValues optimize(const DiscreteBayesNet& bn) {
|
||||
// solve each node in turn in topological sort order (parents first)
|
||||
|
|
|
|||
|
|
@ -33,7 +33,10 @@ namespace gtsam {
|
|||
/** Add a DiscreteCondtional in front, when listing parents first*/
|
||||
void add_front(DiscreteBayesNet&, const Signature& s);
|
||||
|
||||
/** Optimize function for back-substitution. */
|
||||
//** evaluate for given Values */
|
||||
double evaluate(const DiscreteBayesNet& bn, const DiscreteConditional::Values & values);
|
||||
|
||||
/** Optimize function for back-substitution. */
|
||||
DiscreteFactor::sharedValues optimize(const DiscreteBayesNet& bn);
|
||||
|
||||
/** Do ancestral sampling */
|
||||
|
|
|
|||
Loading…
Reference in New Issue