Python으로 Machine Learning을 활용한 CTR 예측
Kevin Huo
Instructor

| is_student | loan | |
|---|---|---|
| middle_aged | 1 | |
| youth | no | 0 |
| youth | yes | 1 |
clf = DecisionTreeClassifier()로지스틱 회귀와 유사하게, 학습은 clf.fit(X_train, y_train), 예측 라벨은 clf.predict(X_test):
array([0, 1, 1, ..., 1, 0, 1])
확률 예측: clf.predict_proba(X_test)
array([0.2, 0.8], [0.4, 0.6] ..., [0.1, 0.9] [0.3, 0.7]])
학습/테스트를 무작위 분할(테스트 30%): 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() 입력: 테스트 라벨과 스코어 배열roc_auc = auc(fpr, tpr)
auc() 입력: 위양성, 진양성 배열
모델이 정확하고 CTR이 낮다면, 광고 메시지 전달 방식과 타깃 오디언스를 재검토하십시오
Python으로 Machine Learning을 활용한 CTR 예측