.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "checks_gallery/vision/model_evaluation/plot_confusion_matrix.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note Click :ref:`here ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_checks_gallery_vision_model_evaluation_plot_confusion_matrix.py: Confusion Matrix **************** This notebooks provides an overview for using and understanding the confusion matrix check. **Structure:** * `What is the purpose of the check? <#what-is-the-purpose-of-the-check>`__ * `Generate data & model <#generate-data-and-model>`__ * `Run the check <#run-the-check>`__ What is the purpose of the check? ================================= The confusion matrix check outputs a confusion matrix for both classification problems and object detection problems. In object detection problems, some predictions do not overlap on any label and can be classified as not found in the confusion matrix. .. GENERATED FROM PYTHON SOURCE LINES 22-26 Generate Data and Model ------------------------ We generate a sample dataset of 128 images from the `COCO dataset `__, and using the `YOLOv5 model `__. .. GENERATED FROM PYTHON SOURCE LINES 26-32 .. code-block:: default from deepchecks.vision.datasets.detection import coco yolo = coco.load_model(pretrained=True) train_ds = coco.load_dataset(object_type='VisionData') .. rst-class:: sphx-glr-script-out Out: .. code-block:: none Downloading: "https://github.com/ultralytics/yolov5/archive/v6.1.zip" to /home/runner/.cache/torch/hub/v6.1.zip Downloading https://github.com/ultralytics/yolov5/releases/download/v6.1/yolov5s.pt to yolov5s.pt... 0%| | 0.00/14.1M [00:00 Confusion Matrix

.. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 33.224 seconds) .. _sphx_glr_download_checks_gallery_vision_model_evaluation_plot_confusion_matrix.py: .. only :: html .. container:: sphx-glr-footer :class: sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_confusion_matrix.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_confusion_matrix.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_