Skip to content
CampusEduX

Problem 2: Visualize a Confusion Matrix as a Heatmap

Easypython
Learn the Concept: Confusion Matrix

Problem Description

Write a Python program that generates a confusion matrix and visualizes it using ConfusionMatrixDisplay.

Input

Actual and predicted labels.

Output

A displayed heatmap of the confusion matrix.

Constraints

  • None specific.

Example Input

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

Example Output

text
(A color-coded heatmap displaying the confusion matrix values)

Concepts Covered

ConfusionMatrixDisplay, .plot().

Related Problems

  • Problem 1: Generate a Basic Confusion Matrix
    Easy · python
    Solve Problem
  • Problem 3: Extract TP, TN, FP, FN from a Confusion Matrix
    Easy · python
    Solve Problem
  • Problem 4: Build a Confusion Matrix for a 3-Class Problem
    Easy · python
    Solve Problem

Input (stdin)

Output

Run your code to see output here...