我正在使用Python运行XGBoost XGBRegressor,并使用以下数据集:
click_id | manufacturer | category | delivery_time | price | revenue
1 |10 | 100 | 24 | 100 | 0
2 |10 | 100 | 24 | 100 | 0
3 |10 | 100 | 24 | 100 | 0
4 |10 | 100 | 24 | 100 | 120
5 |20 | 200 | 48 | 200 | 0
其中,收益是因变量,其余变量均为特征。
当我设置eval_metric为“mae”(平均绝对误差)时,训练和验证误差不断增加。为什么训练误差会增加?是否存在任何情况(模型参数的任何组合或奇怪的数据点),可能导致xgboost训练误差增加?
以下是代码:
model = XGBRegressor(
learning_rate=0.1,
n_estimators=200,
max_depth=5,
min_child_weight=1,
gamma=0,
subsample=0.9,
colsample_bytree=0.9,
reg_alpha=10,
nthread=4)
model.fit(X_train, y_train,
eval_set=[(X_train, y_train), (X_test, y_test)], eval_metric='mae')
当设置eval_metric为"rmse"时,训练误差按预期减少。
criterion='mae'
时,训练速度也非常慢。 - byrony