Example #1
0
    def test_get_matrix_data(self):
        condensed_matrix = CondensedMatrix([
            1.0, 4.5, 7.2, 3.3, 6.8, 6.1, 8.5, 4.5, 4.6, 9.0, 1.0, 7.8, 1.0,
            0.0, 6.5, 9.6, 2.9, 2.2, 4.4, 7.1, 8.0
        ])

        numpy.testing.assert_almost_equal(KullbackLeiblerDivergence.get_matrix_data(condensed_matrix, 0, 5),\
                                          [ 1., 4.5, 7.2, 3.3, 8.5, 4.5, 4.6, 7.8, 1., 9.6],\
                                          5)

        numpy.testing.assert_almost_equal(KullbackLeiblerDivergence.get_matrix_data(condensed_matrix, 4, 3),\
                                          [4.4, 7.1,  8.],\
                                          5)
Example #2
0
 def test_get_matrix_data(self):
     condensed_matrix = CondensedMatrix([1.0, 4.5, 7.2, 3.3, 6.8, 6.1, 
                                              8.5, 4.5, 4.6, 9.0, 1.0,
                                                   7.8, 1.0, 0.0, 6.5,
                                                        9.6, 2.9, 2.2,
                                                             4.4, 7.1,
                                                                  8.0])
     
     numpy.testing.assert_almost_equal(KullbackLeiblerDivergence.get_matrix_data(condensed_matrix, 0, 5),\
                                       [ 1., 4.5, 7.2, 3.3, 8.5, 4.5, 4.6, 7.8, 1., 9.6],\
                                       5)
      
     numpy.testing.assert_almost_equal(KullbackLeiblerDivergence.get_matrix_data(condensed_matrix, 4, 3),\
                                       [4.4, 7.1,  8.],\
                                       5)