timesnet
A task-general time series backbone that folds a series into 2D tensors by period and runs vision kernels over them.
Time series · 55 operations Checked
Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.
At a glance
- Task
- Time series
- Parameters
- 9.3K
- Operations
- 55
- Framework
- PyTorch
- Recurrent
- No
- Published
- 2022
- Cited by
- 1,453 (as of 16 November 2026)
- Authors
- Haixu Wu, Tengge Hu, Yong Liu and others
- Checked
- Passed: the trace was replayed operation by operation and matched the model's own output for this input.
Files
The file opened in a new tab. Use your browser's Save command there to keep it.
The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.
Details
- Stable ID
- m12190
- Graph hash
- 4288cf30f9e7f14b1a2a3fcd3c7436a8ba76bf64cf33458ad92385acbc87cc24
- Skeleton hash
- c1c706b30f79304eb90e757c7f6f08ce164f725fb991170c5134629870135f11
- Architecture hash
- a33fc5d0866a9fc174c5d50d26dd329e6baa770cf9c25cad382f49d29b7c4d29
- Diagram SHA-256
- 830b8e151133839827007aab6ae5758bddd928b6dbd8a57348bbdde1c2b3e425
- TorchLens version
- 2.36.0
- Renderer
- graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
- Check
- Forward pass replayed in PyTorch
What it is
TimesNet is a task-general backbone for time series analysis rather than a model built for one task. The idea behind it is that real-world series carry several periods at once, such as daily and yearly cycles in weather or weekly and quarterly cycles in electricity use. The paper names two kinds of variation: intraperiod-variation, the short-term pattern within a period, and interperiod-variation, the longer trend across consecutive periods.
The trick is to fold the 1D series into 2D tensors, one per detected period, so that each column holds the points inside a period and each row holds points at the same phase across periods. Periods are discovered in the frequency domain with a Fast Fourier Transform. Only the top-k amplitudes are kept, which sidesteps the noise of meaningless high frequencies. Each 2D tensor is then processed by a parameter-efficient inception block, a standard vision module with multi-scale 2D kernels. The design keeps the model size invariant to the choice of k, the number of periods. The k resulting 1D representations are then fused with weights derived from the period amplitudes, a step inspired by Auto-Correlation. Because the series now lives in 2D, the inception block can be swapped for other vision backbones such as ResNet, ResNeXt or ConvNeXt. In the authors' words, more powerful 2D backbones bring better performance.
The paper evaluates on five tasks: short- and long-term forecasting, imputation, classification and anomaly detection. More than 15 baselines are included in the comparison. In long-term forecasting it reaches state-of-the-art in more than 80% of cases. In anomaly detection it beats the Transformer-based FEDformer and Autoformer. The authors note that all three of those models account for periodicity and all do well on that task. The representation analysis finds that forecasting and anomaly detection favour low-level representations while imputation and classification want hierarchical ones, and TimesNet learns the right kind for each.
Key idea. TimesNet reshapes a 1D series into a set of 2D tensors based on its dominant periods, so intraperiod and interperiod variation land on the columns and rows and can be modelled with ordinary 2D convolution kernels.
- TimesNet
- TimesBlock
- temporal 2D-variation
- time series analysis
- time series forecasting
- imputation
- anomaly detection
- time series classification
- multi-periodicity
- FFT period detection
- inception block
- NeuralForecast
AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.
Cite the paper
@misc{wu2023timesnettemporal2dvariationmodeling,
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},
year={2023},
eprint={2210.02186},
archivePrefix={arXiv},
primaryClass={cs.LG},
url={https://arxiv.org/abs/2210.02186},
}