fix tests
parent
f9e3280d75
commit
3abff90fb4
|
|
@ -81,7 +81,7 @@ TEST(GaussianMixture, GaussianMixtureModel) {
|
||||||
auto eliminationResult =
|
auto eliminationResult =
|
||||||
gmm.toFactorGraph({{Z(0), Vector1(midway)}}).eliminateSequential();
|
gmm.toFactorGraph({{Z(0), Vector1(midway)}}).eliminateSequential();
|
||||||
auto pMid = eliminationResult->at(0)->asDiscrete<TableDistribution>();
|
auto pMid = eliminationResult->at(0)->asDiscrete<TableDistribution>();
|
||||||
EXPECT(assert_equal(TableDistribution(m, "60/40"), *pMid));
|
EXPECT(assert_equal(TableDistribution(m, "60 40"), *pMid));
|
||||||
|
|
||||||
// Everywhere else, the result should be a sigmoid.
|
// Everywhere else, the result should be a sigmoid.
|
||||||
for (const double shift : {-4, -2, 0, 2, 4}) {
|
for (const double shift : {-4, -2, 0, 2, 4}) {
|
||||||
|
|
@ -141,9 +141,8 @@ TEST(GaussianMixture, GaussianMixtureModel2) {
|
||||||
EXPECT(assert_equal(expectedDiscretePosterior,
|
EXPECT(assert_equal(expectedDiscretePosterior,
|
||||||
eliminationResultMax->discretePosterior(vv)));
|
eliminationResultMax->discretePosterior(vv)));
|
||||||
|
|
||||||
auto pMax =
|
auto pMax = *eliminationResultMax->at(0)->asDiscrete<TableDistribution>();
|
||||||
*eliminationResultMax->at(0)->asDiscrete<TableDistribution>();
|
EXPECT(assert_equal(TableDistribution(m, "42 58"), pMax, 1e-4));
|
||||||
EXPECT(assert_equal(TableDistribution(m, "42/58"), pMax, 1e-4));
|
|
||||||
|
|
||||||
// Everywhere else, the result should be a bell curve like function.
|
// Everywhere else, the result should be a bell curve like function.
|
||||||
for (const double shift : {-4, -2, 0, 2, 4}) {
|
for (const double shift : {-4, -2, 0, 2, 4}) {
|
||||||
|
|
|
||||||
|
|
@ -464,7 +464,7 @@ TEST(HybridEstimation, EliminateSequentialRegression) {
|
||||||
|
|
||||||
// Create expected discrete conditional on m0.
|
// Create expected discrete conditional on m0.
|
||||||
DiscreteKey m(M(0), 2);
|
DiscreteKey m(M(0), 2);
|
||||||
TableDistribution expected(m % "0.51341712/1"); // regression
|
TableDistribution expected(m, "0.51341712 1"); // regression
|
||||||
|
|
||||||
// Eliminate into BN using one ordering
|
// Eliminate into BN using one ordering
|
||||||
const Ordering ordering1{X(0), X(1), M(0)};
|
const Ordering ordering1{X(0), X(1), M(0)};
|
||||||
|
|
|
||||||
|
|
@ -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<TableDistribution>(mode, "74/26");
|
expectedBayesNet.emplace_shared<TableDistribution>(mode, "74 26");
|
||||||
|
|
||||||
// Test elimination
|
// Test elimination
|
||||||
const auto posterior = fg.eliminateSequential();
|
const auto posterior = fg.eliminateSequential();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue