add check for different scaler types

This commit is contained in:
Hannes Signer 2025-03-24 20:26:28 +01:00
parent dd1bdb7fc5
commit c7b89505c2

View File

@ -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: