Exemplo n.º 1
0
    def test_return_values(self):
        out = draw(self.cdf)
        assert_(out in range(self.n))

        size = 10
        out = draw(self.cdf, size)
        assert_(np.isin(out, range(self.n)).all())
Exemplo n.º 2
0
    def test_return_types(self):
        out = draw(self.cdf)
        assert_(isinstance(out, numbers.Integral))

        size = 10
        out = draw(self.cdf, size)
        assert_(out.shape == (size,))
Exemplo n.º 3
0
    def test_return_values(self):
        out = draw(self.cdf)
        ok_(out in range(self.n))

        size = 10
        out = draw(self.cdf, size)
        ok_(np.isin(out, range(self.n)).all())
Exemplo n.º 4
0
    def test_return_types(self):
        out = draw(self.cdf)
        ok_(isinstance(out, numbers.Integral))

        size = 10
        out = draw(self.cdf, size)
        eq_(out.shape, (size,))
Exemplo n.º 5
0
 def test_lln(self):
     size = 1000000
     out = draw(self.cdf, size)
     hist, bin_edges = np.histogram(out, bins=self.n, density=True)
     pmf_computed = hist * np.diff(bin_edges)
     atol = 1e-2
     assert_allclose(pmf_computed, self.pmf, atol=atol)
Exemplo n.º 6
0
 def test_lln(self):
     size = 1000000
     out = draw(self.cdf, size)
     hist, bin_edges = np.histogram(out, bins=self.n, density=True)
     pmf_computed = hist * np.diff(bin_edges)
     atol = 1e-2
     assert_allclose(pmf_computed, self.pmf, atol=atol)