Predicting CTR with Machine Learning in Python
Kevin Huo
Instructor
C
parameter is the inverse of the regularization strength.C=0.05 < C=0.5 < C=1
max_depth
parameter controls how many layers deep the tree can grow.max_depth=3 < max_depth=5 < max_depth=10
k
folds, that fold will be used as a testing set (for validation) while other k-1
are used as training.k
evaluations of model performance.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
Predicting CTR with Machine Learning in Python