Created
August 21, 2019 15:52
-
-
Save dipanjanS/3e33e69399b6a984d7f4f719de4b2f44 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
import pandas as pd | |
from sklearn.metrics import classification_report, confusion_matrix | |
def evaluate_model_results(model, test_data, test_labels, | |
class_label_mapping, class_labels): | |
predictions = model.predict(test_data, verbose=1) | |
prediction_labels = [class_label_mapping[idx] for idx in predictions.argmax(axis=1)] | |
print(classification_report(y_true=test_labels, y_pred=prediction_labels)) | |
return pd.DataFrame(confusion_matrix(y_true=test_labels, y_pred=prediction_labels, labels=class_labels), | |
index=class_labels, columns=class_labels) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment