diff options
author | Daniel Friesel <daniel.friesel@uos.de> | 2021-10-25 16:31:43 +0200 |
---|---|---|
committer | Daniel Friesel <daniel.friesel@uos.de> | 2021-10-25 16:31:43 +0200 |
commit | 7fdc290f9bb3f3f8d437350601d2c805163ceed5 (patch) | |
tree | 8a96f4a5db1176dea6073027dc4a9d0c0449d791 /lib | |
parent | 7be592c83a5bae37c4c3dc4aad571d79ebed8614 (diff) |
dataref export: handle missing MAPE entries
Diffstat (limited to 'lib')
-rw-r--r-- | lib/model.py | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/lib/model.py b/lib/model.py index f926495..749eebb 100644 --- a/lib/model.py +++ b/lib/model.py @@ -415,15 +415,27 @@ class AnalyticModel: e_model["smape"], r"\percent", ) - ret[f"error/static/{name}/{attr_name}/mape"] = ( - e_static["mape"], - r"\percent", - ) - ret[f"error/lut/{name}/{attr_name}/mape"] = (e_lut["mape"], r"\percent") - ret[f"error/model/{name}/{attr_name}/mape"] = ( - e_model["mape"], - r"\percent", - ) + try: + ret[f"error/static/{name}/{attr_name}/mape"] = ( + e_static["mape"], + r"\percent", + ) + except KeyError: + logger.warning(f"{name} {attr_name} static model has no MAPE") + try: + ret[f"error/lut/{name}/{attr_name}/mape"] = ( + e_lut["mape"], + r"\percent", + ) + except KeyError: + logger.warning(f"{name} {attr_name} LUT model has no MAPE") + try: + ret[f"error/model/{name}/{attr_name}/mape"] = ( + e_model["mape"], + r"\percent", + ) + except KeyError: + logger.warning(f"{name} {attr_name} param model has no MAPE") return ret def to_json(self, **kwargs) -> dict: |