# Is n_estimators in BaggingRegressor() the number of trees or data subsets?

I'm learning about using the BaggingRegressor() from scikit learn (https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.BaggingRegressor.html)

Its n_estimators parameter is defined as:

n_estimators: int, default=10
The number of base estimators in the ensemble.


Am I right in thinking this changes the number of tree-based models running in total?

For example, I am using xgboost, If I set

BaggingRegressor(n_estimators=100)


is it changing the n_estimators in xgb to be:

• xgboost.XGBRegressor(n_estimators=100) or does it do
• xgboost.XGBRegressor()*100?

Also what within BaggingRegressor() decides the number of random subsets to be created if it's not the number of base estimators?

It is the number of base estimators (not necessarily tree-based). So, if you give XGBoost as the base estimator, which I think is a bit complex to be a base estimator, it'll use 100 XGBoost models. XGBoost itself has n_estimators hyper-parameter but BaggingRegressor does not change it. It treats your estimator object as black-box.