3

I'm going to use XGBRanker to make a recommender system. But in the official docs I haven't found an example of how to prepare the dataset.

So, in which format features and labels should be fitted in XGBRanker?

Alexander Ershov
  • 1,105
  • 2
  • 12
  • 26

1 Answers1

2

We need the below dataset for XGBRanker:

  1. X as features
  2. Y as target value(label)
  3. group as kwargs(unique groups defined as per the domain) / qid per row

Make a note that group information should be an array consisting of the # of elements per group.

For example:

Groups in data: 4

Training, Test: (100,50)

Training Data(X,Y): (100,3)[feature 1, feature 2, feature 3]

Training Label(Y): (100,1)

Training group[A,B,C,D] i.e **grpInfo**: [25,25,10,35]

Note:The sum of grpInfo should be equal to # of records in TrainingSet i.e in this case this is 100

XGBRanker(X[[feature 1, feature 2, feature 3]],Y[[Label]], group=grpInfo)

DSDEV
  • 21
  • 3