gzerveas / mvts_transformer

Multivariate Time Series Transformer, public version
MIT License
718 stars 169 forks source link

Error whenever I try to run classification with dataset from timeseriesclassification.com #32

Closed alexeyshmelev closed 1 year ago

alexeyshmelev commented 1 year ago

Regression works perfectly fine for me but all datasets from timeseriesclassification.com give the following errors:

Traceback (most recent call last):
  File "/home/avshmelev/hw/./mvts_transformer/src/main.py", line 307, in <module>
    main(config)
  File "/home/avshmelev/hw/./mvts_transformer/src/main.py", line 235, in main
    aggr_metrics_val, best_metrics, best_value = validate(val_evaluator, tensorboard_writer, config, best_metrics,
  File "/home/avshmelev/hw/mvts_transformer/src/running.py", line 222, in validate
    np.savez(pred_filepath, **per_batch)
  File "<__array_function__ internals>", line 200, in savez
  File "/home/avshmelev/.local/lib/python3.9/site-packages/numpy/lib/npyio.py", line 615, in savez
    _savez(file, args, kwds, False)
  File "/home/avshmelev/.local/lib/python3.9/site-packages/numpy/lib/npyio.py", line 716, in _savez
    val = np.asanyarray(val)
ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (10,) + inhomogeneous part.

The training process even didn't start. I used the following command to start training (like training from scratch in your readme):

python ./mvts_transformer/src/main.py --output_dir experiments --comment "classification from Scratch" --name ArticularyWordRecognition_fromScratch --records_file Classification_records.xls --data_dir Multivariate_ts/ArticularyWordRecognition/ --data_class tsra --pattern TRAIN --val_pattern TEST --epochs 400 --lr 0.001 --optimizer RAdam --pos_encoding learnable --task classification --key_metric accuracy --batch_size 32

Now I'm just trying to understand what's wrong here using dataset "ArticularyWordRecognition" from timeseriesclassification.com. Could you try to run it and give feedback how it was on your side? If your code wasn't made to work with this dataset, could you, please, provide the right idea of fixing it (it is very important to do everything right because I want to run your code on my own dataset that it very similar to "ArticularyWordRecognition")?

Of course, I can try to fix your code but could you help me in order to avoid some logical mistakes in training pipline (who knows what wrong I can do during my problem fixing).

gzerveas commented 1 year ago

Hello Alexey,

Sorry for not getting back to you earlier, and thank you for your willingness to help! I hope I can get to testing your issue as soon as possible. Although I have never used specifically that dataset, it is surprising that you see errors with the rest of the datasets, because they have been used and tested many times. Quick question: are you using the link of the zip file in the README to download the classification data? And, are you using the failsafe_requirements.txt to install packages? It is always possible that the owners of timeseriesclassification.com have made changes to the format of the data, or to the sktime package.

alexeyshmelev commented 1 year ago

@gzerveas Yeah, I tried both rerequirements.txt files. Nothing worked except going into the source code (mvts_transformer/src/running.py) and just commenting the line 222: np.savez(pred_filepath, **per_batch)