From 7482680f458ce7f96807ea5ada3f5b7a9e5ca4de Mon Sep 17 00:00:00 2001 From: Florian Maurer Date: Tue, 31 Oct 2023 11:32:40 +0100 Subject: [PATCH] fix unset reward --- assume/common/outputs.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/assume/common/outputs.py b/assume/common/outputs.py index 3e5e21f0..3f0b96f2 100644 --- a/assume/common/outputs.py +++ b/assume/common/outputs.py @@ -411,8 +411,10 @@ def get_sum_reward(self): f"select reward FROM rl_params where simulation='{self.simulation_id}'" ) + avg_reward = 0 with self.db.begin() as db: reward = db.execute(query).fetchall() + if len(reward): avg_reward = sum(r[0] for r in reward) / len(reward) return avg_reward