Exemplo n.º 1
0
 def test_lnprob(self):
     mean, sd = np.random.rand(2)
     g = Gaussian(mean, sd)
     bg = BoundedGaussian(mean, sd, -1, 2)
     self.assertEqual(bg.lnprob(1), g.lnprob(1))
     self.assertEqual(bg.lnprob(-1), g.lnprob(-1))
     self.assertEqual(bg.lnprob(2), g.lnprob(2))
     self.assertEqual(bg.lnprob(-2), -np.inf)
     self.assertEqual(bg.lnprob(3), -np.inf)
Exemplo n.º 2
0
def test_gaussian():
    g = Gaussian(1, 1)
    assert_equal(g.guess, 1)
    assert_obj_close(g.lnprob(0), gold_sigma)
Exemplo n.º 3
0
 def test_lnprob(self):
     g = Gaussian(0, 1)
     self.assertTrue(np.allclose(g.lnprob(1), GOLD_SIGMA))
     g = Gaussian(0, 2)
     self.assertTrue(np.allclose(g.lnprob(2), GOLD_SIGMA - np.log(2)))
Exemplo n.º 4
0
def test_gaussian():
    g = Gaussian(1, 1)
    assert_equal(g.guess, 1)
    assert_obj_close(g.lnprob(0),gold_sigma)