Skip to main content
100%

Confusion matrix in scikit-learn

✓ Published0🌍 Public
Aabehmiel
Last edited May 29, 2017
Created on May 29, 2017

This example shows two confusion matrices for evaluating a GradientBoostingClassifier’s predictions on a binary test set, using scikit-learn’s `confusion_matrix` function. The first plot displays raw counts of true versus predicted labels, while the second normalizes each row to show proportions. Both use `plt.imshow` with a blue colormap, annotated with counts or normalized values, and include axis labels for true and predicted classes. The code defines a custom `plot_confusion_matrix` function that applies `imshow`, colorbar, and text annotations, and saves each figure as a PNG.

AI-generated description

Similar vizzes