TL;DR
Time series, such as hourly electricity use or a daily temperature log, are hard for a model to read as one line, because several rhythms overlap: a daily cycle, a weekly cycle, and slow drift. TimesNet, by Wu and colleagues (ICLR 2023), finds the dominant periods with a Fourier transform, folds the 1D series into a 2D grid for each period, and runs ordinary 2D convolutional blocks over those grids. One architecture then handles forecasting, filling gaps, classification and anomaly detection, and the paper reports state-of-the-art results on all five task families it tests.
Builds on: Discrete Fourier Transform, Convolutional Neural Network, Inception Module, Residual Connection, Softmax · Leads to: Time Series Forecasting, the task family it was benchmarked on
Why it mattered
The paper argued for changing the design question for time series. Before it, most deep models for time series worked on the 1D sequence itself, with recurrent networks, convolutions along time, or attention between time points. TimesNet argues that the 1D view hides the structure: if the series is laid out as a 2D tensor, each column holds one period and each row holds one phase across periods. Then the well-tested 2D kernels of computer vision can read both kinds of variation at once.
The second contribution is the claim that one backbone can serve every task. The authors evaluate five tasks, short-term and long-term forecasting, imputation, classification and anomaly detection, against more than 15 baselines, using one backbone design for all of them. The paper also shows the 2D idea is not tied to one vision network: it swaps the Inception block for other 2D backbones such as ResNet, ResNeXt and ConvNeXt, and reports that more powerful 2D backbones bring better performance, so progress in vision can carry over to time series.
The problem
A time series is a list of numbers recorded at regular times, with time points and variables recorded together. Two kinds of change happen in it at once. Intraperiod variation is the change from one point to the next within a cycle, such as the rise and fall across a day. Interperiod variation is the change between cycles, such as a day's noon value compared with the previous day's noon value.
In the 1D layout, a model sees only neighbours. A convolution along time connects adjacent points, so it needs many layers to link a point to the same phase in the previous cycle. Attention can link any two points, but the paper argues that its weights have trouble finding the right links when the pattern is spread across a long, noisy sequence. The problem the paper sets is to make both kinds of variation local to the same operation.
How it works
The paper's core move is a change of shape, traced here on one tiny series of length with values . The second period differs from the first in one spot, so there is a visible change across cycles.
- Input. A univariate series of length 8. Each value stands for one time point, and there is one variable, so .
- Find the periods. Take the Fourier transform of the series and read off the amplitude at each frequency: how strongly that frequency is present. Average the amplitudes across variables and keep the top frequencies, searching from frequency 1 upward so the constant average level (frequency 0) is ignored. Say and the strongest frequency is 2, meaning the series repeats twice in its 8 points. Check: frequency 2 corresponds to a period of points, which matches the repeat we can see by eye.
- Compute the period length. The period is . Check: 4 points per period, and 2 periods, so points fill the grid exactly with no padding.
- Fold into a 2D tensor. Reshape the series into a grid with rows and columns. Column 1 is the first period, , and column 2 is the second, . Each row holds one phase across the two periods: the first row is , the second . Check: the grid holds all 8 values once each.
- Process with 2D kernels. Run a 2D block over the grid. A kernel that spans two rows reads the change within a period, and a kernel that spans two columns reads the change across periods. Check: the same kernel sees both directions of variation, which a 1D kernel cannot do at once.
- Fold back and combine. Reshape the output back into a 1D series of length 8, and truncate any padding. If periods were kept, with amplitudes 3 and 1, their weights are the Softmax of the amplitudes, and , so the stronger period contributes most. Check: the weights add to 1.
flowchart LR A["1D series, length T"] --> B["Fourier transform: top k periods"] B --> C["Fold into a 2D grid for each period"] C --> D["Shared 2D inception block"] D --> E["Unfold to 1D"] E --> F["Weight by amplitude, add residual"]
The whole pipeline is wrapped in a residual block, so the input skips past it and is added back at the end, and many such blocks are stacked. Inside a block the period search is done on the current features, so the periods can change from layer to layer.
The math
The paper's notation is kept below. The input is , and after an embedding it becomes features .
Step 2 in symbols: amplitudes and periods
Let be the discrete Fourier transform and the amplitude of each complex value (its magnitude, which is a complex number's length). Averaging over the variables gives one amplitude per frequency:
The top- amplitudes select the frequencies , and each frequency gives a period length . Only frequencies up to are searched, because the spectrum of a real signal is symmetric. Low-amplitude high frequencies are dropped, since they mostly carry noise.
Step 3 in symbols: padding and folding
If is longer than , the series is padded with zeros to length , then folded:
Here a column is one period (length ) and a row is one phase across the periods, as in the walkthrough.
Step 4 in symbols: the 2D block
The paper applies a parameter-efficient Inception block to each folded tensor, and it shares the same block across the periods:
The block uses several kernel sizes at once, and each 2D Convolution mixes neighbouring points along a column (within a period) and neighbouring rows (across periods). The paper calls the two types of mixing intraperiod and interperiod variation. Because the same block is used for every period, the parameter count does not grow with .
Step 5 in symbols: unfolding and truncation
The output is reshaped back to a 1D sequence, and the padding is cut off:
Step 6 in symbols: amplitude-weighted aggregation and residual
The results are combined with weights from the Softmax of the period amplitudes :
The last term is a residual connection, which lets the input pass through each block unchanged when the block has nothing to add. The paper writes the block as , which is the same thing in compact form.
Results
The paper reports results on five task families, all with the same backbone design. All experiments were repeated three times, and the tables give the averages. The figures quoted below are the paper's own numbers.
Long-term forecasting (Table 2) uses input lengths of 96 points for most datasets and 36 for ILI, and averages over prediction lengths 96, 192, 336 and 720 (24, 36, 48 and 60 for ILI). TimesNet has the lowest MSE and MAE on ETTm1 (0.400 and 0.406), ETTm2 (0.291 and 0.333), ETTh2 (0.414 and 0.427), Electricity (0.192 and 0.295) and Weather (0.259 and 0.287). It is not best everywhere. On ETTh1, FEDformer has the lower MSE (0.440 against 0.458), and on ILI the Non-stationary Transformer has the lower MSE (2.077 against 2.139). On Traffic, TimesNet's MAE is the lowest (0.336), but its MSE (0.620) is not.
Short-term forecasting on M4 (Table 3) reports symmetric mean absolute percentage error (SMAPE), mean absolute scaled error (MASE) and the M4 overall weighted average (OWA). TimesNet gets SMAPE 11.829, MASE 1.585 and OWA 0.851, against 11.851 SMAPE for N-BEATS, the next-best SMAPE in that table. The margins are small, so the paper's claim here is that TimesNet is best, not that it is far ahead.
Imputation (Table 4) masks 12.5, 25, 37.5 and 50 percent of the points in length-96 series and averages across the four ratios. TimesNet has the lowest MSE and MAE on all the rows shown, for example ETTm1 at 0.027 and 0.107, and ETTh1 at 0.078 and 0.187.
Classification (Figure 5) averages over 10 multivariate UEA subsets. TimesNet reaches 73.6 percent accuracy, against 73.0 for Flowformer and 72.5 for Rocket, while DLinear, a linear model over time, reaches 67.5 percent.
Anomaly detection (Table 5) uses five benchmarks, SMD, MSL, SMAP, SWaT and PSM, with the classic reconstruction error as the criterion for every model. The TimesNet entry, built with a ResNeXt backbone, has the best average F1 score among the models in that table (86.34). The vanilla Transformer has 76.88, and FEDformer has 84.97.
The limits. On several rows the margins are small, and the paper itself notes that TimesNet is not best everywhere. The results are for the datasets the paper chose, so they say little about other kinds of series. The method rests on the premise that real series have periods; a series without clear periods gives the folding step little structure to use.
Reading guide
The paper has the following sections, and each one needs the prerequisite lessons listed.
- 1 Introduction: the claim that the 1D view hides multi-periodicity, and the definitions of intraperiod and interperiod variation. Needs Time Series Forecasting for the task setting and Transformer for the attention baseline it argues against.
- 2 Related Work: RNN, convolution and Transformer models for time series. Needs Recurrent Neural Network and Convolutional Neural Network.
- 3.1 Transform 1D-variations into 2D-variations: the amplitude, period and folding equations of the walkthrough. Needs Discrete Fourier Transform, Fourier Series for the idea behind the frequencies, and Autocorrelation Function, which is the notion of repeated structure that the period search picks up.
- 3.2 TimesBlock: the residual wrapper, the shared Inception block and the amplitude-weighted aggregation. Needs Inception Module, Residual Connection, Weight Sharing and Softmax.
- 4 Experiments: the five task families and their metrics. Needs Mean Squared Error and Precision and Recall for the anomaly F1 score.
- 5 Conclusion and Future Work and the appendices: the ablations, the hyperparameter study and the full result tables. Read the appendix tables only after the main results make sense.