# XGBoost ranking file format

The xgboost package has two files that must be used for ranking:

1. train.txt with the data
2. train.txt.group with the group of each observation

I don't understand two things in each file:

1. What should I use as positive/negative classes? In ranking, there is no such thing as a positive/negative class...
2. What should I use as group? Say that I have observations x1 > x2 > x3. How do I express this lexicographical order using groups?

Since I asked this question, it seems the documentation was expanded:

We need to provide a ".group" file. For example, the file could be

2
3


This means that, the data set contains 5 instances, and the first two instances are in a group and the other three are in another group. The numbers in the group file are actually indicating the number of instances in each group in the instance file in order.

In my understanding, ranking means which one is more likely to be a positive sample. So it's using for sorting test data for information retrieval or recommend.

So, each group should have one positive sample (may be more? I'm not sure).In the file train.txt, the first line is the instance label (you can see this in the doc).

In the group file, each line is one group's size. So the train data should in order by group, not shuffled.

According to your description, maybe reg:logistic is what you want——describe x1 > x2 > x3 in [0,1] at the label column, training model and predicting, then groupby data an