{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n# Multiclass Receiver Operating Characteristic (ROC)\n\nThis example describes the use of the Receiver Operating Characteristic (ROC)\nmetric to evaluate the quality of multiclass classifiers.\n\nROC curves typically feature true positive rate (TPR) on the Y axis, and false\npositive rate (FPR) on the X axis. This means that the top left corner of the\nplot is the \"ideal\" point - a FPR of zero, and a TPR of one. This is not very\nrealistic, but it does mean that a larger area under the curve (AUC) is usually\nbetter. The \"steepness\" of ROC curves is also important, since it is ideal to\nmaximize the TPR while minimizing the FPR.\n\nROC curves are typically used in binary classification, where the TPR and FPR\ncan be defined unambiguously. In the case of multiclass classification, a notion\nof TPR or FPR is obtained only after binarizing the output. This can be done in\n2 different ways:\n\n- the One-vs-Rest scheme compares each class against all the others (assumed as\n one);\n- the One-vs-One scheme compares every unique pairwise combination of classes.\n\nIn this example we explore both schemes and demo the concepts of micro and macro\naveraging as different ways of summarizing the information of the multiclass ROC\ncurves.\n\n
See `sphx_glr_auto_examples_model_selection_plot_roc_crossval.py` for\n an extension of the present example estimating the variance of the ROC\n curves and their respective AUC.
One should not confuse the OvR strategy used for the **evaluation**\n of multiclass classifiers with the OvR strategy used to **train** a\n multiclass classifier by fitting a set of binary classifiers (for instance\n via the :class:`~sklearn.multiclass.OneVsRestClassifier` meta-estimator).\n The OvR ROC evaluation can be used to scrutinize any kind of classification\n models irrespectively of how they were trained (see `multiclass`).
By default, the computation of the ROC curve adds a single point at\n the maximal false positive rate by using linear interpolation and the\n McClish correction [:doi:`Analyzing a portion of the ROC curve Med Decis\n Making. 1989 Jul-Sep; 9(3):190-5.<10.1177/0272989x8900900307>`].