From fceff2ba08b41a637dce52dc788c705447a6c665 Mon Sep 17 00:00:00 2001 From: a-szulc Date: Fri, 30 Aug 2024 15:51:32 +0200 Subject: [PATCH] add catch for autoML warning and a check for pandas future warning --- supervised/preprocessing/scale.py | 2 ++ tests/tests_automl/test_targets.py | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/supervised/preprocessing/scale.py b/supervised/preprocessing/scale.py index d2b88d4d..bde673ab 100644 --- a/supervised/preprocessing/scale.py +++ b/supervised/preprocessing/scale.py @@ -45,6 +45,8 @@ def inverse_transform(self, X): if self.scale_method == self.SCALE_NORMAL: X.loc[:, self.columns] = self.scale.inverse_transform(X[self.columns]) elif self.scale_method == self.SCALE_LOG_AND_NORMAL: + X[self.columns] = X[self.columns].astype("float64") + X[self.columns] = self.scale.inverse_transform(X[self.columns]) X[self.columns] = np.exp(X[self.columns]) diff --git a/tests/tests_automl/test_targets.py b/tests/tests_automl/test_targets.py index 1a2eb8aa..ccf45dd0 100644 --- a/tests/tests_automl/test_targets.py +++ b/tests/tests_automl/test_targets.py @@ -317,7 +317,14 @@ def test_regression_missing_target(self): explain_level=0, start_random_models=1, ) - automl.fit(X, y) + + with pytest.warns( + match="There are samples with missing target values in the data which will be excluded for further analysis" + ) as record: + automl.fit(X, y) + + self.assertEqual(len(record), 1) + pred = automl.predict(X) self.assertIsInstance(pred, np.ndarray)