From 4febb79a14d191a28fae92b27f0919d86ed91089 Mon Sep 17 00:00:00 2001 From: juaristi22 Date: Mon, 30 Jun 2025 18:09:11 +0100 Subject: [PATCH] fix negative values in rel_abs_error --- changelog_entry.yaml | 4 ++++ src/microcalibrate/utils/log_performance.py | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/changelog_entry.yaml b/changelog_entry.yaml index e69de29..75fc07d 100644 --- a/changelog_entry.yaml +++ b/changelog_entry.yaml @@ -0,0 +1,4 @@ +- bump: patch + changes: + changed: + - Taking abs val for abs_rel_error denominator. diff --git a/src/microcalibrate/utils/log_performance.py b/src/microcalibrate/utils/log_performance.py index d4750b2..ce67dce 100644 --- a/src/microcalibrate/utils/log_performance.py +++ b/src/microcalibrate/utils/log_performance.py @@ -54,7 +54,9 @@ def log_performance_over_epochs( "error": err, "abs_error": abs(err), "rel_abs_error": ( - abs(err) / target_val if target_val != 0 else np.nan + abs(err) / abs(target_val) + if target_val != 0 + else np.nan ), } )