Use simpler normalization for max-product.
parent
571b0f5e90
commit
9d0be8f2b2
|
@ -121,9 +121,10 @@ namespace gtsam {
|
||||||
for (auto&& factor : factors) product = (*factor) * product;
|
for (auto&& factor : factors) product = (*factor) * product;
|
||||||
gttoc(product);
|
gttoc(product);
|
||||||
|
|
||||||
// Normalize the product factor to prevent underflow
|
// Sum all the potentials by pretending all keys are frontal:
|
||||||
Ordering ordering = Ordering::Colamd(DiscreteFactorGraph{product});
|
auto normalization = product.sum(product.size());
|
||||||
DecisionTreeFactor::shared_ptr normalization = product.sum(ordering);
|
|
||||||
|
// Normalize the product factor to prevent underflow.
|
||||||
product = product / (*normalization);
|
product = product / (*normalization);
|
||||||
|
|
||||||
// max out frontals, this is the factor on the separator
|
// max out frontals, this is the factor on the separator
|
||||||
|
|
Loading…
Reference in New Issue