Esempio n. 1
0
    def inf_theory_test_4(self):
        """
        KLD(Q1 | P1)
        """

        res = [kullbackLeiblerDistance(self.Q1, self.P1),
               kullbackLeiblerDistance(self.Q1, self.P1, 10),
               kullbackLeiblerDistance(self.Q1, self.P1, math.e)]

        assert_almost_equal(res[0], 0.53100, places=5)
        assert_almost_equal(res[1], 0.15985, places=5)
        assert_almost_equal(res[2], 0.36806, places=5)
Esempio n. 2
0
    def inf_theory_test_3(self):
        """
        KLD(P2 | Q2)
        """

        res = [kullbackLeiblerDistance(self.P2, self.Q2),
               kullbackLeiblerDistance(self.P2, self.Q2, 10),
               kullbackLeiblerDistance(self.P2, self.Q2, math.e)]

        assert_almost_equal(res[0], 0.32193, places=4)
        assert_almost_equal(res[1], 0.09691, places=4)
        assert_almost_equal(res[2], 0.22314, places=4)
Esempio n. 3
0
    def inf_theory_test_2(self):
        """
        KLD(P1 | Q1)
        """

        res = [kullbackLeiblerDistance(self.P1, self.Q1),
               kullbackLeiblerDistance(self.P1, self.Q1, 10),
               kullbackLeiblerDistance(self.P1, self.Q1, math.e)]

        assert_almost_equal(res[0], 0.73697, places=4)
        assert_almost_equal(res[1], 0.22185, places=4)
        assert_almost_equal(res[2], 0.51083, places=4)
Esempio n. 4
0
    def inf_theory_test_5(self):
        """
        KLD(Q2 | P2)
        """

        res = [kullbackLeiblerDistance(self.Q2, self.P2),
               kullbackLeiblerDistance(self.Q2, self.P2, 10),
               kullbackLeiblerDistance(self.Q2, self.P2, math.e)]

        assert_almost_equal(res[0], 2.4527, places=4)
        assert_almost_equal(res[1], 0.73834, places=5)
        assert_almost_equal(res[2], 1.7001, places=4)
Esempio n. 5
0
    def inf_theory_test_4(self):
        """
        KLD(Q1 | P1)
        """

        res = [
            kullbackLeiblerDistance(self.Q1, self.P1),
            kullbackLeiblerDistance(self.Q1, self.P1, 10),
            kullbackLeiblerDistance(self.Q1, self.P1, math.e)
        ]

        assert_almost_equal(res[0], 0.53100, places=5)
        assert_almost_equal(res[1], 0.15985, places=5)
        assert_almost_equal(res[2], 0.36806, places=5)
Esempio n. 6
0
    def inf_theory_test_3(self):
        """
        KLD(P2 | Q2)
        """

        res = [
            kullbackLeiblerDistance(self.P2, self.Q2),
            kullbackLeiblerDistance(self.P2, self.Q2, 10),
            kullbackLeiblerDistance(self.P2, self.Q2, math.e)
        ]

        assert_almost_equal(res[0], 0.32193, places=4)
        assert_almost_equal(res[1], 0.09691, places=4)
        assert_almost_equal(res[2], 0.22314, places=4)
Esempio n. 7
0
    def inf_theory_test_2(self):
        """
        KLD(P1 | Q1)
        """

        res = [
            kullbackLeiblerDistance(self.P1, self.Q1),
            kullbackLeiblerDistance(self.P1, self.Q1, 10),
            kullbackLeiblerDistance(self.P1, self.Q1, math.e)
        ]

        assert_almost_equal(res[0], 0.73697, places=4)
        assert_almost_equal(res[1], 0.22185, places=4)
        assert_almost_equal(res[2], 0.51083, places=4)
Esempio n. 8
0
    def inf_theory_test_5(self):
        """
        KLD(Q2 | P2)
        """

        res = [
            kullbackLeiblerDistance(self.Q2, self.P2),
            kullbackLeiblerDistance(self.Q2, self.P2, 10),
            kullbackLeiblerDistance(self.Q2, self.P2, math.e)
        ]

        assert_almost_equal(res[0], 2.4527, places=4)
        assert_almost_equal(res[1], 0.73834, places=5)
        assert_almost_equal(res[2], 1.7001, places=4)