Gradient boosting

Metody zespołowe w Pythonie

Román de las Heras

Data Scientist, Appodeal

Wprowadzenie do gradient boosting machine

function_objective.png

  1. Model początkowy (słaby estymator): $y\sim f_1(X)$
  2. Nowy model dopasowany do reszt: $y-f_1(X)\sim f_2(X)$
  3. Nowy model addytywny: $y\sim f_1(X)+f_2(X)$
  4. Powtórz $n$ razy lub do osiągnięcia wystarczająco małego błędu
  5. Końcowy model addytywny: $$y\sim f_1(X)+f_2(X)+ ... +f_n(x)=\sum_{i=1}^{n} f_i(X)$$
Metody zespołowe w Pythonie

Równoważność ze spadkiem gradientowym

function_residuals.png

Spadek gradientowy:

function_loss.png

function_gradient.png

Reszty = Ujemny gradient

function_gradient_negative.png

Metody zespołowe w Pythonie

Klasyfikator gradient boosting

Klasyfikator gradient boosting

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
    • Domyślnie: 100
  • learning_rate
    • Domyślnie: 0.1
  • max_depth
    • Domyślnie: 3
  • min_samples_split
  • min_samples_leaf
  • max_features
Metody zespołowe w Pythonie

Regresor gradient boosting

Regresor gradient boosting

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
)
Metody zespołowe w Pythonie

Czas na boosting!

Metody zespołowe w Pythonie

Preparing Video For Download...