mirror of
https://git.gfz-potsdam.de/naaice/model-training.git
synced 2025-12-16 03:18:23 +01:00
add check for different scaler types
This commit is contained in:
parent
dd1bdb7fc5
commit
c7b89505c2
@ -149,6 +149,11 @@ def custom_loss(
|
|||||||
|
|
||||||
# as far as I know tensorflow does not directly support the use of scaler objects
|
# as far as I know tensorflow does not directly support the use of scaler objects
|
||||||
# therefore, the backtransformation is done manually
|
# 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:
|
try:
|
||||||
if scaler_type == "minmax":
|
if scaler_type == "minmax":
|
||||||
scale_X = tf.convert_to_tensor(
|
scale_X = tf.convert_to_tensor(
|
||||||
@ -566,6 +571,7 @@ class preprocessing:
|
|||||||
return design_resampled, target_resampled
|
return design_resampled, target_resampled
|
||||||
|
|
||||||
def scale_fit(self, X, y, scaling, type="Standard"):
|
def scale_fit(self, X, y, scaling, type="Standard"):
|
||||||
|
self.scaler_type = type
|
||||||
"""Fit a scaler for data preprocessing.
|
"""Fit a scaler for data preprocessing.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user