

.. _example_plot_confusion_matrix.py:


================
Confusion matrix
================

Example of confusion matrix usage to evaluate the quality
of the output of a classifier.



.. image:: images/plot_confusion_matrix_1.png
    :align: center


**Script output**::

  [[25  0  0]
   [ 0 28  2]
   [ 0  1 19]]



**Python source code:** :download:`plot_confusion_matrix.py <plot_confusion_matrix.py>`

.. literalinclude:: plot_confusion_matrix.py
    :lines: 9-
    