Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def __confusion_matrix(self, length, labels, prediction):
- TP = 0
- FP = 0
- FN = 0
- correct_preds = []
- for pred in prediction:
- if pred in labels:
- TP += 1
- correct_preds.append(pred)
- else:
- FP += 1
- for label in labels:
- if label not in prediction:
- FN += 1
- TN = length - TP - FP - FN
- return FN, FP, TP, TN, correct_preds
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement