Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/284.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
xgboost(Python版本)中lambdaMART的数据格式是什么?_Python_Ranking_Xgboost - Fatal编程技术网

xgboost(Python版本)中lambdaMART的数据格式是什么?

xgboost(Python版本)中lambdaMART的数据格式是什么?,python,ranking,xgboost,Python,Ranking,Xgboost,我有一个libsvm格式的数据集,其中包含重要性分数标签和特征。 qid是查询。数据如下所示 我想使用xgboost进行搜索排名,但我不知道xgb.train函数的输入数据格式是什么。我见过用于分类和回归的数据格式。但是我的数据集有一个表示组信息的查询,并且lambda还没有计算出来。那么,我如何使用xgboost api来训练我的排名模型,以及需要什么样的数据格式呢 此外,我想使用ndcg来评估我的模型 非常感谢,我期待着解决方案 0 qid:1830 1:0.002736 2:0.00000

我有一个libsvm格式的数据集,其中包含重要性分数标签和特征。 qid是查询。数据如下所示

我想使用xgboost进行搜索排名,但我不知道xgb.train函数的输入数据格式是什么。我见过用于分类和回归的数据格式。但是我的数据集有一个表示组信息的查询,并且lambda还没有计算出来。那么,我如何使用xgboost api来训练我的排名模型,以及需要什么样的数据格式呢

此外,我想使用ndcg来评估我的模型

非常感谢,我期待着解决方案

0 qid:1830 1:0.002736 2:0.000000 3:0.000000 4:0.000000 5:0.002736 6:0.000000 7:0.000000 8:0.000000 9:0.000000 10:0.000000
0 qid:1830 1:0.025992 2:0.125000 3:0.000000 4:0.000000 5:0.027360 6:0.000000 7:0.000000 8:0.000000 9:0.000000 10:0.000000
0 qid:1830 1:0.001368 2:0.000000 3:0.000000 4:0.000000 5:0.001368 6:0.000000 7:0.000000 8:0.000000 9:0.000000 10:0.000000
1 qid:1830 1:0.188782 2:0.375000 3:0.333333 4:1.000000 5:0.195622 6:0.000000 7:0.000000 8:0.000000 9:0.000000 10:0.000000
1 qid:1830 1:0.077975 2:0.500000 3:0.666667 4:0.000000 5:0.086183 6:0.000000 7:0.000000 8:0.000000 9:0.000000 10:0.000000
0 qid:1830 1:0.075239 2:0.125000 3:0.333333 4:0.000000 5:0.077975 6:0.000000 7:0.000000 8:0.000000 9:0.000000 10:0.000000
1 qid:1830 1:0.079343 2:0.250000 3:0.666667 4:0.000000 5:0.084815 6:0.000000 7:0.000000 8:0.000000 9:0.000000 10:0.000000
1 qid:1830 1:0.147743 2:0.000000 3:0.000000 4:0.000000 5:0.147743 6:0.000000 7:0.000000 8:0.000000 9:0.000000 10:0.000000
0 qid:1830 1:0.058824 2:0.000000 3:0.000000 4:0.000000 5:0.058824 6:0.000000 7:0.000000 8:0.000000 9:0.000000 10:0.000000
0 qid:1830 1:0.071135 2:0.125000 3:0.333333 4:0.000000 5:0.073871 6:0.000000 7:0.000000 8:0.000000 9:0.000000 10:0.000000
1 qid:1840 1:0.007364 2:0.200000 3:1.000000 4:0.500000 5:0.013158 6:0.000000 7:0.000000 8:0.000000 9:0.000000 10:0.000000
1 qid:1840 1:0.097202 2:0.000000 3:0.000000 4:0.000000 5:0.096491 6:0.000000 7:0.000000 8:0.000000 9:0.000000 10:0.000000
2 qid:1840 1:0.169367 2:0.000000 3:0.500000 4:0.000000 5:0.169591 6:0.000000 7:0.000000 8:0.000000 9:0.000000 10:0.000000
......

一般形式如下:

<line> .=. <target> <feature>:<value> <feature>:<value> ... <feature>:<value> # <docid> <inc> <prob>
<target> .=. +1 | -1 | 0 | <float> 
<feature> .=. <integer> | "qid"
<value> .=. <float>
<info> .=. <string> 
<inc> .=. <integer> 
<prob> .=. <float> 
<docid> .=. <string> 
=.:…:#
.=. +1 | -1 | 0 |  
.=.  | “qid”
.=. 
.=.  
.=.  
.=.  
.=.  
看看你是否想用那种格式写你的数据