summaryrefslogtreecommitdiff
path: root/lib/model.py
diff options
context:
space:
mode:
authorDaniel Friesel <daniel.friesel@uos.de>2022-01-05 15:56:24 +0100
committerDaniel Friesel <daniel.friesel@uos.de>2022-01-05 15:56:24 +0100
commit6e2fa5f36deb9882e5bddb212695434c219c3d94 (patch)
tree0c47200b6112076d5ae2ce3e58a45a060783b0e2 /lib/model.py
parent2c5bcd77f2c952cc5269ca3e4b6e0a7323ebd085 (diff)
store decision tree attributes of xv models in dataref export
Diffstat (limited to 'lib/model.py')
-rw-r--r--lib/model.py18
1 files changed, 17 insertions, 1 deletions
diff --git a/lib/model.py b/lib/model.py
index 4f5f60f..5a44c7b 100644
--- a/lib/model.py
+++ b/lib/model.py
@@ -449,7 +449,9 @@ class AnalyticModel:
threshold=threshold,
)
- def to_dref(self, static_quality, lut_quality, model_quality) -> dict:
+ def to_dref(
+ self, static_quality, lut_quality, model_quality, xv_models=None
+ ) -> dict:
ret = dict()
for name in self.names:
param_data = {
@@ -546,6 +548,20 @@ class AnalyticModel:
)
except KeyError:
logger.warning(f"{name} {attr_name} param model has no MAPE")
+
+ if xv_models is not None:
+ keys = ("decision tree/nodes", "decision tree/max depth")
+ entry = dict()
+ for k in keys:
+ entry[k] = list()
+ for xv_model in xv_models:
+ dref = xv_model.attr_by_name[name][attr_name].to_dref()
+ for k in keys:
+ if k in dref:
+ entry[k].append(dref[k])
+ for k in keys:
+ if len(entry[k]):
+ ret[k] = np.mean(entry[k])
return ret
def to_json(self, **kwargs) -> dict: