Giter Club home page Giter Club logo

timesnet's Introduction

🚩 The complete code and scripts of TimesNet have been included in [Time-Series-Library].

🚩 The complete code and scripts of TimesNet have been included in [Time-Series-Library].

🚩 The complete code and scripts of TimesNet have been included in [Time-Series-Library].

TimesNet: Temporal 2D-Variation Modeling for General Time Series Analysis [ICLR 2023]

In this paper, we present TimesNet as a powerful foundation model for general time series analysis, which can

  • 🏆 Achieve the consistent state-of-the-art in five main-stream tasks: Long- and Short-term Forecasting, Imputation, Anomaly Detection and Classification.
  • 🌟 Directly take advantage of booming vision backbones by transforming the 1D time series into 2D space.

Temporal 1D-Variation vs. 2D-Variation

Temporal variation modeling is the common key problem of extensive analysis tasks. Previous methods attempt to accomplish this directly from the 1D time series, which is extremely challenging due to the intricate temporal patterns. Based on the observation of multi-periodicity in time series, we present the TimesNet to transform the origianl 1D-timeseries into 2D Space, which can unfiy the intraperiod- and interperiod-variations.

General Representation Learning Capacity

To demonstrate the model capacity in representation learning, we calculate the CKA similarity between representations from the bottom and top layer of each model. A smaller CKA similarity means that the representations of bottom and top layer are more distinct, indicating the hierarchical representations. From this representation analysis, We find that:

  • Forecasting and anomaly detection tasks require the low-level representations.
  • Imputation and classification tasks expect the hierarchical representations.

Benefiting from 2D kernel design, TimesNet (marked by red stars) can learn appropriate representations for different tasks, demonstrating its task generality as a foundation model.

Leaderboard for Time Series Analysis

In this paper, we also provide a comprehensive benchmark to evaluate different backbones. More than 15 advanced baselines are compared. Till February 2023, the top three models for five different tasks are:

Model
Ranking
Long-term
Forecasting
Short-term
Forecasting
Imputation Classification Anomaly
Detection
🥇 1st TimesNet TimesNet TimesNet TimesNet TimesNet
🥈 2nd DLinear Non-stationary
Transformer
Non-stationary
Transformer
Non-stationary
Transformer
FEDformer
🥉 3rd Non-stationary
Transformer
FEDformer Autoformer Informer Autoformer

See our paper for the comprehensive benchmark.

Citation

If you find this repo useful, please cite our paper.

@inproceedings{wu2023timesnet,
  title={TimesNet: Temporal 2D-Variation Modeling for General Time Series Analysis},
  author={Haixu Wu and Tengge Hu and Yong Liu and Hang Zhou and Jianmin Wang and Mingsheng Long},
  booktitle={International Conference on Learning Representations},
  year={2023},
}

Contact

If you have any questions, please contact [email protected].

Acknowledgement

We appreciate the following github repos for their valuable codebase:

timesnet's People

Contributors

wuhaixu2016 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

timesnet's Issues

Details about Mixed Dataset training

Hey authors,

I'd a couple of questions to ask about Section H - Model Performance in Mixed Dataset in the paper.

  • Could you please make the code available to train this?
  • How do you handle imbalance in the mixture of datasets? Ex. ETTh1 and ETTh2 have lesser amount of data compared to ETTm1 and ETTm2, so if all these datasets are combined together naively then the information from ETTm dominates ETTh leading to the model performing well on ETTm than ETTh relatively.
  • Was there any fine-tuning done on individual datasets after pretraining on the Mixed Dataset?

Thanks and looking forward to your reply!

关于batch_x , batch_y , batch_x_mark , batch_y_mark含义询问

您好,关于这四个参数在之前学习的时候就有疑问,请问可否解答一下为什么batch分成了x , y 还有mark呀?以及是怎么通过enumerate(train_loader)得到他们对应的tensor维度呢?可不可以根据exp_long_term_forecasting.py举一下例子呀?我理解enumerate()函数的意思,但不太理解这四个参数的维度以及数值是怎么出来的。

Clarification on TimesBlock

Thank you for your fantastic work!

Regarding the proposed TimesBlock, I would like to confirm if the reshape and convolution operations are carried out in the time domain. It's just that the frequencies and periods used to decide the shape is computed from the Fourier domain? Besides, is the number of chunks decided by partitioning the time series into chunks of length $p_i$ (after padding)?

The point of the question is that, if the partition is carried out in the time domain, then each chunk still contains all the frequencies that exist in the full series so we can't say that each Inception block only focus on modeling the "intra and inter period variation" of a single frequency right? Or can we say that, the "intra and inter period variation" is exactly caused by the accumulation effects of multiple frequencies?

Also, could you please explain a bit more on how to see the inter and intra period variation in the figure?
image

Motion and trajectory forecasting

Thanks for your excellent work which quite helpful.

I am just wondering that if TimesNet can easily be transferred to other tasks with higher dimension input features.
E.g. Human motion prediction (6D with 6 different human joints) or Trajectory prediction (2D with (x,y) coordinates).

Thank you so much if you can share some considerations.

Details about the paper

We have noticed that in Table 14 of your paper there is a note, “The original paper of N-BEATS (Oreshkin et al., 2019) adopts a special ensemble method to promote the performance.
For fair comparisons, we remove the ensemble and only compare the pure forecasting models.”
We don't quite understand which operation of NBEATS is referred to by "a special ensemble method" here。
Thanks for your guidance

GPU显存不足

同学你好,在运行时碰到了以下的问题
RuntimeError: CUDA out of memory. Tried to allocate 288.00 MiB (GPU 0; 23.99 GiB total capacity; 22.60 GiB already allocated; 0 bytes free; 22.75 GiB reserved in total by PyTorch)
在运行timesnet前我确定显存已经清理干净了,也尝试调小batch_size,但是仍然超显存,你论文中的显卡也是24g的,我想问问你是否有遇到这样的问题,你是怎样处理的呢?

依赖包

您好,我想问一下,我在安装依赖环境时,reformer-pytorch==1.4.4这个版本找不到,可以用高版本的来代替吗?

num_workers参数设置

同学,您好!
在运行代码的时候,如果按照原本参数num_workers=10运行,会出现以下错误:
RuntimeError:
An attempt has been made to start a new process before the
current process has finished its bootstrapping phase.

    This probably means that you are not using fork to start your
    child processes and you have forgotten to use the proper idiom
    in the main module:

        if __name__ == '__main__':
            freeze_support()
            ...

    The "freeze_support()" line can be omitted if the program
    is not going to be frozen to produce an executable.

Process finished with exit code 1
在网上搜索解决办法说把num_workers设置成0,但当我这样运行的时候,对于gpu显存的要求就会特别高,超过24g。请问这样是正常的吗?

关于不同数据集的训练和验证的命令行参数设定与数据集加载问题

您好,以下两个问题:
1、针对不同数据集是否需要改变命令行中如下参数的设置:args.freq, args.embed。因为不同数据集数据的采样频率是不一样的,有的是小时,有的是星期,有的则是15分钟。是否如上这些参数的设定需要根据数据集而改变?TimesNet在不同数据集进行实验的时候是怎样处理这些参数的?
2、data_loader脚本中并没有给出一些数据集(如ECL,Weather等)的数据预处理,如何进行实验?是否是将脚本中的Dataset_Custom类名改为这些数据集(如ECL,Weather等)的名称即可?
请详细解答一下,不胜叨扰,万分感谢!
祝龙年快乐!

关于TimesNet训练时的数据集问题

您好,非常荣幸从您的著作中有所启发,当我复现实验结果时,用TimesNet作分类任务,使用Handwriting数据集,执行sh ./scripts/classification/TimesNet.sh,一直EarlyStopping,是否为数据集格式或者调用数据集的问题,我使用的数据集格式如下
QQ截图20240306113220
如果我使用其他非文中所用的数据集进行模型训练时,例如model_id等参数该在哪些方面进行修改?只能导入.ts格式的数据集吗?如果是csv格式的数据集呢?

感谢!

About the projection before encoder

in code line 113:

enc_out = self.predict_linear(enc_out.permute(0, 2, 1)).permute(0, 2, 1) # align temporal dimension

you add a linear layer to project seq_len to (seq_len + pred_len) before feeding it to Time Block. Can you explain why doing this and what it aligns with, thank you.

maybe keeping the original length before encoder and projecting it after encoder is better? I wonder if it will hurt the original temporal information.

关于自建训练集进行训练的问题

这个工程对我太有帮助了,非常感谢作者的分享!
想请问一下作者,如果我想做仅关于采样点的时间序列问题,即不包含时间戳,能不能通过修改data_loader来实现?会影响训练的结果吗?目前的情况用自己的数据代入修改weather.csv文件中的‘OT’进行训练。
还有对待Imputation的测试任务的时候,想问一下能不能自己对数据进行mask后进行测试,而不用您在test中编写的测试方式?

A simiar paper with TimesNet

I recently read a paper that is super similar to TimesNet, even dataset for comparision is same and the figures are the same style.
"Multi-scale transformers with Adaptive Pathways for Time Series Forecasting"
What is the relation between this and your paper? I didn't see any citation from this paper to timesnet.
Please check, thanks.
image
image

Do you still have the original code for the algo?

Hi! First of all, I want to congratulate you on this amazing piece of work. I wonder if you have the original algo for it? I know that the algorithm was integrated into timeseries-lib but to be honest it will take too much for me to clean the code in order to extract the code :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.