Explore Library
Code QuizIntermediate

Reading a Confusion Matrix Layout

Detect the indexing mistake when extracting TP/FP/FN/TN.

Codejavascript
// rows = actual, cols = predicted (0 = negative, 1 = positive)
const cm = [
  [85, 10],  // actual negative: [pred neg, pred pos]
  [ 5, 100]  // actual positive: [pred neg, pred pos]
];

const TP = cm[0][0];
const FP = cm[1][0];
const FN = cm[0][1];
const TN = cm[1][1];

What is the bug in how the values are extracted?