summaryrefslogtreecommitdiff
path: root/lib/model.py
diff options
context:
space:
mode:
authorDaniel Friesel <daniel.friesel@uos.de>2021-12-03 10:39:10 +0100
committerDaniel Friesel <daniel.friesel@uos.de>2021-12-03 10:39:10 +0100
commitbaae23bd2bd5342adecfe3d404d55f5df2dd4826 (patch)
tree371b8c82e07ee837b954625338bf7f6d167d4b31 /lib/model.py
parente36a84688715f8d0a9af204dd823f548b4b2e4f9 (diff)
optionally ignore scalar parameters during dtree split generation
Diffstat (limited to 'lib/model.py')
-rw-r--r--lib/model.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/model.py b/lib/model.py
index f25e44f..e5d1647 100644
--- a/lib/model.py
+++ b/lib/model.py
@@ -157,8 +157,11 @@ class AnalyticModel:
with_nonbinary_nodes = bool(
int(os.getenv("DFATOOL_DTREE_NONBINARY_NODES", "1"))
)
+ loss_ignore_scalar = bool(
+ int(os.getenv("DFATOOL_DTREE_LOSS_IGNORE_SCALAR", "0"))
+ )
logger.debug(
- f"build_dtree({name}, {attr}, threshold={threshold}, with_function_leaves={with_function_leaves}, with_nonbinary_nodes={with_nonbinary_nodes})"
+ f"build_dtree({name}, {attr}, threshold={threshold}, with_function_leaves={with_function_leaves}, with_nonbinary_nodes={with_nonbinary_nodes}, loss_ignore_scalar={loss_ignore_scalar})"
)
self.build_dtree(
name,
@@ -166,6 +169,7 @@ class AnalyticModel:
threshold=threshold,
with_function_leaves=with_function_leaves,
with_nonbinary_nodes=with_nonbinary_nodes,
+ loss_ignore_scalar=loss_ignore_scalar,
)
self.fit_done = True
@@ -189,6 +193,7 @@ class AnalyticModel:
self.parameters,
self._num_args.get(name, 0),
codependent_param=codependent_param,
+ param_type=self.param_type_by_name[name],
)
self.attr_by_name[name][attr] = model_attr
paramstats.enqueue((name, attr), model_attr)
@@ -319,8 +324,11 @@ class AnalyticModel:
and attr in self.dtree_max_std[name]
):
threshold = self.dtree_max_std[name][attr]
+ loss_ignore_scalar = bool(
+ int(os.getenv("DFATOOL_DTREE_LOSS_IGNORE_SCALAR", "0"))
+ )
logger.debug(
- f"build_dtree({name}, {attr}, threshold={threshold}, with_function_leaves={with_function_leaves}, with_nonbinary_nodes={with_nonbinary_nodes})"
+ f"build_dtree({name}, {attr}, threshold={threshold}, with_function_leaves={with_function_leaves}, with_nonbinary_nodes={with_nonbinary_nodes}, loss_ignore_scalar={loss_ignore_scalar})"
)
self.build_dtree(
name,
@@ -328,6 +336,7 @@ class AnalyticModel:
threshold=threshold,
with_function_leaves=with_function_leaves,
with_nonbinary_nodes=with_nonbinary_nodes,
+ loss_ignore_scalar=loss_ignore_scalar,
)
else:
self.attr_by_name[name][attr].set_data_from_paramfit(paramfit)
@@ -405,6 +414,7 @@ class AnalyticModel:
threshold=100,
with_function_leaves=False,
with_nonbinary_nodes=True,
+ loss_ignore_scalar=False,
):
if name not in self.attr_by_name:
@@ -417,6 +427,7 @@ class AnalyticModel:
self.by_name[name][attribute],
self.by_name[name]["param"],
self.parameters,
+ param_type=ParamType(self.by_name[name]["param"]),
)
# temporary hack for ResKIL / kconfig-webconf evaluation of regression trees with function nodes
@@ -431,6 +442,7 @@ class AnalyticModel:
self.by_name[name][attribute],
with_function_leaves=with_function_leaves,
with_nonbinary_nodes=with_nonbinary_nodes,
+ loss_ignore_scalar=loss_ignore_scalar,
threshold=threshold,
)