@@ -1565,13 +1565,13 @@ def tpr_fpr_tnr_fnr_scores(y_true, y_pred, *, labels=None, pos_label=1,
1565
1565
1566
1566
Parameters
1567
1567
----------
1568
- y_true : 1d array-like, or label indicator array / sparse matrix
1568
+ y_true : { array-like, label indicator array, sparse matrix} of shape (n_samples,)
1569
1569
Ground truth (correct) target values.
1570
1570
1571
- y_pred : 1d array-like, or label indicator array / sparse matrix
1571
+ y_pred : { array-like, label indicator array, sparse matrix} of shape (n_samples,)
1572
1572
Estimated targets as returned by a classifier.
1573
1573
1574
- labels : list, optional
1574
+ labels : list, default=None
1575
1575
The set of labels to include when ``average != 'binary'``, and their
1576
1576
order if ``average is None``. Labels present in the data can be
1577
1577
excluded, for example to calculate a multiclass average ignoring a
@@ -1580,14 +1580,13 @@ def tpr_fpr_tnr_fnr_scores(y_true, y_pred, *, labels=None, pos_label=1,
1580
1580
labels are column indices. By default, all labels in ``y_true`` and
1581
1581
``y_pred`` are used in sorted order.
1582
1582
1583
- pos_label : str or int, 1 by default
1583
+ pos_label : str or int, default=1
1584
1584
The class to report if ``average='binary'`` and the data is binary.
1585
1585
If the data are multiclass or multilabel, this will be ignored;
1586
1586
setting ``labels=[pos_label]`` and ``average != 'binary'`` will report
1587
1587
scores for that label only.
1588
1588
1589
- average : string, [None (default), 'binary', 'micro', 'macro', 'samples', \
1590
- 'weighted']
1589
+ average : str, {None, 'binary', 'micro', 'macro', 'samples', 'weighted'}, default=None
1591
1590
If ``None``, the scores for each class are returned. Otherwise, this
1592
1591
determines the type of averaging performed on the data:
1593
1592
@@ -1616,7 +1615,7 @@ def tpr_fpr_tnr_fnr_scores(y_true, y_pred, *, labels=None, pos_label=1,
1616
1615
sample_weight : array-like of shape (n_samples,), default=None
1617
1616
Sample weights.
1618
1617
1619
- zero_division : " warn" , 0 or 1 , default="warn"
1618
+ zero_division : str or int, {' warn' , 0, 1} , default="warn"
1620
1619
Sets the value to return when there is a zero division:
1621
1620
- tpr, fnr: when there are no positive labels
1622
1621
- fpr, tnr: when there are no negative labels
@@ -1625,17 +1624,13 @@ def tpr_fpr_tnr_fnr_scores(y_true, y_pred, *, labels=None, pos_label=1,
1625
1624
1626
1625
Returns
1627
1626
-------
1628
- tpr : float (if average is not None) or array of float, shape =\
1629
- [n_unique_labels]
1627
+ tpr : float (if average is not None), or ndarray of shape (n_unique_labels,)
1630
1628
1631
- fpr : float (if average is not None) or array of float, shape =\
1632
- [n_unique_labels]
1629
+ fpr : float (if average is not None), or ndarray of shape (n_unique_labels,)
1633
1630
1634
- tnr : float (if average is not None) or array of float, shape =\
1635
- [n_unique_labels]
1631
+ tnr : float (if average is not None), or ndarray of shape (n_unique_labels,)
1636
1632
1637
- fnr : float (if average is not None) or array of float, shape =\
1638
- [n_unique_labels]
1633
+ fnr : float (if average is not None), or ndarray of shape (n_unique_labels,)
1639
1634
The number of occurrences of each label in ``y_true``.
1640
1635
1641
1636
References
@@ -1673,8 +1668,8 @@ def tpr_fpr_tnr_fnr_scores(y_true, y_pred, *, labels=None, pos_label=1,
1673
1668
1674
1669
Notes
1675
1670
-----
1676
- When ``true positive + false negative == 0``, TPR, FNR are not undefined;
1677
- When ``true negative + false positive == 0``, FPR, TNR are not undefined.
1671
+ When ``true positive + false negative == 0``, TPR, FNR are undefined;
1672
+ When ``true negative + false positive == 0``, FPR, TNR are undefined.
1678
1673
In such cases, by default the metric will be set to 0, as will f-score,
1679
1674
and ``UndefinedMetricWarning`` will be raised. This behavior can be
1680
1675
modified with ``zero_division``.
0 commit comments