예제 #1
0
파일: test_kappa.py 프로젝트: 9G1IC/Metrics
 def test_confusion_matrix(self):
     conf_mat = metrics.confusion_matrix([1,2],[1,2])
     self.assertEqual(conf_mat,[[1,0],[0,1]])
     
     conf_mat = metrics.confusion_matrix([1,2],[1,2],0,2)
     self.assertEqual(conf_mat,[[0,0,0],[0,1,0],[0,0,1]])
     
     conf_mat = metrics.confusion_matrix([1,1,2,2,4],[1,1,3,3,5])
     self.assertEqual(conf_mat,[[2,0,0,0,0],[0,0,2,0,0],[0,0,0,0,0],
                                [0,0,0,0,1],[0,0,0,0,0]])
     
     conf_mat = metrics.confusion_matrix([1,2],[1,2],1,4)
     self.assertEqual(conf_mat,[[1,0,0,0],[0,1,0,0],[0,0,0,0],[0,0,0,0]])
예제 #2
0
    def test_confusion_matrix(self):
        conf_mat = metrics.confusion_matrix([1, 2], [1, 2])
        self.assertEqual(conf_mat, [[1, 0], [0, 1]])

        conf_mat = metrics.confusion_matrix([1, 2], [1, 2], 0, 2)
        self.assertEqual(conf_mat, [[0, 0, 0], [0, 1, 0], [0, 0, 1]])

        conf_mat = metrics.confusion_matrix([1, 1, 2, 2, 4], [1, 1, 3, 3, 5])
        self.assertEqual(conf_mat,
                         [[2, 0, 0, 0, 0], [0, 0, 2, 0, 0], [0, 0, 0, 0, 0],
                          [0, 0, 0, 0, 1], [0, 0, 0, 0, 0]])

        conf_mat = metrics.confusion_matrix([1, 2], [1, 2], 1, 4)
        self.assertEqual(
            conf_mat, [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]])
예제 #3
0
 def confusion_matrix(self, labels, predicts):
     return metrics.confusion_matrix(labels, predicts)