From 64831300a551902bd52694345a8e29c48cf694fb Mon Sep 17 00:00:00 2001 From: Frank Dellaert Date: Sun, 1 Jan 2023 11:48:08 -0500 Subject: [PATCH] Print estimated marginals and ratios! --- python/gtsam/tests/test_HybridFactorGraph.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/python/gtsam/tests/test_HybridFactorGraph.py b/python/gtsam/tests/test_HybridFactorGraph.py index 700137d21..ca051978b 100644 --- a/python/gtsam/tests/test_HybridFactorGraph.py +++ b/python/gtsam/tests/test_HybridFactorGraph.py @@ -205,9 +205,9 @@ class TestHybridGaussianFactorGraph(GtsamTestCase): # Estimate marginals using importance sampling. marginals = self.estimate_marginals(bayesNet, sample) - # print(f"True mode: {sample.atDiscrete(M(0))}") - # print(f"P(mode=0; z0, z1) = {marginals[0]}") - # print(f"P(mode=1; z0, z1) = {marginals[1]}") + print(f"True mode: {sample.atDiscrete(M(0))}") + print(f"P(mode=0; z0, z1) = {marginals[0]}") + print(f"P(mode=1; z0, z1) = {marginals[1]}") # Check marginals based on sampled mode. if sample.atDiscrete(M(0)) == 0: @@ -251,8 +251,8 @@ class TestHybridGaussianFactorGraph(GtsamTestCase): other.insert(measurements) ratio = self.calculate_ratio(posterior, fg, other) print(f"Ratio: {ratio}\n") - # if (ratio > 0): - # self.assertAlmostEqual(ratio, expected_ratio) + if (ratio > 0): + self.assertAlmostEqual(ratio, expected_ratio) if __name__ == "__main__": unittest.main()