def testAUCMetric(self): m = metrics.AUCMetric() m.Update(label=[1, 1], prob=[0.1, 0.2], weight=[1.0, 1.0]) # No meaningful AUC yet, since all(labels==1) and function needs 2 types of # labels. self.assertEqual(0.0, m.value) m.Update(label=[0, 0], prob=[0.1, 0.2], weight=[1.0, 1.0]) self.assertEqual(0.5, m.value)
def testAUCMetric(self): if not metrics.HAS_SKLEARN: self.skipTest('sklearn is not installed.') m = metrics.AUCMetric() m.Update(label=[1, 1], prob=[0.1, 0.2], weight=[1.0, 1.0]) # No meaningful AUC yet, since all(labels==1) and function needs 2 types of # labels. self.assertEqual(0.0, m.value) m.Update(label=[0, 0], prob=[0.1, 0.2], weight=[1.0, 1.0]) self.assertEqual(0.5, m.value)