fix testMixtureFactor test

release/4.3a0
Varun Agrawal 2024-08-20 14:19:35 -04:00
parent 654bad7381
commit 6b1d89d0a7
1 changed files with 6 additions and 20 deletions

View File

@ -252,30 +252,16 @@ TEST(MixtureFactor, DifferentCovariances) {
// Check that we get different error values at the MLE point μ.
AlgebraicDecisionTree<Key> errorTree = hbn->errorTree(cv);
auto cond0 = hbn->at(0)->asMixture();
auto cond1 = hbn->at(1)->asMixture();
auto discrete_cond = hbn->at(2)->asDiscrete();
HybridValues hv0(cv, DiscreteValues{{M(1), 0}});
HybridValues hv1(cv, DiscreteValues{{M(1), 1}});
AlgebraicDecisionTree<Key> expectedErrorTree(
m1,
cond0->error(hv0) // cond0(0)->logNormalizationConstant()
// - cond0(1)->logNormalizationConstant
+ cond1->error(hv0) + discrete_cond->error(DiscreteValues{{M(1), 0}}),
cond0->error(hv1) // cond1(0)->logNormalizationConstant()
// - cond1(1)->logNormalizationConstant
+ cond1->error(hv1) +
discrete_cond->error(DiscreteValues{{M(1), 0}}));
auto cond0 = hbn->at(0)->asMixture();
auto cond1 = hbn->at(1)->asMixture();
auto discrete_cond = hbn->at(2)->asDiscrete();
AlgebraicDecisionTree<Key> expectedErrorTree(m1, 9.90348755254,
0.69314718056);
EXPECT(assert_equal(expectedErrorTree, errorTree));
DiscreteValues dv;
dv.insert({M(1), 1});
HybridValues expected_values(cv, dv);
HybridValues actual_values = hbn->optimize();
EXPECT(assert_equal(expected_values, actual_values));
}
/* ************************************************************************* */