Scikit-learn

Plot Confusion Matrix

Visualize the performance of your Machine Learning model with a confusion matrix. It is a fundamental tool in evaluating classification models, providing insights into model predictions. You can display total count of responses in the matrix, or if you toggle Normalize then it will be showing the ratio.

confusion-matrixclassification

Required packages

You need below packages to use the code generated by recipe. All packages are automatically installed in MLJAR Studio.

mljar-scikit-plot>=0.3.11

Interactive recipe

You can use below interactive recipe to generate code. This recipe is available in MLJAR Studio.

In the below recipe, we assume that you have following variables available in your notebook:

  • y (type Series)
  • predicted (type Series)

Python code

# Python code will be here

Code explanation

Produce a plot of confusion matrix. This code can be used with binary and multi-class classification tasks.

« Previous
Compute Metric
Next »
ROC Curve