예제 #1
0
 def setUp(self):
     self.data = BinaryClassifierData([\
         (0.1, 0),
         (0.2, 0),
         (0.3, 0),
         (0.4, 1),
         (0.5, 0),
         (0.6, 1),
         (0.7, 1),
         (0.8, 1),
         (0.9, 1)
     ])
     self.curve = ROCCurve(self.data)
예제 #2
0
class ROCCurveTest(unittest.TestCase):
    def setUp(self):
        self.data = BinaryClassifierData([\
            (0.1, 0),
            (0.2, 0),
            (0.3, 0),
            (0.4, 1),
            (0.5, 0),
            (0.6, 1),
            (0.7, 1),
            (0.8, 1),
            (0.9, 1)
        ])
        self.curve = ROCCurve(self.data)

    def test_auc_superclass(self):
        self.assertAlmostEqual(0.95, Curve.auc(self.curve), 8)

    def test_auc(self):
        self.assertAlmostEqual(0.95, self.curve.auc(), 8)

    def test_get_points(self):
        expected = reversed([(1.0, 1.0), (0.75, 1.0), (0.5, 1.0), (0.25, 1.0), \
                (0.25, 0.8), (0.0, 0.8), (0.0, 0.6), (0.0, 0.4), \
                (0.0, 0.2), (0.0, 0.0)])
        for obs, exp in zip(self.curve.points, expected):
            for x, y in zip(obs, exp):
                self.assertAlmostEqual(x, y, 5)
예제 #3
0
파일: test_curve.py 프로젝트: ashish01/yard
class ROCCurveTest(unittest.TestCase):
    def setUp(self):
        self.data = BinaryClassifierData([\
            (0.1, 0),
            (0.2, 0),
            (0.3, 0),
            (0.4, 1),
            (0.5, 0),
            (0.6, 1),
            (0.7, 1),
            (0.8, 1),
            (0.9, 1)
        ])
        self.curve = ROCCurve(self.data)

    def test_auc_superclass(self):
        self.assertAlmostEquals(0.95, Curve.auc(self.curve), 8)

    def test_auc(self):
        self.assertAlmostEquals(0.95, self.curve.auc(), 8)

    def test_get_points(self):
        expected = reversed([(1.0, 1.0), (0.75, 1.0), (0.5, 1.0), (0.25, 1.0), \
                (0.25, 0.8), (0.0, 0.8), (0.0, 0.6), (0.0, 0.4), \
                (0.0, 0.2), (0.0, 0.0)])
        for obs, exp in zip(self.curve.points, expected):
            for x, y in zip(obs, exp):
                self.assertAlmostEquals(x, y, 5)
예제 #4
0
파일: test_curve.py 프로젝트: ashish01/yard
 def setUp(self):
     self.data = BinaryClassifierData([\
         (0.1, 0),
         (0.2, 0),
         (0.3, 0),
         (0.4, 1),
         (0.5, 0),
         (0.6, 1),
         (0.7, 1),
         (0.8, 1),
         (0.9, 1)
     ])
     self.curve = ROCCurve(self.data)