Page14/22
XGBoost — The Best Algorithm · Page 1 of 1
Why XGBoost Wins Kaggle
XGBoost — eXtreme Gradient Boosting
Gradient Boosting Recap
- Train a weak learner (shallow tree)
- Calculate residuals (errors)
- Train next tree to predict residuals
- Repeat N times, combining all trees
XGBoost = Optimized Gradient Boosting with:
- Parallel processing
- GPU support
- Built-in regularization
- Handles missing values
- Feature importance built-in
- Early stopping
Why Kaggle Winners Use It
Statistics:
- ~80% of Kaggle competition winners use XGBoost
- beats "pure" Deep Learning on tabular data
- Twice as fast as standard Gradient Boosting
Hyperparameters
| Parameter | Effect | Range |
|---|---|---|
max_depth | Deeper = more complex | 3-8 (typically) |
learning_rate | Step size in gradient descent | 0.01-0.3 |
n_estimators | Number of trees | 100-1000 |
subsample | Row sampling ratio | 0.5-1.0 |
colsample_bytree | Feature sampling ratio | 0.5-1.0 |
reg_lambda | L2 regularization | 0.1-10 |
reg_alpha | L1 regularization | 0.1-10 |
Pro Tips:
- Start with
max_depth=5, learning_rate=0.1, n_estimators=100 - Use
early_stoppingto avoid overfitting - Use
feature_importances_for feature selection - Set
scale_pos_weight = n_negatives / n_positivesfor imbalanced data
main.py
Loading...
OUTPUT
▶Click "Run Code" to execute…