Skip to content

Commit

Permalink
DOC Update docstring of top_k_accuracy_score (scikit-learn#21255)
Browse files Browse the repository at this point in the history
Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
  • Loading branch information
3 people authored Nov 23, 2021
1 parent a278f2a commit 4dfaaf9
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions sklearn/metrics/_ranking.py
Original file line number Diff line number Diff line change
Expand Up @@ -1639,12 +1639,14 @@ def top_k_accuracy_score(
y_score : array-like of shape (n_samples,) or (n_samples, n_classes)
Target scores. These can be either probability estimates or
non-thresholded decision values (as returned by
:term:`decision_function` on some classifiers). The binary case expects
scores with shape (n_samples,) while the multiclass case expects scores
with shape (n_samples, n_classes). In the multiclass case, the order of
the class scores must correspond to the order of ``labels``, if
provided, or else to the numerical or lexicographical order of the
labels in ``y_true``.
:term:`decision_function` on some classifiers).
The binary case expects scores with shape (n_samples,) while the
multiclass case expects scores with shape (n_samples, n_classes).
In the multiclass case, the order of the class scores must
correspond to the order of ``labels``, if provided, or else to
the numerical or lexicographical order of the labels in ``y_true``.
If ``y_true`` does not contain all the labels, ``labels`` must be
provided.
k : int, default=2
Number of most likely outcomes considered to find the correct label.
Expand All @@ -1659,7 +1661,8 @@ def top_k_accuracy_score(
labels : array-like of shape (n_classes,), default=None
Multiclass only. List of labels that index the classes in ``y_score``.
If ``None``, the numerical or lexicographical order of the labels in
``y_true`` is used.
``y_true`` is used. If ``y_true`` does not contain all the labels,
``labels`` must be provided.
Returns
-------
Expand Down

0 comments on commit 4dfaaf9

Please sign in to comment.