gpt4 book ai didi

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

转载 作者:太空宇宙 更新时间:2023-11-03 16:14:29 26 4
gpt4 key购买 nike

我有一个 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
......

最佳答案

Format in XGBoost docs

一般形式为:

<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>

参见dump_svmlight_file如果您想以这种格式写入数据。

关于python - xgboost(Python版本)中lambdaMART的数据格式是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39037612/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com