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