def test_cause_info(s):
    mechanism = (s.nodes[0], s.nodes[1])
    purview = (s.nodes[0], s.nodes[2])
    answer = hamming_emd(
        s.cause_repertoire(mechanism, purview),
        s.unconstrained_cause_repertoire(purview))
    assert s.cause_info(mechanism, purview) == answer
def test_effect_info(s):
    mechanism = (0, 1)
    purview = (0, 2)
    answer = hamming_emd(
        s.effect_repertoire(mechanism, purview),
        s.unconstrained_effect_repertoire(purview))
    assert s.effect_info(mechanism, purview) == answer
Пример #3
0
def test_emd_same_distributions():
    a = np.ones((2, 2, 2)) / 8
    b = np.ones((2, 2, 2)) / 8
    assert utils.hamming_emd(a, b) == 0.0
Пример #4
0
def test_emd_same_distributions():
    a = np.ones((2, 2, 2)) / 8
    b = np.ones((2, 2, 2)) / 8
    assert utils.hamming_emd(a, b) == 0.0