Confusion Matrix
Matrix layout that quantifies the joint distribution between predicted and true categorical labels.
Confusion Matrix
Processing
This brick generates a Confusion Matrix visualization to evaluate the performance of a classification model. It compares the "True" labels (what the data actually represents) against the "Predicted" labels (what your model guessed).
The result is a grid (heatmap) that shows how often the model was correct and where it made mistakes. For example, it can show you how many times an image of a "Cat" was correctly identified as a "Cat" versus incorrectly identified as a "Dog."
Inputs
- y true
- The list or column containing the actual, correct labels (ground truth). These are the values you know are correct.
- y pred
- The list or column containing the labels predicted by your model. This must correspond index-by-index to the
y trueinput (i.e., the first prediction corresponds to the first true value).
Inputs Types
| Input | Types |
|---|---|
y true |
List, DataSeries, NDArray, DataRecords, DataFrame |
y pred |
List, DataSeries, NDArray, DataRecords, DataFrame |
You can check the list of supported types here: Available Type Hints.
Outputs
- y true
- The original list of true labels, passed through to the next brick unchanged.
- y pred
- The original list of predicted labels, passed through to the next brick unchanged.
Outputs Types
| Output | Types |
|---|---|
y true |
List, DataSeries, NDArray, DataRecords, DataFrame |
y pred |
List, DataSeries, NDArray, DataRecords, DataFrame |
You can check the list of supported types here: Available Type Hints.
Options
The Confusion Matrix brick contains some changeable options:
- Labels Size
- Controls the font size of the text on the X and Y axes (the label names). Increasing this makes the categories easier to read.
- Count Size
- Controls the font size of the numbers displayed inside the grid squares.
- Color Schema
- Determines the color palette used for the heatmap. Darker colors typically represent higher counts/frequencies.
- blues: Shades of blue.
- yellowgreenblue: A gradient from yellow to green to blue.
- lightmulti: A light, multi-colored scheme.
- lighttealblue: Shades of teal and blue.
- bluegreen: Shades of blue and green.
- orangered: Shades of orange and red.
- redpurple: Shades of red and purple.
Brick Info
- shap>=0.47.0
- numba>=0.56.0