def test_entropy_pmf2d(): """ Test the entropy of a fair coin """ d = np.array([[1, 0], [.5, .5]]) H = np.array([0, 1]) assert np.allclose(entropy_pmf(d), H)
def test_entropy_pmf1d(): """ Test the entropy of a fair coin """ d = [.5, .5] assert entropy_pmf(d) == pytest.approx(1.0)
def test_entropy_pmf2d(): """ Test the entropy of a fair coin """ d = np.array([[1,0],[.5, .5]]) H = np.array([0, 1]) np.testing.assert_allclose(entropy_pmf(d), H)
def test_entropy_pmf1d(): """ Test the entropy of a fair coin """ d = [.5, .5] assert_almost_equal(entropy_pmf(d), 1.0)