XGBoost Subsampling · Row and Column Sampling Strategies

Subsampling introduces randomness into XGBoost training, creating an ensemble of slightly different trees. This is a first-order defense against overfitting, analogous to bagging in Random Forests but applied to gradient boosting.

Four Levels of Subsampling

subsample — Row Sampling

Fraction of training instances used to grow each tree. Sampled without replacement.

model = xgb.XGBRegressor(subsample=0.8)

Each tree sees 80% of the training data — different 80% each round. The 20% held out provides an implicit validation signal (trees that overfit to the 80% may perform worse on the 20%). Values below 0.5 lose too much information and degrade performance.

colsample_bytree — Column Sampling per Tree

Fraction of features used per tree. All nodes within a tree see the same feature subset.

model = xgb.XGBRegressor(colsample_bytree=0.8)

Each tree is built from a random 80% of features. This forces trees to rely on different feature combinations, reducing co-adaptation.

colsample_bylevel — Column Sampling per Level

Fraction of features used per level (depth). Each level of each tree sees a different feature subset.

model = xgb.XGBRegressor(colsample_bylevel=0.8)

More aggressive than bytree — features are resampled at every depth increment, not just per tree. Rarely used as the primary column sampling method but can be combined with bytree for additional regularization in very high-dimensional settings.

colsample_bynode — Column Sampling per Node

Fraction of features used per split (node). The most granular — every split considers a different random feature subset. This is the closest analog to Random Forest’s feature sampling.

model = xgb.XGBRegressor(colsample_bynode=0.8)

Relationship Between Levels

$ \text{colsample_bynode} \subseteq \text{colsample_bylevel} \subseteq \text{colsample_bytree} \subseteq \text{full feature set} $

The hierarchical nature means combining them produces a product effect: colsample_bytree=0.8 with colsample_bylevel=0.8 → each level sees 0.8 × 0.8 = 64% of features.

Standard: subsample=0.8

  • Good default for most problems. Provides regularization without significant accuracy cost.

High-dimensional (>1,000 features): colsample_bytree=0.5, colsample_bylevel=0.8

  • Reduces training time and memory proportionally. Forces feature diversity.

Overfitting heavily: subsample=0.7, colsample_bytree=0.6

  • Aggressive regularization. May need more n_estimators to compensate.

Tiny datasets (<1,000 rows): Disable or use very mild subsampling (subsample=0.9). Aggressive subsampling on small data loses too much signal.

The Bagging Analogy

xgboost-org 配图

In Random Forest: each tree sees a bootstrap sample of rows + random subset of features → decorrelated trees → variance reduction through averaging.

In XGBoost with subsampling: each tree sees a random subset of rows + random subset of features → partially decorrelated trees → overfitting reduction. The key difference: XGBoost trees are not independent (each builds on previous residuals), so subsampling provides weaker decorrelation than bagging — but still reduces overfitting substantially in practice.