Created
August 3, 2018 21:20
-
-
Save ImadDabbura/0786fbbeae838e6571bd977599d90c7f to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| # Plot confusion matrix | |
| second_stack_probs = second_stack.predict_proba(first_stack.transform(X_test)) | |
| second_stack_preds = second_stack.predict(first_stack.transform(X_test)) | |
| conf_mat = confusion_matrix(y_test, second_stack_preds) | |
| plt.figure(figsize=(16, 8)) | |
| plt.matshow(conf_mat, cmap=plt.cm.Reds, alpha=0.2) | |
| for i in range(2): | |
| for j in range(2): | |
| plt.text(x=j, y=i, s=conf_mat[i, j], ha="center", va="center") | |
| plt.title("Confusion matrix", y=1.1, fontdict={"fontsize": 20}) | |
| plt.xlabel("Predicted", fontdict={"fontsize": 14}) | |
| plt.ylabel("Actual", fontdict={"fontsize": 14}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment