def test_LMPR_complexity1(): """ Test LMPR complexity of known examples. """ c1 = LMPR_complexity(d1) c2 = LMPR_complexity(d2) assert c1 == pytest.approx(0.28945986160258008) assert c2 == pytest.approx(0.28945986160258008) assert c1 == pytest.approx(c2)
def test_LMPR_complexity5(n): """ Test that peaked Distributions have zero complexity. """ d = ScalarDistribution([1] + [0] * (n - 1)) d.make_dense() d = Distribution.from_distribution(d) assert LMPR_complexity(d) == pytest.approx(0)
def test_LMPR_complexity3(n): """ Test that uniform Distirbutions have zero complexity. """ d = Distribution.from_distribution(uniform(n)) assert LMPR_complexity(d) == pytest.approx(0)
def test_LMPR_complexity2(n): """ Test that uniform ScalarDistirbutions have zero complexity. """ d = uniform(n) assert LMPR_complexity(d) == pytest.approx(0)
def test_LMPR_complexity4(n): """ Test that peaked ScalarDistributions have zero complexity. """ d = ScalarDistribution([1] + [0] * (n - 1)) assert LMPR_complexity(d) == pytest.approx(0)