running temporal fusion transformer default dataset shape error

Viewed 84

I ran default code of Temporal fusion transformer in google colab which downloaded at github.

After clone, when I ran the step 2, there's no way to test training.

python3 -m script_train_fixed_params volatility outputs yes 

The problem is shape error in the below.

Computing best validation loss
Computing test loss
/usr/local/lib/python3.7/dist-packages/keras/engine/training_v1.py:2079: UserWarning: `Model.state_updates` will be removed in a future version. This property should not be used in TensorFlow 2.0, as `updates` are applied automatically.
  updates=self.state_updates,
Traceback (most recent call last):
  File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/content/drive/MyDrive/tft_tf2/script_train_fixed_params.py", line 239, in <module>
    use_testing_mode=True)  # Change to false to use original default params
  File "/content/drive/MyDrive/tft_tf2/script_train_fixed_params.py", line 156, in main
    targets = data_formatter.format_predictions(output_map["targets"])
  File "/content/drive/MyDrive/tft_tf2/data_formatters/volatility.py", line 183, in format_predictions
    output[col] = self._target_scaler.inverse_transform(predictions[col])
  File "/usr/local/lib/python3.7/dist-packages/sklearn/preprocessing/_data.py", line 1022, in inverse_transform
    force_all_finite="allow-nan",
  File "/usr/local/lib/python3.7/dist-packages/sklearn/utils/validation.py", line 773, in check_array
    "if it contains a single sample.".format(array)
ValueError: Expected 2D array, got 1D array instead:
array=[-1.43120418  1.58885804  0.28558148 ... -1.50945972 -0.16713021
 -0.57365613].
Reshape your data either using array.reshape(-1, 1) if your data has a single feature or array.reshape(1, -1) if it contains a single sample.

I've tried to modify code which is predict dataframe shpae of 'data_formatters/volatility.py", line 183, in format_predictions' because I guessed that's where the problem arises.), but I can't handle that.

0 Answers
Related