diff --git a/modules/icing/pirep_goes.py b/modules/icing/pirep_goes.py index f49aabdd65cdfd1ea8516536c15ee865437317c6..5e901b162ffcdf13e07011255c20db246b991af2 100644 --- a/modules/icing/pirep_goes.py +++ b/modules/icing/pirep_goes.py @@ -2609,6 +2609,10 @@ def analyze(preds_file, labels, prob_avg, test_file): preds = np.where(prob_avg > 0.5, 1, 0) + num_0 = np.sum(nda == 0) + num_1 = np.sum(nda == 1) + num_2 = np.sum(nda == 2) + true_ice = (labels == 1) & (preds == 1) false_ice = (labels == 0) & (preds == 1) @@ -2643,6 +2647,10 @@ def analyze(preds_file, labels, prob_avg, test_file): mcc_1 = ((tp_1 * tn_1) - (fp_1 * fn_1)) / np.sqrt((tp_1 + fp_1) * (tp_1 + fn_1) * (tn_1 + fp_1) * (tn_1 + fn_1)) mcc_2 = ((tp_2 * tn_2) - (fp_2 * fn_2)) / np.sqrt((tp_2 + fp_2) * (tp_2 + fn_2) * (tn_2 + fp_2) * (tn_2 + fn_2)) + acc_0 = np.sum(labels[nda == 0] == preds[nda == 0]) / num_0 + acc_1 = np.sum(labels[nda == 1] == preds[nda == 1]) / num_1 + acc_2 = np.sum(labels[nda == 2] == preds[nda == 2]) / num_2 + print('Total (Positive/Icing Prediction: ') print('True icing: ', np.sum(true_ice & (nda == 0)), np.sum(true_ice & (nda == 1)), np.sum(true_ice & (nda == 2))) print('-------------------------') @@ -2656,6 +2664,7 @@ def analyze(preds_file, labels, prob_avg, test_file): print('* False icing (False Positive/False Alarm) *: ', np.sum(false_ice & (nda == 0)), np.sum(false_ice & (nda == 1)), np.sum(false_ice & (nda == 2))) print('-------------------------') + print('ACC: ', acc_0, acc_1, acc_2) print('Recall: ', recall_0, recall_1, recall_2) print('Precision: ', precision_0, precision_1, precision_2) print('MCC: ', mcc_0, mcc_1, mcc_2)