Skip to content
C

Problem 1: Generate a Basic Confusion Matrix

Easypython

Problem Description

Write a Python program that generates and prints a confusion matrix given actual and predicted labels for a binary classification problem.

Input

Two lists: actual labels and predicted labels.

Output

The confusion matrix.

Constraints

  • Both lists have the same length, containing binary values.

Example Input

text
actual=[0,0,1,1,1], predicted=[0,1,1,1,0]

Example Output

text
[[1 1] [1 2]]

Concepts Covered

confusion_matrix().

Input (stdin)

Output

Run your code to see output here...