diff options
author | Daniel Friesel <daniel.friesel@uos.de> | 2022-01-06 12:58:39 +0100 |
---|---|---|
committer | Daniel Friesel <daniel.friesel@uos.de> | 2022-01-06 12:58:39 +0100 |
commit | e26d19e31018410f94525810d5e3054f84c42fc5 (patch) | |
tree | 54fede08603f38d8327aaff457fa6102de855dee /lib/parameters.py | |
parent | 01860ccf2addcb1dd84418887f76b88c4acdf53a (diff) |
perform categorial→scalar conversion based on env var
Diffstat (limited to 'lib/parameters.py')
-rw-r--r-- | lib/parameters.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/parameters.py b/lib/parameters.py index b66c7b4..5781bee 100644 --- a/lib/parameters.py +++ b/lib/parameters.py @@ -913,6 +913,10 @@ class ModelAttribute: :returns: SplitFunction or StaticFunction """ + categorial_to_scalar = bool( + int(os.getenv("DFATOOL_PARAM_CATEGORIAL_TO_SCALAR", "0")) + ) + if with_sklearn_cart: from sklearn.tree import DecisionTreeRegressor @@ -921,7 +925,7 @@ class ModelAttribute: max_depth = None cart = DecisionTreeRegressor(max_depth=max_depth) fit_parameters, category_to_index, ignore_index = param_to_ndarray( - parameters, with_nan=False, categorial_to_scalar=True + parameters, with_nan=False, categorial_to_scalar=categorial_to_scalar ) cart.fit(fit_parameters, data) self.model_function = df.SKLearnRegressionFunction( @@ -942,7 +946,7 @@ class ModelAttribute: alpha=0.0006, ) fit_parameters, category_to_index, ignore_index = param_to_ndarray( - parameters, with_nan=False, categorial_to_scalar=True + parameters, with_nan=False, categorial_to_scalar=categorial_to_scalar ) xgb.fit(fit_parameters, data) self.model_function = df.SKLearnRegressionFunction( |