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
def test_ii2(i): """ Test II = -1^n * I for giant bit distributions """ outcomes = ['0'*i, '1'*i] pmf = [1/2, 1/2] d = D(outcomes, pmf) ci = coinformation(d) ii = interaction_information(d) assert ii == pytest.approx((-1)**i * ci)
def test_ii2(): """ Test II = -1^n * I for giant bit distributions """ for i in range(2, 6): outcomes = ['0'*i, '1'*i] pmf = [1/2, 1/2] d = D(outcomes, pmf) ci = coinformation(d) ii = interaction_information(d) yield assert_almost_equal, ii, (-1)**i * ci
def test_markov_chains3(dist): """ Test the markov_chains strategy. """ assert coinformation(dist, [[0], [2]], [1]) == pytest.approx(0.0, abs=1e-7)
def predicate(d): return coinformation(d) <= -1 / 2
def test_gk_pos_i_neg2(): """ Test against known values. """ i = coinformation(gk_pos_i_neg) assert i == pytest.approx(-0.33143555680040304)
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)
def test_stacked2(): """ Test against known values. """ i = coinformation(stacked, [[0], [1]], [2]) assert i == pytest.approx(2/3)
def test_stacked1(): """ Test against known values. """ i = coinformation(stacked) assert i == pytest.approx(1.5849625007211565)
def test_mixed1(): """ Test against known values. """ i = coinformation(mixed) assert i == pytest.approx(0.0)
def test_stacked2(): """ Test against known values. """ i = coinformation(stacked, [[0], [1]], [2]) assert i == pytest.approx(2 / 3)
def test_stacked1(): """ Test against known values. """ i = coinformation(stacked) assert i == pytest.approx(1.5849625007211565)
def test_mixed1(): """ Test against known values. """ i = coinformation(mixed) assert i == pytest.approx(0.0)
def test_gk_pos_i_neg2(): """ Test against known values. """ i = coinformation(gk_pos_i_neg) assert i == pytest.approx(-0.33143555680040304)
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)
def predicate(d): return coinformation(d) <= -1/2