Henry
Henry

Reputation: 85

XGBoost: why does test error increase when train error decreases in XGBoost?

When I train the model by xgboost and I find "eval-merror" is increasing and "train-merror" is decreasing as below;is something in error?

enter image description here

Upvotes: 0

Views: 2084

Answers (1)

ftiaronsem
ftiaronsem

Reputation: 1584

You are likely overfitting. Have you tried setting early_stopping_rounds? This will terminate the training once xgboost detects that the validation error is increasing.

If this behavior occurs from the very first training step on, you might want to try a smaller learning rate (called eta).

You can find more information on the just mentioned parameters in the api reference: http://xgboost.readthedocs.io/en/latest/python/python_api.html

Upvotes: 1

Related Questions