Model Pipeline - Gradient Boosting (GBM)
Gradient Boosting builds a strong prediction model by combining many small decision trees. Each tree learns from the mistakes of the previous ones, improving the overall accuracy step by step.
Jump into concepts and practice - no test required
Gradient Boosting builds a strong prediction model by combining many small decision trees. Each tree learns from the mistakes of the previous ones, improving the overall accuracy step by step.
Loss
0.5 |***************
0.4 |**********
0.3 |*******
0.2 |****
0.1 |**
+----------------
1 10 50 100 Epochs
| Epoch | Loss ↓ | Accuracy ↑ | Observation |
|---|---|---|---|
| 1 | 0.45 | 0.65 | Initial tree reduces error significantly |
| 10 | 0.30 | 0.78 | Model improves as more trees are added |
| 50 | 0.18 | 0.88 | Loss steadily decreases, accuracy rises |
| 100 | 0.12 | 0.92 | Model converges with good accuracy |
from sklearn.ensemble import GradientBoostingRegressor X = [[1], [2], [3], [4]] y = [2, 4, 6, 8] gbm = GradientBoostingRegressor(n_estimators=100, learning_rate=0.1) gbm.fit(X, y) pred = gbm.predict([[5]]) print(round(pred[0], 1))
from sklearn.ensemble import GradientBoostingClassifier X = [[0], [1], [2]] y = [0, 1, 0] gbm = GradientBoostingClassifier(n_estimators='100') gbm.fit(X, y)