summaryrefslogtreecommitdiff
path: root/lib/parameters.py
diff options
context:
space:
mode:
authorDaniel Friesel <daniel.friesel@uos.de>2022-01-17 11:29:31 +0100
committerDaniel Friesel <daniel.friesel@uos.de>2022-01-17 11:29:31 +0100
commitb619697df57ffa51e7caa44ecd4566a2f6dcf49c (patch)
treef203803cc25f0214338344fdcd2c17aed1c94dd1 /lib/parameters.py
parent3340bab4196c2737236216ad3845afa74d0b7f39 (diff)
build_tree: oops. properly set staticfunction
Diffstat (limited to 'lib/parameters.py')
-rw-r--r--lib/parameters.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/parameters.py b/lib/parameters.py
index 1239046..3157c91 100644
--- a/lib/parameters.py
+++ b/lib/parameters.py
@@ -928,7 +928,8 @@ class ModelAttribute:
logger.warning(
f"Cannot generate CART due to lack of parameters: parameter shape is {np.array(parameters).shape}, fit_parameter shape is {fit_parameters.shape}"
)
- return df.StaticFunction(np.mean(data))
+ self.model_function = df.StaticFunction(np.mean(data))
+ return
cart.fit(fit_parameters, data)
self.model_function = df.SKLearnRegressionFunction(
np.mean(data), cart, category_to_index, ignore_index
@@ -958,7 +959,8 @@ class ModelAttribute:
logger.warning(
f"Cannot run XGBoost due to lack of parameters: parameter shape is {np.array(parameters).shape}, fit_parameter shape is {fit_parameters.shape}"
)
- return df.StaticFunction(np.mean(data))
+ self.model_function = df.StaticFunction(np.mean(data))
+ return
xgb.fit(fit_parameters, np.reshape(data, (-1, 1)))
self.model_function = df.SKLearnRegressionFunction(
np.mean(data), xgb, category_to_index, ignore_index