8000 Fix parameter documentation · scikit-learn/scikit-learn@a4652ca · GitHub
[go: up one dir, main page]

Skip to content

Commit a4652ca

Browse files
committed
Fix parameter documentation
1 parent a5b5262 commit a4652ca

File tree

1 file changed

+12
-17
lines changed

1 file changed

+12
-17
lines changed

sklearn/metrics/_classification.py

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1565,13 +1565,13 @@ def tpr_fpr_tnr_fnr_scores(y_true, y_pred, *, labels=None, pos_label=1,
15651565
15661566
Parameters
15671567
----------
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,)
15691569
Ground truth (correct) target values.
15701570
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,)
15721572
Estimated targets as returned by a classifier.
15731573
1574-
labels : list, optional
1574+
labels : list, default=None
15751575
The set of labels to include when ``average != 'binary'``, and their
15761576
order if ``average is None``. Labels present in the data can be
15771577
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,
15801580
labels are column indices. By default, all labels in ``y_true`` and
15811581
``y_pred`` are used in sorted order.
15821582
1583-
pos_label : str or int, 1 by default
1583+
pos_label : str or int, default=1
15841584
The class to report if ``average='binary'`` and the data is binary.
15851585
If the data are multiclass or multilabel, this will be ignored;
15861586
setting ``labels=[pos_label]`` and ``average != 'binary'`` will report
15871587
scores for that label only.
15881588
1589-
average : string, [None (default), 'binary', 'micro', 'macro', 'samples', \
1590-
'weighted']
1589+
average : str, {None, 'binary', 'micro', 'macro', 'samples', 'weighted'}, default=None
15911590
If ``None``, the scores for each class are returned. Otherwise, this
15921591
determines the type of averaging performed on the data:
15931592
@@ -1616,7 +1615,7 @@ def tpr_fpr_tnr_fnr_scores(y_true, y_pred, *, labels=None, pos_label=1,
16161615
sample_weight : array-like of shape (n_samples,), default=None
16171616
Sample weights.
16181617
1619-
zero_division : "warn", 0 or 1, default="warn"
1618+
zero_division : str or int, {'warn', 0, 1}, default="warn"
16201619
Sets the value to return when there is a zero division:
16211620
- tpr, fnr: when there are no positive labels
16221621
- 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,
16251624
16261625
Returns
16271626
-------
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,)
16301628
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,)
16331630
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,)
16361632
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,)
16391634
The number of occurrences of each label in ``y_true``.
16401635
16411636
References
@@ -1673,8 +1668,8 @@ def tpr_fpr_tnr_fnr_scores(y_true, y_pred, *, labels=None, pos_label=1,
16731668
16741669
Notes
16751670
-----
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.
16781673
In such cases, by default the metric will be set to 0, as will f-score,
16791674
and ``UndefinedMetricWarning`` will be raised. This behavior can be
16801675
modified with ``zero_division``.

0 commit comments

Comments
 (0)
0