Should a confusion matrix be used for supervised or unsupervised learning problems?
Supervised, specifically classification: it compares predicted classes with true labels.
Supervised, specifically classification: it compares predicted classes with true labels.
Card 1 of 276. Answer: Supervised, specifically classification: it compares predicted classes with true labels.
About · Quizzes · History of AI · To suggest new questions or report an error send me a dm.
Supervised learning, specifically classification. A confusion matrix is a table that counts how a classifier's predictions line up with the true labels: one axis is the actual class, the other the predicted class. Building it requires ground-truth labels, which unsupervised problems do not have.
For a binary problem it is a 2 × 2 table. Example: on 100 test cases a model gets 40 true positives, 10 false positives, 5 false negatives and 45 true negatives. Accuracy is 85/100 = 0.85, precision is 40/50 = 0.80 and recall is 40/45 ≈ 0.89. With k classes it becomes a k × k table, and the off-diagonal cells show which classes get mistaken for which.
Watch the layout: scikit-learn puts true labels on rows and predictions on columns, so its binary output is [[TN, FP], [FN, TP]], while some textbooks transpose it. In clustering, cluster IDs are arbitrary, so even when labels exist you compare clusters to them with a contingency table and scores such as the adjusted Rand index.