Advertisement
Guest User

Untitled

a guest
Mar 20th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. def __confusion_matrix(self, length, labels, prediction):
  2. TP = 0
  3. FP = 0
  4. FN = 0
  5. correct_preds = []
  6. for pred in prediction:
  7. if pred in labels:
  8. TP += 1
  9. correct_preds.append(pred)
  10. else:
  11. FP += 1
  12. for label in labels:
  13. if label not in prediction:
  14. FN += 1
  15. TN = length - TP - FP - FN
  16. return FN, FP, TP, TN, correct_preds
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement