2 GTSAM Copyright 2010-2019, Georgia Tech Research Corporation,
3 Atlanta, Georgia 30332-0415
6 See LICENSE for the license information
8 Unit tests for Gaussian Bayes Nets.
19 from gtsam
import GaussianBayesNet, GaussianConditional
28 """Create a small Bayes Net for testing"""
30 I_1x1 = np.eye(1, dtype=float)
37 """Tests for Gaussian Bayes nets."""
40 """Test matrix method"""
42 R1 = np.array([[1.0, 1.0], [0.0, 1.0]])
43 d1 = np.array([9.0, 5.0])
44 np.testing.assert_equal(R, R1)
45 np.testing.assert_equal(d, d1)
48 """Test evaluate method"""
51 values.insert(_x_, np.array([9.0]))
52 values.insert(_y_, np.array([5.0]))
54 self.assertAlmostEqual(bayesNet.at(i).logProbability(values),
55 np.log(bayesNet.at(i).evaluate(values)))
56 self.assertAlmostEqual(bayesNet.logProbability(values),
57 np.log(bayesNet.evaluate(values)))
60 """Test sample method"""
62 sample = bayesNet.sample()
66 mean = bayesNet.optimize()
70 if __name__ ==
"__main__":