def test_pid_wb3(): """ Test imin on a generic distribution. """ d = bivariates['jeff'] pid = PID_WB(d) assert pid.complete assert pid.nonnegative assert pid.consistent
def test_pid_wb1(): """ Test imin on a generic distribution. """ d = bivariates['prob. 1'] pid = PID_WB(d, ((0, ), (1, )), (2, )) assert pid[((0, ), (1, ))] == pytest.approx(0.019973094021974794) assert pid[((0, ), )] == pytest.approx(0.15097750043269376) assert pid[((1, ), )] == pytest.approx(0.0) assert pid[((0, 1), )] == pytest.approx(0.0)
def test_pid_wb2(): """ Test imin on another generic distribution. """ d = trivariates['sum'] pid = PID_WB(d, [[0], [1], [2]], [3]) for atom in pid._lattice: if atom == ((0, ), (1, ), (2, )): assert pid[atom] == pytest.approx(0.31127812445913294) elif atom == ((0, 1), (0, 2), (1, 2)): assert pid[atom] == pytest.approx(0.5) elif atom == ((0, 1, 2), ): assert pid[atom] == pytest.approx(1.0) else: assert pid[atom] == pytest.approx(0.0)
rcyBROJA = PID_BROJA(dist1, [[0], [1]], [2]) print(" ") print(" The I_broja PID is plotted in Fig. 6 ") print(rcyBROJA) print(" ") rcyCCS = PID_CCS(dist1, [[0], [1]], [2]) print(rcyCCS) rcyDEP = PID_dep(dist1, [[0], [1]], [2]) print(rcyDEP) rcyWB = PID_WB(dist1, [[0], [1]], [2]) print(rcyWB) rcyPROJ = PID_Proj(dist1, [[0], [1]], [2]) print(rcyPROJ) print(" ") # Computation of the entropies H_OBA = entropy(dist1) H_B = entropy(dist1, [0]) H_A = entropy(dist1, [1]) H_O = entropy(dist1, [2])