def inf_theory_test_1(self): """ H(X, Y) """ assert_almost_equal(entropy(self.fXY1), 2.0, places=1) assert_almost_equal(entropy(self.fXY1, 10), 0.60206, places=5) assert_almost_equal(entropy(self.fXY1, math.e), 1.3863, places=4) assert_almost_equal(entropy(self.fXY2), 1.8464, places=4) assert_almost_equal(entropy(self.fXY2, 10), 0.55583, places=5) assert_almost_equal(entropy(self.fXY2, math.e), 1.2799, places=4) assert_almost_equal(entropy(self.fXY3), 1.8464, places=4) assert_almost_equal(entropy(self.fXY3, 10), 0.55583, places=5) assert_almost_equal(entropy(self.fXY3, math.e), 1.2799, places=4)
def inf_theory_test_0(self): """ H(X) """ assert_almost_equal(entropy(self.fX1), 1.0, places=1) assert_almost_equal(entropy(self.fX1, 10), 0.30103, places=5) assert_almost_equal(entropy(self.fX1, math.e), 0.69315, places=5) assert_almost_equal(entropy(self.fX2), 0.0, places=1) assert_almost_equal(entropy(self.fX2, 10), 0.0, places=1) assert_almost_equal(entropy(self.fX2, math.e), 0.0, places=1) assert_almost_equal(entropy(self.fX3), 0.0, places=1) assert_almost_equal(entropy(self.fX3, 10), 0.0, places=1) assert_almost_equal(entropy(self.fX3, math.e), 0.0, places=1)