用 Python 透過機器學習預測 CTR
Kevin Huo
Instructor

C 為正規化強度的倒數。C=0.05 < C=0.5 < C=1max_depth 控制樹可延伸的層數。max_depth=3 < max_depth=5 < max_depth=10
k 個折疊中,每次以其中 1 折作為測試(驗證)集,其餘 k-1 折作為訓練集。k 次模型效能評估。k_fold = KFold(n_splits = 4, random_state = 0, shuffle = True)
for i in [3, 5, 10]:
clf = DecisionTreeClassifier(max_depth = i)
cv_precision = cross_val_score(
clf, X_train, y_train, cv = k_fold,
scoring = 'precision_weighted')
precision_weighted, recall_weighted, roc_auc用 Python 透過機器學習預測 CTR