MCPcopy Create free account
hub / github.com/clips/pattern / test_confustion_matrix

Method test_confustion_matrix

test/test_metrics.py:31–38  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

29 print "pattern.metrics.duration()"
30
31 def test_confustion_matrix(self):
32 # Assert 2 true positives (TP) and 1 false positive (FP).
33 v = metrics.confusion_matrix(lambda document: True, self.documents)
34 self.assertEqual(v, (2,0,1,0))
35 # Assert 1 true negative (TN) and 2 false negatives (FN).
36 v = metrics.confusion_matrix(lambda document: False, self.documents)
37 self.assertEqual(v, (0,1,0,2))
38 print "pattern.metrics.confusion_matrix()"
39
40 def test_accuracy(self):
41 # Assert 2.0/3.0 (two out of three correct predictions).

Callers

nothing calls this directly

Calls 1

confusion_matrixMethod · 0.80

Tested by

no test coverage detected