def test_entropy(): a, b = make_variables("A B", 2) c, d = make_variables("C D", 4) j = UniformDist(a, b, c, d) assert j.entropy(a) == 1 assert j.entropy(c) == 2 assert j.entropy([a, b]) == j.entropy(a, b)
def test_uniform(): a, b = make_variables("A B", 4) c = Variable("C", 2) j = UniformDist(a, b, c) assert j.probabilities.size == 4 * 4 * 2 assert j.entropy(a) == 2.0 assert j.entropy(b) == 2.0 assert j.entropy(c) == 1.0