Ensembles และการปรับ Hyperparameter

การพยากรณ์ CTR ด้วย Machine Learning ใน Python

Kevin Huo

Instructor

วิธี Ensemble

ตัวอย่าง Bootstrap Aggregation

  • Bagging: สุ่มเลือกตัวอย่างข้อมูลสำหรับแต่ละโมเดล จากนั้นฝึกโมเดลแยกกันแล้วนำมารวมกัน
การพยากรณ์ CTR ด้วย Machine Learning ใน Python

Random Forest

clf = RandomForestClassifier()
print(clf)
RandomForestClassifier(
  bootstrap=True,
  ...
  max_depth = 10,
  ...
  n_estimators = 100,
  ...)
การพยากรณ์ CTR ด้วย Machine Learning ใน Python

การปรับ Hyperparameter

  • Hyperparameter: พารามิเตอร์ที่กำหนดก่อนการฝึก และอยู่ภายนอกโมเดล
  • ตัวอย่างพารามิเตอร์ที่ไม่ใช่ Hyperparameter: ค่าสัมประสิทธิ์ความชันใน Linear Regression, น้ำหนักใน Logistic Regression เป็นต้น
  • ตัวอย่าง Hyperparameter: max_depth, n_estimators เป็นต้น
การพยากรณ์ CTR ด้วย Machine Learning ใน Python

Grid Search

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, ...)
การพยากรณ์ CTR ด้วย Machine Learning ใน Python

มาฝึกกันเถอะ!

การพยากรณ์ CTR ด้วย Machine Learning ใน Python

Preparing Video For Download...