Closed JamieToddUK closed 1 month ago
Similar to https://github.com/ibm-granite/granite-tsfm/issues/46
# define train and test data
train_data = # pandas dataframe
test_data = # pandas dataframe
# define a preprocessor
tsp = TimeSeriesPreprocessor(
timestamp_column=...
scaling=True,
)
# train the preprocessor
tsp.train(train_data)
# define a forecasting pipeline
forecast_pipeline = TimeSeriesForecastingPipeline(
model=model,
timestamp_column=...
feature_extractor=tsp, # note, needed if we want to inverse scale internally
inverse_scale_outputs=True,
)
# forecast using the pipeline on the scaled test data
forecasts = forecast_pipeline(tsp.preprocess(test_data))
You can find a similar example in the tests: https://github.com/ibm-granite/granite-tsfm/blob/main/tests/toolkit/test_time_series_forecasting_pipeline.py#L113
@wgifford Thank you for the help and quick response!
I am using a TimeSeriesPreprocessor with
scaling = True
for a ForecastDFDataset, and the PatchTSMixer and PatchTST models usescaling = "std"
.After training, when I inspect the model's predictions using:
The predicted and true values for the target columns are still normalised. How can I revert this scaling to analyse the predicted values I want?
Setting
scaling = False
for the TimeSeriesPreprocessor did not work, neither did settingscaling = False
for the models.Thanks in advance.