summaryrefslogtreecommitdiff
path: root/lib/model.py
diff options
context:
space:
mode:
authorDaniel Friesel <daniel.friesel@uos.de>2021-10-25 16:31:43 +0200
committerDaniel Friesel <daniel.friesel@uos.de>2021-10-25 16:31:43 +0200
commit7fdc290f9bb3f3f8d437350601d2c805163ceed5 (patch)
tree8a96f4a5db1176dea6073027dc4a9d0c0449d791 /lib/model.py
parent7be592c83a5bae37c4c3dc4aad571d79ebed8614 (diff)
dataref export: handle missing MAPE entries
Diffstat (limited to 'lib/model.py')
-rw-r--r--lib/model.py30
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: