Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Learning to rank

XGBoost supports accomplishing ranking tasks. In ranking scenario, data are often grouped and we need the group information file to specify ranking tasks. The model used in XGBoost for ranking is the LambdaRank, this function is not yet completed. Currently, we provide pairwise rank.


The configuration setting is similar to the regression and binary classification setting, except user need to specify the objectives:


For more usage details please refer to the binary classification demo,


The dataset for ranking demo is from LETOR04 MQ2008 fold1. Before running the examples, you need to get the data by running:


Command Line

Run the example:



There are two ways of doing ranking in python.

Run the example using xgboost.train:


Run the example using XGBRanker:

You can’t perform that action at this time.