def test_conditional(self): P = JointNormal( mu=[0, 0], labels=['x', 'y'], cov=[ [1, 1], [1, 1.01], ], N=10) mu_x, sigma_x = P.estimate('x', y=9) self.assertAlmostEqual(mu_x, 8.91, places=2) self.assertAlmostEqual(sigma_x, .1, places=1)
def test_marginal(self): P = JointNormal( mu=[-1, 1], labels=['x', 'y'], cov=[ [1, 1], [1, 1.01], ], N=10) mu_x, sigma_x = P.estimate('x') mu_y, sigma_y = P.estimate('y') self.assertAlmostEqual(mu_x, -1) self.assertAlmostEqual(mu_y, 1) self.assertAlmostEqual(sigma_x, 1) self.assertAlmostEqual(sigma_y, 1, places=1)