Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The data constructed by PandasDataset.from_long_dataframe seems unable to be applied to TemporalFusionTransformerEstimator. #3242

Open
A-Little-Coder opened this issue Jan 21, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@A-Little-Coder
Copy link

A-Little-Coder commented Jan 21, 2025

Description

I converted the data type of pandas to the data type of gluonts using PandasDataset.from_long_dataframe, which can be applied to DeepAR, but there are problems when using it on TFT. Could you please tell me where the problem lies?

To Reproduce

(Please provide minimal example of code snippet that reproduces the error. For existing examples, please provide link.)

I'm not allowed to submit code

Error message or code output

Traceback (most recent call last):
File "D:/PycharmProjects/Forecasting/Algorithm/src/main.py", line 23, in main
output_result_df = main_pipeline(input_dict)
File "D:\PycharmProjects\Forecasting\Algorithm\src\pipeline\main_pipeline.py", line 72, in main_pipeline
y_test_pred_tuple = model_pipeline(temp_tx_data_params, split_time_params, level_tuple)
File "D:\PycharmProjects\Forecasting\Algorithm\src\pipeline\model_pipeline.py", line 25, in model_pipeline
in_model = model_train(temp_in_data, split_time_params, feature_name_params, model_class)
File "D:\PycharmProjects\Forecasting\Algorithm\src\model\train.py", line 33, in model_train
model.fit(tft_train)
File "D:\PycharmProjects\Forecasting\Algorithm\src\model\model.py", line 150, in fit
self.predictor = self.estimator.train(train_data)
File "D:\Anaconda3\envs\Forecast\lib\site-packages\gluonts\mx\model\estimator.py", line 224, in train
cache_data=cache_data,
File "D:\Anaconda3\envs\Forecast\lib\site-packages\gluonts\mx\model\estimator.py", line 181, in train_model
shuffle_buffer_length=shuffle_buffer_length,
File "D:\Anaconda3\envs\Forecast\lib\site-packages\gluonts\model\tft_estimator.py", line 342, in create_training_data_loader
with env._let(max_idle_transforms=maybe_len(data) or 0):
File "D:\Anaconda3\envs\Forecast\lib\site-packages\gluonts\itertools.py", line 45, in maybe_len
return len(obj)
File "D:\Anaconda3\envs\Forecast\lib\site-packages\gluonts\transform_base.py", line 100, in len
return sum(1 for _ in self)
File "D:\Anaconda3\envs\Forecast\lib\site-packages\gluonts\transform_base.py", line 100, in
return sum(1 for _ in self)
File "D:\Anaconda3\envs\Forecast\lib\site-packages\gluonts\transform_base.py", line 104, in iter
self.base_dataset, is_train=self.is_train
File "D:\Anaconda3\envs\Forecast\lib\site-packages\gluonts\transform_base.py", line 124, in call
for data_entry in data_it:
File "D:\Anaconda3\envs\Forecast\lib\site-packages\gluonts\transform_base.py", line 124, in call
for data_entry in data_it:
File "D:\Anaconda3\envs\Forecast\lib\site-packages\gluonts\transform_base.py", line 124, in call
for data_entry in data_it:
[Previous line repeated 20 more times]
File "D:\Anaconda3\envs\Forecast\lib\site-packages\gluonts\transform_base.py", line 128, in call
raise e
File "D:\Anaconda3\envs\Forecast\lib\site-packages\gluonts\transform_base.py", line 126, in call
yield self.map_transform(data_entry.copy(), is_train)
File "D:\Anaconda3\envs\Forecast\lib\site-packages\gluonts\transform_base.py", line 141, in map_transform
return self.transform(data)
File "D:\Anaconda3\envs\Forecast\lib\site-packages\gluonts\transform\convert.py", line 127, in transform
value = np.asarray(data[self.field], dtype=self.dtype)
KeyError: "New Year's Day"

Process finished with exit code 1

Environment

  • Operating system:windows10
  • Python version:3.7
  • GluonTS version:0.10.0
  • MXNet version:

(Add as much information about your environment as possible, e.g. dependencies versions.)

@A-Little-Coder A-Little-Coder added the bug Something isn't working label Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant