# Time Series Forecasting Method Based on Multi-Scale Feature Fusion and Autoformer
## 2 Materials and Methods
### Autoformer Network Structure  
Given the remarkable success of the Autoformer model in time series forecasting tasks, this paper adopts it as the foundational algorithm for our study. The Autoformer model employs an encoder-decoder architecture that integrates an autocorrelation network, a seasonal decomposition network, and a feed-forward neural network. The seasonal feature information generated by the encoder serves as the input for the decoder's autocorrelation network. The encoder is dedicated to seasonal modeling, extracting periodic features through the use of autocorrelation and seasonal decomposition networks, while the feed-forward network further delves into extracting more profound features. The initial input to the decoder comprises both seasonal and trend components, with the trend being refined incrementally through the decomposition process, utilizing the crossover information yielded by the encoder. The detailed mathematical formulations for the seasonal decomposition network are presented in Equations (1) and (2). In Equation (1), \(x\) denotes the \begin{table}
\begin{tabular}{c c} \hline \hline
**Feature (Abbreviation)** & **Description** \\ \hline Date & Sales date \\ Sales & The store’s daily apparel sales volume \\ On Promotion & The number of promotional apparel items in the store \\ Oil Price & The oil price in the region \\ Holiday & Whether it was a holiday in the region \\ Google Trend & Google search trend index for the category name \\ USDX & The US dollar index \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Feature descriptions. Figure 1: Correlation matrix of the considered variables. original input time series. The term Padding refers to a bilateral padding operation, which is implemented to maintain the sequence length consistent with the required input length. The trend component \(x_{t}\) is derived by employing an average pooling operation, denoted as AvgPool. In Equation (2), the original time series input is adjusted by subtracting the trend component \(x_{t}\), which was previously derived in Equation (1). This subtraction process isolates the seasonal component, denoted as \(x_{s}\), from the original data. \[x_{t}=\text{AvgPool}(\text{Padding}(x)) \tag{1}\]  
\[x_{s}=x-x_{t} \tag{2}\]  
The implementation of the autocorrelation mechanism is facilitated through the Fast Fourier Transform (FFT), which enables the efficient computation of the sequence's autocorrelation in the frequency domain. The autocorrelation coefficient is then derived by the formulation presented in Equation (3). In Equation (3), \(R_{xx}\) signifies the autocorrelation coefficient, \(L\) indicates the total length of the observed time series, \(x_{t}\) represents the value of the time series at time point \(t\), and \(\tau\) denotes the time lag interval. Consequently, Equation (3) serves to measure the degree of similarity between the time series before and after the lag is applied. Time series that exhibit potential cyclical patterns are characterized by high similarity values. The autocorrelation coefficient \(R_{xx}\) can be computed by the Wiener-Khinchin theorem [28], utilizing the Fast Fourier Transform as detailed in Equations (4) and (5). \[R_{xx}(\tau)=\lim_{L\rightarrow\infty}\frac{1}{L}\sum_{t=1}^{L-1}x_{t}x_{t-\tau} \tag{3}\]  
\[S_{xx}(f)=\mathcal{F}(x_{t})\mathcal{F}^{*}(x_{t})=\int_{-\infty}^{+\infty}x_ {t}e^{-2\pi ift}\,dt\overline{\int_{-\infty}^{+\infty}x_{t}e^{-2\pi ift}\,dt} \tag{4}\]  
\[R_{xx}=\mathcal{F}^{-1}(S_{xx}(f))=\int_{-\infty}^{+\infty}S_{xx}(f)e^{2\pi if t }\,df \tag{5}\]  
In Equation (4), \(S_{xx}(f)\) represents the Fourier transform of the autocorrelation, where \(\mathcal{F}\) signifies the Fast Fourier Transform (FFT) and \(\mathcal{F}^{*}\) denotes the conjugate operation. Moving to Equation (5), \(R_{xx}\) corresponds to the autocorrelation value of the time series at a lag of \(\tau\), and \(\mathcal{F}^{-1}\) represents the inverse Fourier transform.