+1 vote

Best answer

If you have used sklearn wrapper of xgboost, you can use function * get_xgb_params()* to retrieve hyperparameters of the saved model. If you have used the core xgboost, I am not sure if there exists a function.

Here is an example:

bst = pickle.load(open(modelName, 'rb'))

print(bst.get_xgb_params())

The above code will display an output something like the following:

{'base_score': 0.5, 'booster': 'gbtree', 'colsample_bylevel': 1, 'colsample_bynode': 1, 'colsample_bytree': 0.5, 'gamma': 0.01, 'learning_rate': 0.1, 'max_delta_step': 0, 'max_depth': 5, 'min_child_weight': 0, 'missing': nan, 'n_estimators': 39, 'nthread': 8, 'objective': 'binary:logistic', 'reg_alpha': 0, 'reg_lambda': 1, 'scale_pos_weight': 63.6, 'seed': 1234, 'silent': 1, 'subsample': 0.9, 'verbosity': 1, 'eta': 0.2}