dists = distribution_structures(size=3, alphabet=2, uniform=False) example = find(dists, predicate) assert coinformation(example) <= -1 / 2 @pytest.mark.flaky(reruns=5) def test_distribution_structures6(): """ A test for the distribution_structures strategy. """ dists = distribution_structures(size=3, alphabet=2, uniform=True) example = find(dists, predicate) assert coinformation(example) <= -1 / 2 @given(dist=markov_chains(alphabets=3)) def test_markov_chains1(dist): """ Test the markov_chains strategy. """ assert coinformation(dist, [[0], [2]], [1]) == pytest.approx(0.0, abs=1e-7) @given(dist=markov_chains(alphabets=(2, 2, 2))) def test_markov_chains2(dist): """ Test the markov_chains strategy. """ assert coinformation(dist, [[0], [2]], [1]) == pytest.approx(0.0, abs=1e-7)
@given(dist=distributions(alphabets=((2, 4), ) * 4)) def test_zhang_yeung_inequality(dist): """ 2I(C:D) <= I(A:B)+I(A:CD)+3I(C:D|A)+I(C:D|B) """ I_a_b = I(dist, [[0], [1]]) I_c_d = I(dist, [[2], [3]]) I_a_cd = I(dist, [[0], [2, 3]]) I_c_d_g_a = I(dist, [[2], [3]], [0]) I_c_d_g_b = I(dist, [[2], [3]], [1]) assert 2 * I_c_d <= I_a_b + I_a_cd + 3 * I_c_d_g_a + I_c_d_g_b + epsilon @given(dist=markov_chains(alphabets=((2, 4), ) * 3)) def test_data_processing_inequality(dist): """ given X - Y - Z: I(X:Z) <= I(X:Y) """ i_xy = I(dist, [[0], [1]]) i_xz = I(dist, [[0], [2]]) assert i_xz <= i_xy + epsilon @given(dist=markov_chains(alphabets=((2, 4), ) * 3)) def test_data_processing_inequality_mc(dist): """ given X - Y - Z: rho(X:Z) <= rho(X:Y)
@given(dist=distributions(alphabets=((2, 4),)*4)) def test_zhang_yeung_inequality(dist): """ 2I(C:D) <= I(A:B)+I(A:CD)+3I(C:D|A)+I(C:D|B) """ I_a_b = I(dist, [[0], [1]]) I_c_d = I(dist, [[2], [3]]) I_a_cd = I(dist, [[0], [2, 3]]) I_c_d_g_a = I(dist, [[2], [3]], [0]) I_c_d_g_b = I(dist, [[2], [3]], [1]) assert 2*I_c_d <= I_a_b + I_a_cd + 3*I_c_d_g_a + I_c_d_g_b + epsilon @given(dist=markov_chains(alphabets=((2, 4),)*3)) def test_data_processing_inequality(dist): """ given X - Y - Z: I(X:Z) <= I(X:Y) """ i_xy = I(dist, [[0], [1]]) i_xz = I(dist, [[0], [2]]) assert i_xz <= i_xy + epsilon @given(dist=markov_chains(alphabets=((2, 4),)*3)) def test_data_processing_inequality_mc(dist): """ given X - Y - Z: rho(X:Z) <= rho(X:Y)
def test_markov_chains1(): """ Test the markov_chains strategy. """ dist = markov_chains(alphabets=3).example() assert coinformation(dist, [[0], [2]], [1]) == pytest.approx(0.0, abs=1e-7)