Skip to content

Commit

Permalink
be less strict
Browse files Browse the repository at this point in the history
Signed-off-by: Wesley M. Gifford <[email protected]>
  • Loading branch information
wgifford committed Mar 29, 2024
1 parent a008fb3 commit e1f28a4
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions tsfm_public/toolkit/time_series_preprocessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e1f28a4

Please sign in to comment.