Skip to content

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

@A-Little-Coder

Description

@A-Little-Coder

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.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions