Xgboost LinearSquareLoss('reg:squarederror') in regression_loss.h may have an inaccurate implementation


in this file https://github.com/dmlc/xgboost/blob/ae536756ae857a963093b974347c65b01a473993/src/objective/regression_loss.h

XGboost has the following implementation for MSE loss function

XGBOOST_DEVICE static bst_float FirstOrderGradient(bst_float predt, bst_float label) {
return predt - label;
XGBOOST_DEVICE static bst_float SecondOrderGradient(bst_float predt, bst_float label) {
return 1.0f;
shouldn’t the firstOrderGradient be 2*(predt - label) ?

for the secondOrderGradient it should return 2.

any thoughts ? thank you.


The loss function used in the implementation is 0.5 * (predt - label) * (predt - label).