xgboost模型中n_estimators的默认值是多少?

Wen*_* Hu 3 parameters tree classification xgboost

我正在使用 gridsearchCV 来调整 xgboost 分类器模型的参数(lambda、gamma、max_depth、eta)。我没有设置提前停止或 n_estimator 值。并且运行gs.fit()需要花费很多时间。我想知道 xgboost 的 n_estimators 是否有默认值。谢谢 !

Ben*_*ger 5

在版本 1.5 中,sklearn-API 版本XGBClassifier 默认为 100,而 native-API默认为 10


小智 5

XGBClassifier 的默认值:

n_estimators=100
Run Code Online (Sandbox Code Playgroud)

详细信息请参见: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)
Run Code Online (Sandbox Code Playgroud)