From 61cf839831928f2d5d6c4efb227b6e8ae8b292f3 Mon Sep 17 00:00:00 2001 From: tomrink <rink@ssec.wisc.edu> Date: Tue, 18 May 2021 11:27:35 -0500 Subject: [PATCH] minor... --- modules/deeplearning/icing_cnn.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/modules/deeplearning/icing_cnn.py b/modules/deeplearning/icing_cnn.py index 15a743ed..985e7032 100644 --- a/modules/deeplearning/icing_cnn.py +++ b/modules/deeplearning/icing_cnn.py @@ -617,12 +617,25 @@ class IcingIntensityNN: for mini_batch_test in tst_ds: self.test_step(mini_batch_test) + recall = self.test_recall.result() + precsn = self.test_precision.result() + f1 = 2 * (precsn * recall) / (precsn + recall) + + tn = self.test_true_neg.result() + tp = self.test_true_pos.result() + fn = self.test_false_neg.result() + fp = self.test_false_pos.result() + + mcc = ((tp * tn) - (fp * fn)) / np.sqrt((tp + fp) * (tp + fn) * (tn + fp) * (tn + fn)) + with self.writer_valid.as_default(): tf.summary.scalar('loss_val', self.test_loss.result(), step=step) tf.summary.scalar('acc_val', self.test_accuracy.result(), step=step) tf.summary.scalar('auc_val', self.test_auc.result(), step=step) tf.summary.scalar('recall_val', self.test_recall.result(), step=step) tf.summary.scalar('prec_val', self.test_precision.result(), step=step) + tf.summary.scalar('f1_val', f1, step=step) + tf.summary.scalar('mcc_val', mcc, step=step) tf.summary.scalar('num_train_steps', step, step=step) tf.summary.scalar('num_epochs', epoch, step=step) -- GitLab