XGBoost 中 multi-class classification 的损失函数是哪个?

Which is the loss function for multi-class classification in XGBoost?

我想知道哪个损失函数使用 XGBoost 进行多重class class化。我发现 logistic classification 在二元情况下的损失函数。

虽然对于 multi-class 情况,它可能与 GBM 相同(对于 K classes)which can be seen here, where y_k=1 if x's label is k and 0 in any other case, and p_k(x) is the softmax function. However, I have made the first and second order gradient using this loss function and the hessian doesn't match the one defined in the code here(在 SoftmaxMultiClassObj 中的 GetGradient 函数中)常数 2.

请问使用的损失函数是哪个?

提前致谢。

给出了一个很好的例子:

http://machinelearningmastery.com/avoid-overfitting-by-early-stopping-with-xgboost-in-python/

基本上,你可以用"eval_metric"参数来定义损失函数。 (回归默认为rmse,分类默认为error)

"error" 函数的描述在官方 github 仓库中给出:

""error":二分类错误率,计算方式为#(wrong cases)/#(all cases)。对于预测,评估会将预测值大于0.5的实例作为正例,其他为负例。

也可以在 https://github.com/dmlc/xgboost/blob/master/doc/parameter.md

的 "Learning Task Parameters" 部分找到可用评估指标的完整列表

希望这能回答您的问题,祝您好运,

用于 multiclass 的损失函数,如您所料,是 softmax objective 函数。截至目前,multiclass 的唯一选项显示在下面的引用中,multi:softprob 返回所有概率,而不仅仅是最有可能的 class.

“multi:softmax” –set XGBoost to do multiclass classification using the softmax objective, you also need to set num_class(number of classes)

“multi:softprob” –same as softmax, but output a vector of ndata * nclass, which can be further reshaped to ndata, nclass matrix. The result contains predicted probability of each data point belonging to each class.

参见https://xgboost.readthedocs.io/en/latest//parameter.html#learning-task-parameters