コード例 #1
0
ファイル: test_shannon.py プロジェクト: psychon7/dit
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)
コード例 #2
0
ファイル: test_shannon.py プロジェクト: psychon7/dit
def test_entropy_pmf1d():
    """ Test the entropy of a fair coin """
    d = [.5, .5]
    assert entropy_pmf(d) == pytest.approx(1.0)
コード例 #3
0
ファイル: test_shannon.py プロジェクト: chebee7i/dit
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)
コード例 #4
0
ファイル: test_shannon.py プロジェクト: liangkai/dit
def test_entropy_pmf1d():
    """ Test the entropy of a fair coin """
    d = [.5, .5]
    assert_almost_equal(entropy_pmf(d), 1.0)
コード例 #5
0
ファイル: test_shannon.py プロジェクト: chebee7i/dit
def test_entropy_pmf1d():
    """ Test the entropy of a fair coin """
    d = [.5, .5]
    assert_almost_equal(entropy_pmf(d), 1.0)