Created
January 9, 2021 12:15
-
-
Save davidzhaodz/393e238f165f350e7add807e907e9947 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Performance Metrics | |
y_pred_rf = rf.predict_proba(X_test)[:, 1] | |
y_pred = rf.predict(X_test) | |
fpr_rf, tpr_rf, _ = roc_curve(y_test, y_pred_rf) | |
print(classification_report(y_test, y_pred)) | |
print("Confusion Matrix") | |
print(confusion_matrix(y_test, y_pred)) | |
print('') | |
print("Accuracy") | |
print(accuracy_score(y_test, y_pred)) | |
#plotting ROC curve | |
plt.figure(1) | |
plt.plot([0, 1], [0, 1], 'k--') | |
plt.plot(fpr_rf, tpr_rf, label='RF') | |
plt.xlabel('False positive rate') | |
plt.ylabel('True positive rate') | |
plt.title('ROC curve') | |
plt.legend(loc='best') | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment