CTR voorspellen met Machine Learning in Python
Kevin Huo
Instructor

| is_student | loan | |
|---|---|---|
| middle_aged | 1 | |
| youth | no | 0 |
| youth | yes | 1 |
clf = DecisionTreeClassifier()Net als bij logistische regressie: clf.fit(X_train, y_train) trainen en clf.predict(X_test) voor labels:
array([0, 1, 1, ..., 1, 0, 1])
clf.predict_proba(X_test) voor kansen:
array([0.2, 0.8], [0.4, 0.6] ..., [0.1, 0.9] [0.3, 0.7]])
Voorbeeld: willekeurig train/test splitsen met 30% testdata: train_test_split(X, y, test_size = .3, random_state = 0)

Y_score = clf.predict_proba(X_test)
fpr, tpr, thresholds = roc_curve(Y_test, Y_score[:, 1])
roc_curve() input: test- en score-arraysroc_auc = auc(fpr, tpr)
auc() input: false-positive en true-positive arrays
Is het model accuraat en is de CTR laag? Herzie dan de boodschap van de advertentie en de doelgroep
CTR voorspellen met Machine Learning in Python