-
-
Notifications
You must be signed in to change notification settings - Fork 26.5k
Closed
Labels
Enhancementgood first issueEasy with clear instructions to resolveEasy with clear instructions to resolvemodule:metrics
Description
See this code example:
>>> t = [[1]]
>>> p = [[0]]
>>> metrics.ndcg_score(t, p)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/cbournhonesque/.pyenv/versions/bento/lib/python3.8/site-packages/sklearn/utils/validation.py", line 63, in inner_f
return f(*args, **kwargs)
File "/Users/cbournhonesque/.pyenv/versions/bento/lib/python3.8/site-packages/sklearn/metrics/_ranking.py", line 1567, in ndcg_score
_check_dcg_target_type(y_true)
File "/Users/cbournhonesque/.pyenv/versions/bento/lib/python3.8/site-packages/sklearn/metrics/_ranking.py", line 1307, in _check_dcg_target_type
raise ValueError(
ValueError: Only ('multilabel-indicator', 'continuous-multioutput', 'multiclass-multioutput') formats are supported. Got binary instead
It works correctly when the number of elements is bigger than 1: https://stackoverflow.com/questions/64303839/how-to-calculate-ndcg-with-binary-relevances-using-sklearn
Metadata
Metadata
Assignees
Labels
Enhancementgood first issueEasy with clear instructions to resolveEasy with clear instructions to resolvemodule:metrics