From 52efebe53ef3953c4b992856b88b4cea21378ef2 Mon Sep 17 00:00:00 2001 From: Pavan Mandava Date: Wed, 29 Jul 2020 20:47:09 +0200 Subject: [PATCH] WIP : Matplotlib confusion matrix plot has issues --- eval/metrics.py | 3 ++- run.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/eval/metrics.py b/eval/metrics.py index 072fc5a..f10ee8f 100644 --- a/eval/metrics.py +++ b/eval/metrics.py @@ -172,7 +172,7 @@ def get_confusion_matrix(y_true, y_pred): :param y_pred: Predicted labels :return: returns Confusion Matrix """ - return confusion_matrix(y_true, y_pred, const.CLASS_LABELS_LIST) + return confusion_matrix(y_true, y_pred, labels=const.CLASS_LABELS_LIST) def plot_confusion_matrix(confusion_mat, classifier_name): @@ -182,6 +182,7 @@ def plot_confusion_matrix(confusion_mat, classifier_name): :param classifier_name: Classifier Name to show it on the Top """ fig, ax = plt.subplots(2, 2) + plt.show() ax.matshow(confusion_mat, cmap='Greens') for x in (0, 2): for y in (0, 2): diff --git a/run.py b/run.py index 1cbccd2..1ee5a95 100644 --- a/run.py +++ b/run.py @@ -9,4 +9,4 @@ confusion_matrix = metrics.get_confusion_matrix(y_true, y_pred) print(confusion_matrix) -metrics.plot_confusion_matrix(confusion_matrix, "BiLSTM Classifier + Attention with ELMo") +# metrics.plot_confusion_matrix(confusion_matrix, "BiLSTM Classifier + Attention with ELMo")