gpt4 book ai didi

XGBoostError : [09:48:50]/usr/local/xgboost/src/metric/metric. cc:21: 未知的度量函数 auc

转载 作者:行者123 更新时间:2023-12-01 06:02:29 29 4
gpt4 key购买 nike

我使用 xgboost 进行预测,我的主要代码如下:

params={
'booster':'gbtree',
'object':'binary:logistic',
'early_stopping_rounds':100,
'eval_metric':'auc',
'gamma':0.1,
'max_depth':8,
'lambda':550,
'subsample':0.7,
'colsample_bytree':0.2,
'min_child_weight':3,
'eta':0.02,
'seed':2,
'min_child_weight':0.5,
'scale_pos_weight':ratio,
'max_delta_step':5,
'nthread':7
}

watch_list = [(dval,'val'),(dtrain,'train')]
xgboost_model = xgb.train(params,dtrain,num_boost_round=500, evals = watch_list)

但有一个错误:
XGBoostError: [09:48:50] /usr/local/xgboost/src/metric/metric.cc:21: Unknown metric function auc

Stack trace returned 10 entries:
[bt] (0) /usr/local/lib/python2.7/dist-packages/xgboost-0.6-
py2.7.egg/xgboost/libxgboost.so(_ZN7xgboost6Metric6CreateERKSs+0x5f7)
[0x7f0cadfff417]
[bt] (1) /usr/local/lib/python2.7/dist-packages/xgboost-0.6-
py2.7.egg/xgboost/libxgboost.so(_ZN7xgboost11LearnerImpl9ConfigureERKSt6vectorISt4pairISsSsESaIS3_EE+0x717) [0x7f0cae0bfd27]
[bt] (2) /usr/local/lib/python2.7/dist-packages/xgboost-0.6-py2.7.egg/xgboost/libxgboost.so(XGBoosterUpdateOneIter+0x5e)
[0x7f0cadf6816e]
[bt] (3) /usr/lib/x86_64-linux-gnu/libffi.so.6(ffi_call_unix64+0x4c)
[0x7f0d3a3bcadc]
[bt] (4) /usr/lib/x86_64-linux-gnu/libffi.so.6(ffi_call+0x1fc) [0x7f0d3a3bc40c]
[bt] (5) /usr/lib/python2.7/lib-dynload/_ctypes.x86_64-linux-gnu.so(_ctypes_callproc+0x48e) [0x7f0d3a5d35fe]
[bt] (6) /usr/lib/python2.7/lib-dynload/_ctypes.x86_64-linux-gnu.so(+0x15f9e) [0x7f0d3a5d4f9e]
[bt] (7) /usr/bin/python(PyEval_EvalFrameEx+0x98d) [0x5244dd]
[bt] (8) /usr/bin/python(PyEval_EvalCodeEx+0x2b1) [0x555551]
[bt] (9) /usr/bin/python(PyEval_EvalFrameEx+0x7e8) [0x524338]

最佳答案

我也面临同样的问题。从 kaggle 内核复制粘贴示例代码后。我只是重新输入这部分:

'eval_metric' : "auc"



然后它可以正常工作而没有错误。

关于XGBoostError : [09:48:50]/usr/local/xgboost/src/metric/metric. cc:21: 未知的度量函数 auc,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44081178/

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