写在前面:
每当提到损失函数,很多人都有个误解,以为用在GridSearchCV(网格搜索交叉验证“Cross Validation”)里边的scoring就是损失函数,其实并不是。我们使用构造函数构造XGBRegressor的时候,里边的objective参数才是真正的损失函数(loss function)。xgb使用sklearn api的时候需要用到的损失函数,其返回值是一阶导和二阶导,而GridSearchCV使用的scoring函数,返回的是一个float类型的数值评分(或叫准确率、或叫偏差值)。
You should be careful with the notation.
There are 2 levels of optimization here:
- The loss function optimized when the
XGBRegressor
is fitted to the data.- The scoring function that is optimized during the grid search.
I prefer calling the seco