thuml / Time-Series-Library

A Library for Advanced Deep Time Series Models.
MIT License
6.98k stars 1.11k forks source link

Can I do multivariate time-series analysis and also add TFT transformer? #146

Closed gabriead closed 1 year ago

gabriead commented 1 year ago

Hi @wuhaixu2016, this repos is exactly what I was looking for! Is it designed to be used with multivariate time-series as well? How could I incorporate the Temporal Fusion Transformer into the code? Are there reasons from your perspective why it hasn't been added so far? I would like to use your library on physiological data (using multiple features to predict a target). I would like to define a forecast horizon (how many time steps to go back on each feature) and a prediction horizon (how many time steps to predict for the target in the future) So may data looks like so (assuming the forecast horizon is 30 and the prediction horizon is 7), every feature is in a separate data frame column, target is in a separate datafram column: [feature_1_t-30, feature_2_t-30..., feature_1_t-1.....], [target]

How would I have to transform my data to be able to use it with your library? What is the difference between long and short term forecast?

wuhaixu2016 commented 1 year ago

Hi, thanks for your interest. (1) Yes, this repo can be used for multivariate time-series. (2) How to add the Temporal Fusion Transformer. You can follow the README.md (Usage Section step 4) (3) You can organize your data like this file: https://cloud.tsinghua.edu.cn/d/e1ccfff39ad541908bae/files/?p=%2FETT-small%2FETTh1.csv

gabriead commented 1 year ago

Hi @wuhaixu2016, thank you for the quick reply. So as long as there is a date column and the features are separated (one target value per column) and the target is also in a separate column then it should work? Something like this: |date |target_t1-30|target_t2-30|....|OT| |.........................|.........................|.........................|....|OT|

And in the config I would use the 'default'='MS', to use multiple features and predict a single target value? How does the dataframe change when I want t predict multiple targets? Like so: |date |target_t1-30|target_t2-30|....|OT_t-1|OT_t-2|OT_t-3|....|

What is the difference between long-term and short-term prediction in the 'scripts' module and what do I use for my use case?