def test_caekl_2(d): """ Ensure that it reduces to the mutual information for bivariate distributions reduced from multivariate. """ rvs = [[0], [1]] assert I(d, rvs) == pytest.approx(J(d, rvs))
def test_mis1(d): """ Test that all the mutual informations match for bivariate distributions. """ i = I(d) t = T(d) b = B(d) j = J(d) ii = II(d) assert i == pytest.approx(t) assert t == pytest.approx(b) assert b == pytest.approx(j) assert j == pytest.approx(ii)
def test_cis2(dist): """ Test that the common informations are ordered correctly. """ k = K(dist) j = J(dist) b = B(dist) c = C(dist) g = G(dist) f = F(dist) m = M(dist) assert k <= j + epsilon assert j <= b + epsilon assert b <= c + epsilon assert c <= g + epsilon assert g <= f + epsilon assert f <= m + epsilon
def test_caekl_4(d): """ Test that CAEKL is always less than or equal to the normalized total correlation. """ assert J(d) <= (T(d) / 3) + 1e-6
def test_caekl_3(): """ Test a known value. """ d = D(['000', '011', '101', '110'], [1 / 4] * 4) assert J(d) == pytest.approx(0.5)
def test_caekl_1(d): """ Ensure that it reduces to the mutual information for bivariate distributions. """ assert I(d) == pytest.approx(J(d))