Skip to content

[WIP] FIX ndcg to work for arbitrarily many samples#9928

Closed
jnothman wants to merge 2 commits intoscikit-learn:masterfrom
jnothman:ndcg-samples
Closed

[WIP] FIX ndcg to work for arbitrarily many samples#9928
jnothman wants to merge 2 commits intoscikit-learn:masterfrom
jnothman:ndcg-samples

Conversation

@jnothman
Copy link
Copy Markdown
Member

@jnothman jnothman commented Oct 16, 2017

Fixes #9921

TODO: add test for binary case

@jnothman jnothman added this to the 0.19.1 milestone Oct 16, 2017
@jnothman
Copy link
Copy Markdown
Member Author

This is intended to be a quick fix for 0.19.1. I am creating other issues to address shortfalls in ndcg API and testing.

@qinhanmin2014
Copy link
Copy Markdown
Member

Sorry to disturb if I'm not qualified to post my opinion here.
I don't think the PR fixes #9921, because seems that we still can't run the following script posted at the beginning of the issue:

y_true = [0, 1, 0, 1]
y_score = [[0.15, 0.85], [0.7, 0.3], [0.06, 0.94], [0.7, 0.3]]
metrics.ndcg_score(y_true, y_score)

There seems two problems and the second is not solved here:
(1)The shape of binarized_y_true is not correct. It seems that this can be solved by using y_score.shape[1]
(2)For LabeBinarizer, binary targets is transformed to a column vector, which is not we want. An alternative solution might be using OneHotEncoder.

Also, if current implementation is right, could we provide a reference for users (and for me :) )? I can't find any reference which is consistent with current implementation and the reference in the doc is a dead link. Personally, I might still don't think current implementation is right. It's a simple copy-paste from kaggle and I think ogrisel's implementation here is at least what I would use.

@jnothman
Copy link
Copy Markdown
Member Author

jnothman commented Oct 16, 2017 via email

@jnothman jnothman changed the title [MRG] FIX ndcg to work for arbitrarily many samples [WIP] FIX ndcg to work for arbitrarily many samples Oct 16, 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

Successfully merging this pull request may close these issues.

2 participants