Retrieve hyperparameters from a fitted xgboost model object

Viewed 207

Is there a way to retrieve from the fitted xgboost object the hyper-parameters used to train the model. More specifically, I would like to know the number of estimators (i.e. trees) used in the model. Since I am using early stopping, the n_estimator parameter would not give me the resulting number of estimators in the model.

2 Answers

If you are trying to get the parameters of your model: print(model.get_xgb_params())

model.get_params(deep=True) should show n_estimators

Then use model.get_xgb_params() for xgboost specific parameters.

Related