@@ -313,6 +313,7 @@ Others also work in the multiclass case:
313
313
confusion_matrix
314
314
hinge_loss
315
315
matthews_corrcoef
316
+ roc_auc_score
316
317
317
318
318
319
Some also work in the multilabel case:
@@ -331,6 +332,7 @@ Some also work in the multilabel case:
331
332
precision_recall_fscore_support
332
333
precision_score
333
334
recall_score
335
+ roc_auc_score
334
336
zero_one_loss
335
337
336
338
And some work with binary and multilabel (but not multiclass) problems:
@@ -339,7 +341,6 @@ And some work with binary and multilabel (but not multiclass) problems:
339
341
:template: function.rst
340
342
341
343
average_precision_score
342
- roc_auc_score
343
344
344
345
345
346
In the following sub-sections, we will describe each of those functions,
@@ -1313,9 +1314,52 @@ In multi-label classification, the :func:`roc_auc_score` function is
1313
1314
extended by averaging over the labels as :ref: `above <average >`.
1314
1315
1315
1316
Compared to metrics such as the subset accuracy, the Hamming loss, or the
1316
- F1 score, ROC doesn't require optimizing a threshold for each label. The
1317
- :func: `roc_auc_score ` function can also be used in multi-class classification,
1318
- if the predicted outputs have been binarized.
1317
+ F1 score, ROC doesn't require optimizing a threshold for each label.
1318
+
1319
+ The :func: `roc_auc_score ` function can also be used in multi-class
1320
+ classification. Two averaging strategies are currently supported: the
1321
+ one-vs-one algorithm computes the average of the pairwise ROC AUC scores, and
1322
+ the one-vs-rest algorithm computes the average of the ROC AUC scores for each
1323
+ class against all other classes. In both cases, the predicted labels are
1324
+ provided in an array with values from 0 to ``n_classes ``, and the scores
1325
+ correspond to the probability estimates that a sample belongs to a particular
1326
+ class. The OvO and OvR algorithms supports weighting uniformly
1327
+ (``average='macro' ``) and weighting by the prevalence (``average='weighted' ``).
1328
+
1329
+ **One-vs-one Algorithm **: Computes the average AUC of all possible pairwise
1330
+ combinations of classes. [HT2001 ]_ defines a multiclass AUC metric weighted
1331
+ uniformly:
1332
+
1333
+ .. math ::
1334
+
1335
+ \frac {2 }{c(c-1 )}\sum _{j=1 }^{c}\sum _{k > j}^c (\text {AUC}(j | k) +
1336
+ \text {AUC}(k | j))
1337
+
1338
+ where :math: `c` is the number of classes and :math: `\text {AUC}(j | k)` is the
1339
+ AUC with class :math: `j` as the positive class and class :math: `k` as the
1340
+ negative class. In general,
1341
+ :math: `\text {AUC}(j | k) \neq \text {AUC}(k | j))` in the multiclass
1342
+ case. This algorithm is used by setting the keyword argument ``multiclass ``
1343
+ to ``'ovo' `` and ``average `` to ``'macro' ``.
1344
+
1345
+ The [HT2001 ]_ multiclass AUC metric can be extended to be weighted by the
1346
+ prevalence:
1347
+
1348
+ .. math ::
1349
+
1350
+ \frac {2 }{c(c-1 )}\sum _{j=1 }^{c}\sum _{k > j}^c p(j \cup k)(
1351
+ \text {AUC}(j | k) + \text {AUC}(k | j))
1352
+
1353
+ where :math: `c` is the number of classes. This algorithm is used by setting
1354
+ the keyword argument ``multiclass `` to ``'ovo' `` and ``average `` to
1355
+ ``'weighted' ``. The ``'weighted' `` option returns a prevalence-weighted average
1356
+ as described in [FC2009 ]_.
1357
+
1358
+ **One-vs-rest Algorithm **: Computes the AUC of each class against the rest.
1359
+ The algorithm is functionally the same as the multilabel case. To enable this
1360
+ algorithm set the keyword argument ``multiclass `` to ``'ovr' ``. Similar to
1361
+ OvO, OvR supports two types of averaging: ``'macro' `` [F2006 ]_ and
1362
+ ``'weighted' `` [F2001 ]_.
1319
1363
1320
1364
In applications where a high false positive rate is not tolerable the parameter
1321
1365
``max_fpr `` of :func: `roc_auc_score ` can be used to summarize the ROC curve up
@@ -1341,6 +1385,28 @@ to the given limit.
1341
1385
for an example of using ROC to
1342
1386
model species distribution.
1343
1387
1388
+ .. topic :: References:
1389
+
1390
+ .. [HT2001 ] Hand, D.J. and Till, R.J., (2001). `A simple generalisation
1391
+ of the area under the ROC curve for multiple class classification problems.
1392
+ <http://link.springer.com/article/10.1023/A:1010920819831> `_
1393
+ Machine learning, 45(2), pp.171-186.
1394
+
1395
+ .. [FC2009 ] Ferri, Cèsar & Hernandez-Orallo, Jose & Modroiu, R. (2009).
1396
+ `An Experimental Comparison of Performance Measures for Classification.
1397
+ <https://www.math.ucdavis.edu/~saito/data/roc/ferri-class-perf-metrics.pdf> `_
1398
+ Pattern Recognition Letters. 30. 27-38.
1399
+
1400
+ .. [F2006 ] Fawcett, T., 2006. `An introduction to ROC analysis.
1401
+ <http://www.sciencedirect.com/science/article/pii/S016786550500303X> `_
1402
+ Pattern Recognition Letters, 27(8), pp. 861-874.
1403
+
1404
+ .. [F2001 ] Fawcett, T., 2001. `Using rule sets to maximize
1405
+ ROC performance <http://ieeexplore.ieee.org/document/989510/> `_
1406
+ In Data Mining, 2001.
1407
+ Proceedings IEEE International Conference, pp. 131-138.
1408
+
1409
+
1344
1410
.. _zero_one_loss :
1345
1411
1346
1412
Zero one loss
0 commit comments