def test_precision(self): # Returns 2.0/3.0 (2 TP, 1 FP). v = metrics.precision(lambda document: True, self.documents) self.assertEqual(v, 2.0/3.0) # Returns 0.0 (no TP). v = metrics.precision(lambda document: False, self.documents) self.assertEqual(v, 0.0)
def test_precision(self): # Assert 2.0/3.0 (2 TP, 1 FP). v = metrics.precision(lambda document: True, self.documents) self.assertEqual(v, 2.0/3.0) # Assert 0.0 (no TP). v = metrics.precision(lambda document: False, self.documents) self.assertEqual(v, 0.0) print("pattern.metrics.precision()")
def test_precision(self): # Assert 2.0/3.0 (2 TP, 1 FP). v = metrics.precision(lambda document: True, self.documents) self.assertEqual(v, 2.0 / 3.0) # Assert 0.0 (no TP). v = metrics.precision(lambda document: False, self.documents) self.assertEqual(v, 0.0) print("pattern.metrics.precision()")