def test_mean1(): """ Test mean on binomial distribution """ ns = range(2, 10) ps = np.linspace(0, 1, 11) for n, p in product(ns, ps): d = binomial(n, p) yield assert_almost_equal, mean(d), n*p
def test_mean2(): """ Test mean on a generic distribution """ d = D([(0, 0), (1, 0), (2, 1), (3, 1)], [1 / 8, 1 / 8, 3 / 8, 3 / 8]) assert np.allclose(mean(d), [2, 3 / 4])
def test_mean1(n, p): """ Test mean on binomial distribution """ d = binomial(n, p) assert mean(d) == pytest.approx(n * p)
def test_mean2(): d = D([(0, 0), (1, 0), (2, 1), (3, 1)], [1/8, 1/8, 3/8, 3/8]) assert_array_almost_equal(mean(d), [2, 3/4])
def test_mean1(): ns = range(2, 10) ps = np.linspace(0, 1, 11) for n, p in product(ns, ps): d = binomial(n, p) assert_almost_equal(mean(d), n*p)
def test_mean2(): """ Test mean on a generic distribution """ d = D([(0, 0), (1, 0), (2, 1), (3, 1)], [1/8, 1/8, 3/8, 3/8]) assert np.allclose(mean(d), [2, 3/4])
def test_mean1(n, p): """ Test mean on binomial distribution """ d = binomial(n, p) assert mean(d) == pytest.approx(n*p)
def test_mean2(): """ Test mean on a generic distribution """ d = D([(0, 0), (1, 0), (2, 1), (3, 1)], [1/8, 1/8, 3/8, 3/8]) assert_array_almost_equal(mean(d), [2, 3/4])