I noted there was a "query" parameter, but how could I specify the column id or name in python when my data was constructed from a DataFrame?
Taking the code below as an example, the columns of the trainData is ['qid', 'f1', 'f2', 'f3', 'label'], and the fields is ['qid', 'f1', 'f2', 'f3'], of which the qid is the query/group id, and the f1-f3 are the features. I tried to set the query id in params, but got an error "Lambdarank tasks require query information". So how could I specify the query id in Python? @guolinke
trnDataset = lgb.Dataset(trainData[fields], label = trainData.label)
boosterParam = {'objective' : 'lambdarank', 'metric' : 'ndcg' ,"query":"name:qid"}
booster = lgb.train(boosterParam, trnDataset)
you are using the python-package, so you cannot use "query" parameter.
you should use the parameter group when construct lgb.Dataset.
BTW, group is not the group_id/query_id, you should convert it like the query/group file: https://github.com/Microsoft/LightGBM/blob/master/docs/Parameters.rst#query-data
Most helpful comment
you are using the python-package, so you cannot use "query" parameter.
you should use the parameter
groupwhen construct lgb.Dataset.BTW,
groupis not the group_id/query_id, you should convert it like the query/group file: https://github.com/Microsoft/LightGBM/blob/master/docs/Parameters.rst#query-data