以下代码不起作用,在哪里aucerr
和是自定义评估指标,aoeerr
它只使用一个eval_metric
或aucerr
aoeerr
prtXGB.fit(trainData, targetVar, early_stopping_rounds=10,
eval_metric= [aucerr, aoeerr], eval_set=[(valData, valTarget)])
但是,以下具有内置评估指标的代码正在运行
prtXGB.fit(trainData, targetVar, early_stopping_rounds=10,
eval_metric= ['auc', 'logloss'], eval_set=[(valData, valTarget)])
这是我的自定义函数
def aucerr(y_predicted, y_true):
labels = y_true.get_label()
auc1 = metrics.roc_auc_score(labels,y_predicted)
return 'AUCerror', abs(1-auc1)
def aoeerr(y_predicted, y_true):
labels = y_true.get_label()
actuals = sum(labels)
predicted = sum(y_predicted)
ae = actuals/predicted
return 'AOEerror', abs(1-ae)