Python ile Machine Learning kullanarak TOB tahmini
Kevin Huo
Instructor

| is_student | loan | |
|---|---|---|
| middle_aged | 1 | |
| youth | no | 0 |
| youth | yes | 1 |
clf = DecisionTreeClassifier()Lojistik regresyona benzer biçimde, karar ağacı da eğitim için clf.fit(X_train, y_train) ve test etiketleri için clf.predict(X_test) kullanır:
array([0, 1, 1, ..., 1, 0, 1])
Olasılık puanları için clf.predict_proba(X_test):
array([0.2, 0.8], [0.4, 0.6] ..., [0.1, 0.9] [0.3, 0.7]])
Eğitim ve test verisini rastgele ayırma örneği; test verisi toplamın %30’u: 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() girdileri: test ve skor dizileriroc_auc = auc(fpr, tpr)
auc() girdileri: yanlış-pozitif ve doğru-pozitif dizileri
Model doğruysa ve TOB düşükse, reklam mesajını ve hedef kitleyi yeniden değerlendirmeniz gerekebilir
Python ile Machine Learning kullanarak TOB tahmini