Skip to content
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

Selection of objective "rank:ndcg" results in lower NDCG than "rank:pairwise" #4177

Closed
Edmondguo opened this issue Feb 25, 2019 · 14 comments
Closed
Labels
LTR Learning to rank

Comments

@Edmondguo
Copy link

Thanks for adding ranking task support in xgboost! But I have a few questions:

  1. Docs says "Use LambdaMART to perform pairwise ranking where the pairwise loss is minimized", I want to know particular function of "pairwise loss".
  2. I can not understand "Use LambdaMART to perform pairwise ranking". According to 《From RankNet to LambdaRank to LambdaMART: An Overview》, LambdaMART is a Listwise method, which optimizes NDCG.
@kretes
Copy link

kretes commented Feb 25, 2019

Hi @Edmondguo . I can just point to some historic discussion and my understanding of how xgboost works, so it would still be good to get some official confirmation for that, e.g. from @hcho3 .

I believe rank:pairwise is a pairwise method that tries to minimize the number of pairwise errors.
rank:ndcg is a method following LambdaMART and when you dig in the code - it will confirm that rank:ndcg is an extension of rank:pairwise with additional weights added to the loss of each pair.

however in a few experiments it looks as if rank:ndcg performs worse than rank:pairwise, and it might be due to the implementation. see e.g. #2092 (comment)

Some time ago we verified rank:ndcg to perform a bit worse when evaluated on ndcg than rank:pairwise in our case.

@hcho3
Copy link
Collaborator

hcho3 commented Feb 25, 2019

rank:ndcg is an extension of rank:pairwise with additional weights added to the loss of each pair.

Exactly. In "From RankNet to LambdaRank to LambdaMART", LambdaMART optimizes NDCG by optimizing the pairwise loss (with lambda's) that is weighted with change in NDCG.

@Edmondguo
Copy link
Author

Hi @Edmondguo . I can just point to some historic discussion and my understanding of how xgboost works, so it would still be good to get some official confirmation for that, e.g. from @hcho3 .

I believe rank:pairwise is a pairwise method that tries to minimize the number of pairwise errors.
rank:ndcg is a method following LambdaMART and when you dig in the code - it will confirm that rank:ndcg is an extension of rank:pairwise with additional weights added to the loss of each pair.

however in a few experiments it looks as if rank:ndcg performs worse than rank:pairwise, and it might be due to the implementation. see e.g. #2092 (comment)

Some time ago we verified rank:ndcg to perform a bit worse when evaluated on ndcg than rank:pairwise in our case.

Thank you very much! In my experiment I also found that rank:ndcg perform worse than rank:pairwise.

@Edmondguo
Copy link
Author

rank:ndcg is an extension of rank:pairwise with additional weights added to the loss of each pair.

Exactly. In "From RankNet to LambdaRank to LambdaMART", LambdaMART optimizes NDCG by optimizing the pairwise loss (with lambda's) that is weighted with change in NDCG.

Thank you! So is it means in rank:pairwise, xgboost use lambda's which is derived by "Cross Entropy Loss" in RankNet as the loss funtion?

@hcho3
Copy link
Collaborator

hcho3 commented Feb 26, 2019

@Edmondguo Yes

@hcho3
Copy link
Collaborator

hcho3 commented Feb 26, 2019

@Edmondguo @kretes Would you be interested in posting an example where you get better NDCG metric by choosing rank:pairwise instead of rank:ndcg? I'd like to see if this is a bug or a chance.

@Edmondguo
Copy link
Author

@Edmondguo @kretes Would you be interested in posting an example where you get better NDCG metric by choosing rank:pairwise instead of rank:ndcg? I'd like to see if this is a bug or a chance.

The project I am dealing with is using rank model in quantitative stock selection.It seems hard to provide because the data is too big.In this case "rank:pairwise" performs much better than "rank:ndcg" under the same booster parameters.the NDCG are 0.5138 for "rank:ndcg", 0.5586 for "rank:pairwise".

@hcho3
Copy link
Collaborator

hcho3 commented Feb 26, 2019

@Edmondguo Does your data have multiple relevance judgment levels (1, 2, 3, 4, ...) ?

@Edmondguo
Copy link
Author

@Edmondguo Does your data have multiple relevance judgment levels (1, 2, 3, 4, ...) ?

Yes,before I train the model,I have change y into (1,2,3,...30)

@hcho3
Copy link
Collaborator

hcho3 commented Feb 27, 2019

It would be nice if there is a toy example we can use to show rank:pairwise outperforming rank:ndcg. Without an example, it is hard to find out why rank:ndcg is not working well.

@kretes
Copy link

kretes commented Mar 4, 2019

Hello.

I believe I found an example where this is reproducible. rank-pairwise gives ndcg 1 while rank:ndcg cannot.
See this gist: https://gist.github.com/kretes/1228e571aeba2a57f617352af633cd40.

I hope this will help nailing the issue

@hcho3 hcho3 changed the title What is the particular loss function in "rank:pairwise"? Selection of objective "rank:ndcg" results in lower NDCG than "rank:pairwise" Mar 8, 2019
@sano176
Copy link

sano176 commented Oct 30, 2019

i met this problem too, i could't find the reason to explain it, "objective = rank:pairwise" better than "objective = rank:ndcg"

@chloe-wang
Copy link

@Edmondguo just want to follow up this issue. I met the same problem. Did you figure out the reason?

@trivialfis trivialfis added the LTR Learning to rank label Dec 17, 2020
@trivialfis
Copy link
Member

Some explanation is given in #6352 . For future work, see #6450 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
LTR Learning to rank
Projects
None yet
Development

No branches or pull requests

6 participants