Skip to content

Commit e60dd80

Browse files
committed
make box-cox strictly positive
1 parent 6fc04eb commit e60dd80

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

mambular/preprocessing/preprocessor.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,9 @@ def fit(self, X, y=None, embeddings=None):
466466
)
467467

468468
elif self.numerical_preprocessing == "box-cox":
469+
numeric_transformer_steps.append(
470+
("check_positive", MinMaxScaler(feature_range=(1e-3, 1)))
471+
)
469472
numeric_transformer_steps.append(
470473
(
471474
"box-cox",
@@ -752,11 +755,12 @@ def get_feature_info(self, verbose=True):
752755
"quantile",
753756
"polynomial",
754757
"splines",
758+
"box-cox",
755759
]
756760
):
757761
last_step = transformer_pipeline.steps[-1][1]
758762
if hasattr(last_step, "transform"):
759-
dummy_input = np.zeros((1, 1))
763+
dummy_input = np.zeros((1, 1)) + 1e-05
760764
transformed_feature = last_step.transform(dummy_input)
761765
dimension = transformed_feature.shape[1]
762766
numerical_feature_info[feature_name] = {

0 commit comments

Comments
 (0)