Ensembles y ajuste de hiperparámetros

Predicción del CTR con Machine Learning en Python

Kevin Huo

Instructor

Métodos ensemble

Ejemplo de bootstrap aggregation

  • Bagging: se seleccionan muestras aleatorias para distintos modelos, se entrenan por separado y luego se combinan.
Predicción del CTR con Machine Learning en Python

Random forests

clf = RandomForestClassifier()
print(clf)
RandomForestClassifier(
  bootstrap=True,
  ...
  max_depth = 10,
  ...
  n_estimators = 100,
  ...)
Predicción del CTR con Machine Learning en Python

Ajuste de hiperparámetros

  • Hiperparámetro: parámetro configurado antes del entrenamiento y externo al modelo
  • Ejemplos de parámetros que NO son hiperparámetros: coeficiente de pendiente en regresión lineal, pesos en regresión logística, etc.
  • Ejemplos de hiperparámetros: max_depth, n_estimators, etc.
Predicción del CTR con Machine Learning en Python

Búsqueda en malla

param_grid = {'n_estimators': n_estimators, 
              'max_depth': max_depth}
clf = GridSearchCV(estimator = model, 
                   param_grid = param_grid, 
                   scoring = 'roc_auc')
print(clf.best_score_)
print(clf.best_estimator_)
0.6777
RandomForestClassifier(max_depth = 100, ...)
Predicción del CTR con Machine Learning en Python

¡Vamos a practicar!

Predicción del CTR con Machine Learning en Python

Preparing Video For Download...