How to compute a confusion matrix in Python

A confusion matrix is a table that is used to describe the performance of a classification model. It is computed using a list of actual values and a corresponding list of predicted values.

Solution for How to compute a confusion matrix in Python : You can use sklearn.metrics.confusion_matrix() to compute a confusion matrix Call sklearn.metrics.confusion_matrix(y_true, y_pred) with a list of actual values as y_true and a list of predicted values as y_pred to compute a confusion matrix.


how-to-compute-a-confusion-matrix-in-python