Ensemble dan penyetelan hyperparameter

Memprediksi CTR dengan Machine Learning di Python

Kevin Huo

Instructor

Metode ensemble

Contoh bootstrap aggregation

  • Bagging: sampel acak dipilih untuk beberapa model, tiap model dilatih, lalu digabungkan.
Memprediksi CTR dengan Machine Learning di Python

Random forest

clf = RandomForestClassifier()
print(clf)
RandomForestClassifier(
  bootstrap=True,
  ...
  max_depth = 10,
  ...
  n_estimators = 100,
  ...)
Memprediksi CTR dengan Machine Learning di Python

Penyetelan hyperparameter

  • Hyperparameter: parameter yang ditetapkan sebelum pelatihan, di luar model
  • Contoh parameter namun BUKAN hyperparameter: koefisien kemiringan pada regresi linear, bobot pada regresi logistik, dll.
  • Contoh hyperparameter: max_depth, n_estimators, dll.
Memprediksi CTR dengan Machine Learning di Python

Pencarian grid

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, ...)
Memprediksi CTR dengan Machine Learning di Python

Ayo berlatih!

Memprediksi CTR dengan Machine Learning di Python

Preparing Video For Download...