Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the default value of n_estimators in xgboost model?

I am using gridsearchCV to tune the parameters (lambda, gamma, max_depth, eta) of the xgboost classifier model. I don't set early stopping or n_estimator value. And it takes a lot of time to run gs.fit(). I want to know is there a default value of n_estimators for xgboost. Thank you !

like image 326
Wenhui Hu Avatar asked Oct 19 '25 18:10

Wenhui Hu


2 Answers

In version 1.5, the sklearn-API version XGBClassifier defaults to 100, whereas the native-API defaults to 10.

like image 64
Ben Reiniger Avatar answered Oct 22 '25 03:10

Ben Reiniger


Default values for XGBClassifier:

n_estimators=100

Details are available here: https://xgboost.readthedocs.io/en/latest/parameter.html

XGBClassifier(base_score=0.5, booster='gbtree', colsample_bylevel=1,
              colsample_bynode=1, colsample_bytree=1, gamma=0, gpu_id=-1,
              importance_type='gain', interaction_constraints='',
              learning_rate=0.300000012, max_delta_step=0, max_depth=6,
              min_child_weight=1, missing=nan, monotone_constraints='()',
              n_estimators=100, n_jobs=12, num_parallel_tree=1,
              objective='multi:softprob', random_state=0, reg_alpha=0,
              reg_lambda=1, scale_pos_weight=None, subsample=1,
              tree_method='exact', use_label_encoder=False,
              validate_parameters=1, verbosity=None)
like image 27
uditgt Avatar answered Oct 22 '25 04:10

uditgt