CTR-Vorhersage mit Machine Learning in Python
Kevin Huo
Instructor

| is_student | loan | |
|---|---|---|
| middle_aged | 1 | |
| youth | no | 0 |
| youth | yes | 1 |
clf = DecisionTreeClassifier()Wie bei logistischer Regression: clf.fit(X_train, y_train) trainiert, clf.predict(X_test) sagt Labels voraus:
array([0, 1, 1, ..., 1, 0, 1])
clf.predict_proba(X_test) für Wahrscheinlichkeiten:
array([0.2, 0.8], [0.4, 0.6] ..., [0.1, 0.9] [0.3, 0.7]])
Beispiel für zufälliges Train/Test-Split, Test = 30% der Stichprobe: 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() Eingaben: Test- und Score-Arraysroc_auc = auc(fpr, tpr)
auc() Eingaben: False-Positive- und True-Positive-Arrays
Wenn das Modell genau ist und die CTR niedrig bleibt, prüfe Anzeigentext und Zielgruppe neu
CTR-Vorhersage mit Machine Learning in Python