From c7b89505c2ea2a4fe5fb1acbc75242231a83b525 Mon Sep 17 00:00:00 2001 From: Hannes Signer Date: Mon, 24 Mar 2025 20:26:28 +0100 Subject: [PATCH] add check for different scaler types --- src/preprocessing.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/preprocessing.py b/src/preprocessing.py index be783d6..d7ecd3e 100644 --- a/src/preprocessing.py +++ b/src/preprocessing.py @@ -149,6 +149,11 @@ def custom_loss( # as far as I know tensorflow does not directly support the use of scaler objects # therefore, the backtransformation is done manually + + if preprocess.scaler_type != scaler_type: + raise Exception( + "Data normalized with scaler different than specified for the training. Compare the scaling approach on preprocessing and training.") + try: if scaler_type == "minmax": scale_X = tf.convert_to_tensor( @@ -566,6 +571,7 @@ class preprocessing: return design_resampled, target_resampled def scale_fit(self, X, y, scaling, type="Standard"): + self.scaler_type = type """Fit a scaler for data preprocessing. Args: