Created
February 11, 2019 09:57
-
-
Save nithyadurai87/7668ce262ed9070d89b158bb7f13c5cb 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
from sklearn.metrics import precision_recall_fscore_support | |
from sklearn.metrics import accuracy_score | |
from sklearn.metrics import confusion_matrix | |
import matplotlib.pyplot as plt | |
y_true = [0, 0, 0, 0, 0, 1, 1, 1, 1, 1] | |
y_pred = [0, 1, 0, 0, 0, 0, 0, 1, 1, 1] | |
print ('Accuracy:', accuracy_score(y_true, y_pred)) | |
print (confusion_matrix(y_true, y_pred)) | |
print (precision_recall_fscore_support(y_true, y_pred)) | |
plt.matshow(confusion_matrix(y_true, y_pred)) | |
plt.title('Confusion matrix') | |
plt.colorbar() | |
plt.ylabel('True label') | |
plt.xlabel('Predicted label') | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment