The building block of all classification metrics.
- **TP** (True Positive): predicted 1, actually 1
- **FP** (False Positive): predicted 1, actually 0
- **FN** (False Negative): predicted 0, actually 1
- **TN** (True Negative): predicted 0, actually 0
confusion_matrix([1,0,1,1,0,1],[1,0,0,1,1,1])
→ {'TP': 3, 'FP': 1, 'FN': 1, 'TN': 1}Similar Problems
Test Cases (2 visible · 1 hidden)
Case 1: Mixed predictions
Input: confusion_matrix([1,0,1,1,0,1],[1,0,0,1,1,1])
Expected: {'TP': 3, 'FP': 1, 'FN': 1, 'TN': 1}
Case 2: All positive, perfect
Input: confusion_matrix([1,1,1],[1,1,1])
Expected: {'TP': 3, 'FP': 0, 'FN': 0, 'TN': 0}
⌘↵ Run · ⌘⇧↵ Submit