ChartsConfusion Matrix

ConfusionMatrix

A Confusion Matrix is a table used to evaluate the performance of a predictive model. Rows represent the actual classes, and columns show the predicted classes.

  • The diagonal cells show correct predictions and off-diagonal cells represent misclassifications.
GitHub LogoSource Code

Usage

This example demonstrates a simple confusion matrix.

Delta confusion matrix

To display the delta between expected and predicted values, use the delta prop:

  • Set it to the column containing delta values, or
  • Set it to true if the measure already includes precomputed delta values

Custom colors

Use the colorScale prop to customize the colors in a confusion matrix.

You can provide:

  • An array of two strings representing the color scale’s lower and upper bounds
    (e.g., ["positive", "#FF0000"])

Colors can be from the UI Kit palette (e.g., positive) or any valid CSS color.

Use the colorScale prop to customize confusion matrix colors:

  • Two-color scale:
    Pass an array like ["positive", "#FF0000"] to define the color range.

  • Custom ranges:
    Pass an array of objects with color, min, max, and optional label

Customizing values

Use the valuesProp to customize the text inside confusion matrix cells.

You can set:

  • color
  • fontSize
  • fontStyle
  • fontWeight

To hide the values, set valuesProp.show to false.

Landscape

By default, the confusion matrix uses a square format.
To switch to a landscape layout, set the format prop to "landscape".