Gradient boosting

Ensemble Methods in Python

Román de las Heras

Data Scientist, Appodeal

Introducción a gradient boosting

function_objective.png

  1. Modelo inicial (estimador débil): $y\sim f_1(X)$
  2. Nuevo modelo ajusta a los residuales: $y-f_1(X)\sim f_2(X)$
  3. Nuevo modelo aditivo: $y\sim f_1(X)+f_2(X)$
  4. Repite $n$ veces o hasta que el error sea suficientemente pequeño
  5. Modelo aditivo final: $$y\sim f_1(X)+f_2(X)+ ... +f_n(x)=\sum_{i=1}^{n} f_i(X)$$
Ensemble Methods in Python

Equivalencia con descenso por gradiente

function_residuals.png

Descenso por gradiente:

function_loss.png

function_gradient.png

Residuales = Gradiente negativo

function_gradient_negative.png

Ensemble Methods in Python

Gradient boosting classifier

Gradient Boosting Classifier

from sklearn.ensemble import GradientBoostingClassifier
clf_gbm = GradientBoostingClassifier(
   n_estimators=100,
   learning_rate=0.1,
   max_depth=3,
   min_samples_split,
   min_samples_leaf,
   max_features
)
  • n_estimators
    • Predeterminado: 100
  • learning_rate
    • Predeterminado: 0.1
  • max_depth
    • Predeterminado: 3
  • min_samples_split
  • min_samples_leaf
  • max_features
Ensemble Methods in Python

Gradient boosting regressor

Gradient Boosting Regressor

from sklearn.ensemble import GradientBoostingRegressor
reg_gbm = GradientBoostingRegressor(
   n_estimators=100,
   learning_rate=0.1,
   max_depth=3,
   min_samples_split,
   min_samples_leaf,
   max_features
)
Ensemble Methods in Python

¡Hora de hacer boosting!

Ensemble Methods in Python

Preparing Video For Download...