8000 label_ranking_average_precision_score fails with sublists that are different sizes · Issue #8487 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content

label_ranking_average_precision_score fails with sublists that are different sizes #8487

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
josepablog opened this issue Mar 1, 2017 · 3 comments

Comments

@josepablog
Copy link
josepablog commented Mar 1, 2017

The evaluation function label_ranking_average_precision_score fails when the sublists are of different sizes. Although I understand that this may be out of implementation convenience, I think this should be documented or at least a more adequate error should be raised.

import numpy as np
from sklearn.metrics import label_ranking_average_precision_score
y_true = np.array([[1, 0, 0], [0, 1]])  #sublists have 3 and 2  elements
y_score = np.array([[0.75, 0.5, 1], [1, 0.1]]) #sublists have 3 and  2 elements

 label_ranking_average_precision_score(y_true, y_score)       

This code fails with an exception:

ValueError: setting an array element with a sequence.

@jnothman
Copy link
Member
jnothman commented Mar 1, 2017 via email

@josepablog
Copy link
Author

Hello @jnothman,

Not sure I understand your question. y_true is the "correct" answer for every search ranking opportunity. Every sublist is the number of results the user saw. Sometimes the user may see 3 search results, sometimes she may see 2 results, or whatever number.

Currently, this metric only works when the user sees the same number of results in every session. If not, a cryptic error is raised.

Thanks!
Jose

803C

@jnothman
Copy link
Member
jnothman commented Mar 2, 2017 via email

@jnothman jnothman closed this as completed Mar 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
0