Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/326.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
Python 在XGBoost中将MAPE用作评估指标_Python_Metrics_Xgboost - Fatal编程技术网

Python 在XGBoost中将MAPE用作评估指标

Python 在XGBoost中将MAPE用作评估指标,python,metrics,xgboost,Python,Metrics,Xgboost,我试图在XGBoost的代码中使用MAPE,但我遇到了以下错误:“/Users/runner/minifeg3/conda bld/XGBoost_1593723618214/work/src/metric/metric.cc:49:未知度量函数MAPE”。我读到最近的XGBoost升级没有这个指标,但是在文档中提到了MAPE,我需要使用它。有人知道我应该如何实施吗?下面是我正在使用的代码 先谢谢你 params = { # Parameters that we are going to tun

我试图在XGBoost的代码中使用MAPE,但我遇到了以下错误:“
/Users/runner/minifeg3/conda bld/XGBoost_1593723618214/work/src/metric/metric.cc:49:未知度量函数MAPE
”。我读到最近的XGBoost升级没有这个指标,但是在文档中提到了MAPE,我需要使用它。有人知道我应该如何实施吗?下面是我正在使用的代码

先谢谢你

params = {
# Parameters that we are going to tune.
'max_depth':6,
'min_child_weight': 1,
'eta':.3,
'subsample': 1,
'colsample_bytree': 1,
# Other parameters
'objective':'reg:squarederror', } 

}  
params['eval_metric'] = "mape"
num_boost_round = 999

model = xgb.train(
    params,
    D_train,
    num_boost_round=num_boost_round,
    evals=[(D_test, "Test")],
    early_stopping_rounds=10
)

您的答案有一些格式问题。努力改进这一点。路径和代码片段使用
`
括号。不要使用称呼语: