SIENTIAPDE-1241: Fix: Correctly handle feature normalization and denormalization, and add scaler parameters to metadata

This commit is contained in:
Bruno Domingues
2025-10-22 21:26:11 -03:00
parent 42a7e82c82
commit 758ffb10b6
2 changed files with 25 additions and 9 deletions

View File

@@ -535,8 +535,9 @@ class DataPreprocessor(BaseEstimator, TransformerMixin):
# Normalization
if step == NORMALIZATION and self.scaler:
data_treat = data_treat[self.feature_names_order]
data_treat[existing_columns] = self.scaler.transform(data_treat[existing_columns])
# Only transform feature columns, preserve target and any other required columns
feature_cols = self.feature_names_order
data_treat[feature_cols] = self.scaler.transform(data_treat[feature_cols])
# Feature Creation
if step == 'Feature Creation':