| Literature DB >> 35990139 |
Feiyang Liu1, Panke Qin1, Junru You1, Yanyan Fu1.
Abstract
The long short-term memory (LSTM) network is especially suitable for dealing with time series-related problems, which has led to a wide range of applications in analyzing stock market quotations and predicting future price trends. However, the selection of hyperparameters in LSTM networks was often based on subjective experience and existing research. The inability to determine the optimal values of the parameters results in a reduced generalization capability of the model. Therefore, we proposed a sparrow search algorithm-optimized LSTM (SSA-LSTM) model for stock trend prediction. The SSA was used to find the optimal hyperparameters of the LSTM model to adapt the features of the data to the structure of the model, so as to construct a highly accurate stock trend prediction model. With the Shanghai Composite Index stock data in the last decade, the mean absolute percentage error, root mean square error, mean absolute error, and coefficient of determination between stock prices predicted by the SSA-LSTM method and actual prices are 0.0093, 41.9505, 30.5300, and 0.9754. The result indicates that the proposed model possesses higher forecasting precision than other traditional stock forecasting methods and enhances the interpretability of the network model structure and parameters.Entities:
Mesh:
Year: 2022 PMID: 35990139 PMCID: PMC9391098 DOI: 10.1155/2022/3680419
Source DB: PubMed Journal: Comput Intell Neurosci
Figure 1Neural unit structure of LSTM.
Figure 2SSA-LSTM model architecture.
Figure 3Flowchart of the SSA.
Figure 4Optimization iterative process of SSA-LSTM.
Optimization iterative process of SSA-LSTM.
| Algorithm iterations | Learning rate | Epoch | Neuron numbers in the first hidden layer | Neuron numbers in the second hidden layer | Time step | Fitness value |
|---|---|---|---|---|---|---|
| 1 | 0.00666221 | 96 | 76 | 46 | 13 | 0.67514376 |
| 2 | 0.00666527 | 97 | 32 | 78 | 4 | 0.50569965 |
| 3 | 0.00616353 | 98 | 33 | 79 | 5 | 0.31894529 |
| 4 | 0.00616353 | 98 | 33 | 79 | 5 | 0.31894529 |
| 5 | 0.00616353 | 98 | 33 | 79 | 5 | 0.31894529 |
Results of hyperparametric optimization.
| Parameter | Search range | Optimal value |
|---|---|---|
| Learning rate | [0.001, 0.01] | 0.00616353 |
| Epoch | [10, 100] | 98 |
| Neuron numbers in the first hidden layer | [1, 100] | 33 |
| Neuron numbers in the second hidden layer | [1, 100] | 79 |
| Time step | [1, 20] | 5 |
Figure 5Comparison between prediction results of each model.
Evaluation results of models.
| Model | MAPE | RMSE | MAE |
|
|---|---|---|---|---|
| BP | 0.0347 | 147.7001 | 116.8226 | 0.6956 |
| RNN | 0.0175 | 74.9063 | 58.4909 | 0.9217 |
| LSTM | 0.0129 | 55.7954 | 42.2065 | 0.9566 |
| GRU | 0.0115 | 49.7854 | 37.6467 | 0.9663 |
| PSO-LSTM | 0.0097 | 43.0891 | 31.9715 | 0.9741 |
| SSA-LSTM | 0.0093 | 41.9505 | 30.5300 | 0.9754 |