From 585c71d1a580b3394ffa25d489562139e8060b5d Mon Sep 17 00:00:00 2001 From: "Daniel.Frisinghelli" <daniel.frisinghelli@eurac.edu> Date: Tue, 16 Feb 2021 15:30:28 +0100 Subject: [PATCH] Fixed a bug: Add classification report after computing confusion matrix. --- pysegcnn/core/trainer.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pysegcnn/core/trainer.py b/pysegcnn/core/trainer.py index 39e677d..88e0fc6 100644 --- a/pysegcnn/core/trainer.py +++ b/pysegcnn/core/trainer.py @@ -2738,7 +2738,6 @@ class NetworkInference(BaseConfig): # compute k-fold average estimate of each metric across all models LOGGER.info('Calculating k-fold estimate of metrics ...') report = df.groupby(df.index, sort=False).mean() - inference['report'] = report # labels to predict labels = list(report.index.drop(['macro avg', 'weighted avg', @@ -2749,7 +2748,7 @@ class NetworkInference(BaseConfig): report_name = self.report_path.joinpath(self.report_name(kfold)) fig.savefig(report_name, dpi=300, bbox_inches='tight') - # chech whether to compute the aggregated confusion matrix + # check whether to compute the aggregated confusion matrix if self.cm: # initialize the aggregated confusion matrix cm_agg = np.zeros(shape=2 * (len(labels), )) @@ -2765,4 +2764,7 @@ class NetworkInference(BaseConfig): plot_confusion_matrix(cm_agg, labels, state_file=kfold, outpath=self.perfmc_path) + # add aggregated classification report + inference['report'] = report + return inference -- GitLab