# Stock Price Prediction Using a Frequency Decomposition Based GRU Transformer Neural Network
## 4 Experiment
### Experiment Results
#### 4.4.4 Visualization of Mode Decomposition  
To validate the effectiveness of the complete ensemble empirical mode decomposition (CEEMD), we visualize several decomposition results and provide analysis for signal decomposition. The results are shown in Figure 7. Series 1 contains 400 time steps and have moderate fluctuations along the time axis. After the decomposition, the price trend is captured by the residual with a smooth curve and the IMFs are a little dense. Series 2 contains 1000 time steps and the price goes up and down frequently. The trend is not ideally smooth, the IMFs are dense. Even in this case, where more IMFs are needed, the series after decomposition is more accessible to a sequential model because of more structured pattern.  
\begin{table}
\begin{tabular}{c c c c} \hline \hline
**Methods** & \(\mathbf{r^{2}}\) **(\%) \(\uparrow\)** & **MSE (\%) \(\downarrow\)** & **MAE (\%) \(\downarrow\)** \\ \hline No LSTM & \(2.66\pm 0.594\) & \(0.0298\pm 0.00213\) & \(0.101\pm 0.00434\) \\ No GRU & \(2.65\pm 0.524\) & \(0.0299\pm 0.00216\) & \(0.0992\pm 0.00434\) \\ No Transformer & \(2.78\pm 0.281\) & \(0.0294\pm 0.00228\) & \(0.0960\pm 0.00467\) \\ No concatenation & \(2.74\pm 0.589\) & \(0.0308\pm 0.00218\) & \(0.0964\pm 0.00448\) \\ No CEEMD & \(2.79\pm 0.617\) & \(0.0295\pm 0.00222\) & \(0.0932\pm 0.00447\) \\ FDG-Trans & \(\mathbf{2.88}\pm\mathbf{0.168}\) & \(\mathbf{0.0291}\pm\mathbf{0.00217}\) & \(\mathbf{0.0917}\pm\mathbf{0.00446}\) \\ \hline \hline \end{tabular}
\end{table}
Table 4: Performances of FDG-Trans with ablation experiments.  
\begin{table}
\begin{tabular}{c c c c} \hline \hline
**Methods** & \(\mathbf{r^{2}}\) **(\%) \(\uparrow\)** & **MSE (\%) \(\downarrow\)** & **MAE (\%) \(\downarrow\)** \\ \hline No decomposition & \(2.79\pm 0.617\) & \(0.0295\pm 0.00222\) & \(0.0932\pm 0.00447\) \\ Wavelet [55] & \(2.80\pm 0.159\) & \(0.0291\pm 0.00218\) & \(0.0946\pm 0.00450\) \\ Fourier [56] & \(2.27\pm 0.176\) & \(0.0307\pm 0.00220\) & \(0.0954\pm 0.00443\) \\ CEEMD & \(\mathbf{2.88}\pm\mathbf{0.168}\) & \(\mathbf{0.0291}\pm\mathbf{0.00217}\) & \(\mathbf{0.0917}\pm\mathbf{0.00446}\) \\ \hline \hline \end{tabular}
\end{table}
Table 3: Performances of FDG-Trans with different frequency decomposition methods. The results are trained based on MSE loss function.  
\begin{table}
\begin{tabular}{c c c c} \hline \hline
**Methods** & \(\mathbf{r^{2}}\) **(\%) \(\uparrow\)** & **MSE (\%) \(\downarrow\)** & **MAE (\%) \(\downarrow\)** \\ \hline MAE & \(0.181\pm 0.468\) & \(0.0295\pm 0.00218\) & \(\mathbf{0.0884}\pm\mathbf{0.00471}\) \\ RMSE & \(2.71\pm 0.501\) & \(0.0292\pm 0.00217\) & \(0.0953\pm 0.00451\) \\ Huber & \(2.28\pm 0.479\) & \(0.0292\pm 0.00219\) & \(0.0950\pm 0.00447\) \\ MSE & \(\mathbf{2.88}\pm\mathbf{0.168}\) & \(\mathbf{0.0291}\pm\mathbf{0.00217}\) & \(0.0917\pm 0.00446\) \\ \hline \hline \end{tabular}
\end{table}
Table 5: Performances of FDG-Trans with different losses. The results are trained based on MSE loss function.  
Series 3 contains 400 time steps with a decrease trend. It is nicely captured by the residual. Series 4 is comparatively stable, but with sudden changes in a short period, which could be recognized as an oscillatory signal by a sequential model. After the decomposition, the problems are alleviated. Series 5 contains 130 time steps, which is exactly the same as our input data. It is originally bounced frequently. After the decomposition, the series are stable and smooth.  
Figure 7: Visualizations of price series after decomposition by CEEMD. From the plot we can see that, series with low or high variance, long or short time steps, it can be decomposed to several more smooth series.  
These cases show that the CEEMD can decompose stock price series into a main trend component and several mode component revealing explicit fluctuation, e.g., oscillatory and stability.