fixed maxProduct
parent
2a5833bf6a
commit
6f19ffd966
|
|
@ -131,6 +131,7 @@ DiscreteValues HybridBayesNet::discreteMaxProduct(
|
|||
for (TableFactor::SparseIt it(sparseTable); it; ++it) {
|
||||
if (it.value() > maxValue) {
|
||||
maxIdx = it.index();
|
||||
maxValue = it.value();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -210,8 +211,6 @@ AlgebraicDecisionTree<Key> HybridBayesNet::errorTree(
|
|||
|
||||
// Iterate over each conditional.
|
||||
for (auto &&conditional : *this) {
|
||||
conditional->print();
|
||||
conditional->errorTree(continuousValues).print("errorTre", DefaultKeyFormatter);
|
||||
result = result + conditional->errorTree(continuousValues);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -650,7 +650,7 @@ TEST(HybridGaussianFactorGraph, EliminateTiny1) {
|
|||
mode, std::vector{conditional0, conditional1});
|
||||
|
||||
// Add prior on mode.
|
||||
expectedBayesNet.emplace_shared<DiscreteConditional>(mode, "74/26");
|
||||
expectedBayesNet.emplace_shared<DiscreteTableConditional>(mode, "74/26");
|
||||
|
||||
// Test elimination
|
||||
const auto posterior = fg.eliminateSequential();
|
||||
|
|
@ -700,11 +700,12 @@ TEST(HybridGaussianFactorGraph, EliminateTiny1Swapped) {
|
|||
m1, std::vector{conditional0, conditional1});
|
||||
|
||||
// Add prior on m1.
|
||||
expectedBayesNet.emplace_shared<DiscreteConditional>(m1, "1/1");
|
||||
expectedBayesNet.emplace_shared<DiscreteTableConditional>(
|
||||
m1, "0.188638/0.811362");
|
||||
|
||||
// Test elimination
|
||||
const auto posterior = fg.eliminateSequential();
|
||||
// EXPECT(assert_equal(expectedBayesNet, *posterior, 0.01));
|
||||
EXPECT(assert_equal(expectedBayesNet, *posterior, 0.01));
|
||||
|
||||
EXPECT(ratioTest(bn, measurements, *posterior));
|
||||
|
||||
|
|
@ -736,7 +737,7 @@ TEST(HybridGaussianFactorGraph, EliminateTiny2) {
|
|||
mode, std::vector{conditional0, conditional1});
|
||||
|
||||
// Add prior on mode.
|
||||
expectedBayesNet.emplace_shared<DiscreteConditional>(mode, "23/77");
|
||||
expectedBayesNet.emplace_shared<DiscreteTableConditional>(mode, "23/77");
|
||||
|
||||
// Test elimination
|
||||
const auto posterior = fg.eliminateSequential();
|
||||
|
|
|
|||
Loading…
Reference in New Issue