コード例 #1
0
ファイル: test_random.py プロジェクト: bhieu79/KC-4.0
 def test_beta(self):
     rnd.seed(self.seed, self.brng)
     actual = rnd.beta(.1, .9, size=(3, 2))
     desired = np.array([[0.9856952034381025, 4.35869375658114e-08],
                         [0.0014230232791189966, 1.4981856288121975e-06],
                         [1.426135763875603e-06, 4.5801786040477326e-07]])
     np.testing.assert_array_almost_equal(actual, desired, decimal=10)
コード例 #2
0
 def test_beta_small_parameters(self):
     # Test that beta with small a and b parameters does not produce
     # NaNs due to roundoff errors causing 0 / 0, gh-5851
     rnd.seed(1234567890)
     x = rnd.beta(0.0001, 0.0001, size=100)
     assert_(not np.any(np.isnan(x)), 'Nans in rnd.beta')