From e1f28a46233d5d96117d2cdb6302d0d41ee81856 Mon Sep 17 00:00:00 2001 From: "Wesley M. Gifford" Date: Fri, 29 Mar 2024 16:43:34 -0400 Subject: [PATCH] be less strict Signed-off-by: Wesley M. Gifford --- tsfm_public/toolkit/time_series_preprocessor.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tsfm_public/toolkit/time_series_preprocessor.py b/tsfm_public/toolkit/time_series_preprocessor.py index c0b9345d..6f5451a6 100644 --- a/tsfm_public/toolkit/time_series_preprocessor.py +++ b/tsfm_public/toolkit/time_series_preprocessor.py @@ -529,14 +529,17 @@ def train( return self - def inverse_scale_targets(self, dataset: Union[Dataset, pd.DataFrame]) -> Dataset: + def inverse_scale_targets(self, dataset: Union[Dataset, pd.DataFrame]) -> Union[Dataset, pd.DataFrame]: self._check_dataset(dataset) df = self._standardize_dataframe(dataset) - if not self.scaling or len(self.target_scaler_dict) == 0: + if not self.scaling: + return df + + if len(self.target_scaler_dict) == 0: # trying to inverse scale but this preprocessor is not set up for scaling raise RuntimeError( - "Attempt to perform inverse scaling, but time series preprocess is not configured for scaling or scaler has not yet been trained. Please run the `train` method first." + "Attempt to perform inverse scaling, but time series preprocessor has not yet been trained. Please run the `train` method first." ) cols_to_scale = self.target_columns