A Novel Hybrid Model of CNN-SA-NGU for Silver Closing Price Prediction
Abstract
:1. Introduction
- (1)
- This paper presents a new neural network NGU, which includes a forgetting gate and an input gate. The input data of each gate includes the hidden state of the previous time, the cell state of the previous time, and the input data of the current time. The NGU learns the previous moment’s experience to process the current moment’s input data, which improves the prediction accuracy of the model. The Tri data conversion module in the NGU alleviates the problems of gradient disappearance and gradient explosion. The NGU has a simple structure and few parameters to be calculated, so the training time is short. The NGU is mainly used to predict time series.
- (2)
- In the silver price prediction experiment, the SA mechanism is applied to the model, which can improve the unreasonable distribution of weights and facilitate the gate unit to learn the law of silver price data.
- (3)
- This paper presents a new silver price forecasting model: CNN-SA-NGU. Under the same experimental conditions and data, the silver price forecasting results of CNN-SA-NGU are better than other models.
2. Related Work
3. Models
3.1. SA
3.2. NGU
3.3. CNN-SA-NGU
4. Experiment
4.1. Experimental Environment
4.2. Data Acquisition
4.3. Data Preprocessing
4.4. Model Parameters
4.5. Model Comparison
- (1)
- Comparison of Prophet, SVR, ARIMA, MLP, LSTM, Bi-LSTM, GRU, and NGU
- (2)
- Comparison of CNN-LSTM, CNN-GRU, and CNN-NGU
- (3)
- Comparison of CNN-SA-LSTM, CNN-SA-GRU, and CNN-SA-NGU
4.6. Generalization Ability of Model
5. Discussion
- (1)
- The NGU uses the original learning experience fully to enhance the processing ability of the input data at the current time, thus improving the nonlinear fitting ability of the model. The Tri conversion module changes the range of output value by processing the output data of the input gate, thus alleviating the problems of gradient disappearance and gradient explosion.
- (2)
- With the addition of the SA mechanism, the feature data that significantly influence the prediction results can be well identified. The SA mechanism reallocates the weights of different feature data through calculation. Additionally, a higher weight factor is assigned to the feature data, which benefits the NGU’s learning.
- (3)
- By adding the CNN convolution layer, the model’s feature extraction ability is improved. The hidden features between data can be mined by the CNN.
6. Conclusions
- (1)
- Currently, the model only takes scalar data such as SPX, US30, NAS100, USDI, AU, and SSI as the influencing factors of the silver price. However, some factors still affect the silver price, such as investors’ psychology, the formulation of laws, and political events. In future research, we should use natural language processing technology to quantify political events such as policy changes and wars as influencing factors and input them into the prediction model to improve prediction accuracy.
- (2)
- We will further attempt to improve the SA model to make the weight coefficient allocation of the importance of feature data more reasonable.
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Conflicts of Interest
Abbreviations
NO. | Abbreviation | Full Name |
1 | ARIMA | autoregressive integrated moving average |
2 | AU | gold futures |
3 | Bi-LSTM | bi-directional long short-term memory |
4 | CNN | conventional neural network |
5 | EVS | explained variance score |
6 | GRU | gated recurrent unit |
7 | GRUNN | gate recurrent unit neural network |
8 | ICA | independent component analysis |
9 | LSTM | long short-term memory |
10 | MAE | mean absolute error |
11 | MLP | multi-layer perceptron |
12 | NAS100 | Nasdaq 100 index |
13 | NGU | new gated unit |
14 | R2 | r squared |
15 | RNN | recurrent neural network |
16 | S2SAN | sentence-to-sentence attention network |
17 | SA | self-attention |
18 | SPX | S&P 500 index |
19 | SSI | Shanghai stock index |
20 | SVM | support vector machine |
21 | SVR | support vector regression |
22 | US30 | Dow Jones industrial average |
23 | USDI | U.S. dollar index |
24 | VMD | variational mode decomposition |
References
- Kim, T.; Kim, H.Y. Forecasting stock prices with a feature fusion LSTM-CNN model using different representations of the same data. PLoS ONE 2019, 14, e0212320. [Google Scholar] [CrossRef] [PubMed] [Green Version]
- Cunado, J.; Gil-Alana, L.A.; Gupta, R. Persistence in trends and cycles of gold and silver prices: Evidence from historical data. Phys. A Stat. Mech. Its Appl. 2019, 514, 345–354. [Google Scholar] [CrossRef] [Green Version]
- Apergis, I.; Apergis, N. Silver prices and solar energy production. Environ. Sci. Pollut. Res. 2019, 26, 8525–8532. [Google Scholar] [CrossRef]
- Kotsiantis, S.B. Decision trees: A recent overview. J. Artif. Intell. Rev. 2013, 39, 261–283. [Google Scholar] [CrossRef]
- Heo, J.; Jin, Y.Y. SVM based Stock Price Forecasting Using Financial Statements. J. Korea Ind. Inf. Syst. Soc. 2015, 21, 167–172. [Google Scholar] [CrossRef]
- Liu, R.; Liu, L. Predicting housing price in China based on long short-term memory incorporating modified genetic algorithm. Soft Comput. 2019, 23, 11829–11838. [Google Scholar] [CrossRef]
- Yu, Y.; Si, X.S.; Hu, C.H.; Zhang, J.X. A Review of Recurrent Neural Networks: LSTM Cells and Network Architectures. Neural Comput. 2019, 31, 1235–1270. [Google Scholar] [CrossRef] [PubMed]
- Li, G.N.; Zhao, X.W.; Fan, C.; Fang, X.; Li, F.; Wu, Y.B. Assessment of long short-term memory and its modifications for enhanced short-term building energy predictions. J. Build. Eng. 2021, 43, 103182. [Google Scholar] [CrossRef]
- Liu, Y.; Zhang, X.M.; Zhang, Q.Y.; Li, C.Z.; Huang, F.R.; Tang, X.H.; Li, X.J. Dual Self-Attention with Co-Attention Networks for Visual Question Answering. Pattern Recognit. 2021, 117, 107956. [Google Scholar] [CrossRef]
- Humphreys, G.W.; Sui, J. Attentional control and the self: The Self-Attention Network (SAN). Cogn. Neurosci. 2015, 7, 5–17. [Google Scholar] [CrossRef]
- Lin, Z.H.; Li, M.M.; Zheng, Z.B.; Cheng, Y.Y.; Yuan, C. Self-Attention ConvLSTM for Spatiotemporal Prediction. In Proceedings of the AAAI Conference on Artificial Intelligence, New York, NY, USA, 7–12 February 2020; pp. 11531–11538. [Google Scholar] [CrossRef]
- Yuan, F.C.; Lee, C.H.; Chiu, C.C. Using Market Sentiment Analysis and Genetic Algorithm-Based Least Squares Support Vector Regression to Predict Gold Prices. Int. J. Comput. Intell. Syst. 2020, 13, 234–246. [Google Scholar] [CrossRef] [Green Version]
- Aksehir, Z.D.; Kilic, E. How to handle data imbalance and feature selection problems in CNN-based stock price forecasting. IEEE Access 2020, 10, 31297–31305. [Google Scholar] [CrossRef]
- He, C.M.; Kang, H.Y.; Yao, T.; Li, X.R. An effective classifier based on convolutional neural network and regularized extreme learning machine. Math. Biosci. Eng. 2019, 16, 8309–8321. [Google Scholar] [CrossRef] [PubMed]
- Chen, W.B.; Lu, Y.; Ma, H.; Chen, Q.L.; Wu, X.B.; Wu, P.L. Self-attention mechanism in person re-identification models. Multimed. Tools Appl. 2022, 81, 4649–4667. [Google Scholar] [CrossRef]
- Yan, R.; Liao, J.Q.; Yang, J.; Sun, W.; Nong, M.Y.; Li, F.P. Multi-hour and multi-site air quality index forecasting in Beijing using CNN, LSTM, CNN-LSTM, and spatiotemporal clustering. Expert Syst. Appl. 2021, 169, 114513. [Google Scholar] [CrossRef]
- Vidal, A.; Kristjanpoller, W. Gold volatility prediction using a CNN-LSTM approach. Expert Syst. Appl. 2020, 157, 113481. [Google Scholar] [CrossRef]
- Jianwei, E.; Ye, J.M.; Jin, H.H. A novel hybrid model on the prediction of time series and its application for the gold price analysis and forecasting. Phys. A Stat. Mech. Its Appl. 2019, 527, 121454. [Google Scholar] [CrossRef]
- Liu, Y.; Zhang, Z.L.; Liu, X.; Wang, L.; Xia, X.H. Deep Learning Based Mineral Image Classification Combined with Visual Attention Mechanism. IEEE Access 2021, 9, 98091–98109. [Google Scholar] [CrossRef]
- Liu, J.J.; Yang, J.K.; Liu, K.X.; Xu, L.Y. Ocean Current Prediction Using the Weighted Pure Attention Mechanism. J. Mar. Sci. Eng. 2022, 10, 592. [Google Scholar] [CrossRef]
- Kim, G.; Shin, D.H.; Choi, J.G.; Lim, S. A Deep Learning-Based Cryptocurrency Price Prediction Model That Uses On-Chain Data. IEEE Access 2022, 10, 56232–56248. [Google Scholar] [CrossRef]
- Wang, P.; Li, J.N.; Hou, J.R. S2SAN: A sentence-to-sentence attention network for sentiment analysis of online reviews. Decis. Support Syst. 2021, 149, 113603. [Google Scholar] [CrossRef]
- Li, Q.B.; Yao, N.M.; Zhao, J.; Zhang, Y.A. Self attention mechanism of bidirectional information enhancement. Appl. Intell. 2022, 52, 2530–2538. [Google Scholar] [CrossRef]
- Liang, Y.H.; Lin, Y.; Lu, Q. Forecasting gold price using a novel hybrid model with ICEEMDAN and LSTM-CNN-CBAM. Expert Syst. Appl. 2022, 206, 117847. [Google Scholar] [CrossRef]
- Chen, W.J. Estimation of International Gold Price by Fusing Deep/Shallow Machine Learning. J. Adv. Transp. 2022, 2022, 6211861. [Google Scholar] [CrossRef]
- Chen, S.; Ge, L. Exploring the attention mechanism in LSTM-based Hong Kong stock price movement prediction. Quant. Financ. 2019, 19, 1507–1515. [Google Scholar] [CrossRef]
- Zeng, C.; Ma, C.X.; Wang, K.; Cui, Z.H. Parking Occupancy Prediction Method Based on Multi Factors and Stacked GRU-LSTM. IEEE Access 2022, 10, 47361–47370. [Google Scholar] [CrossRef]
- Deng, L.J.; Ge, Q.X.; Zhang, J.X.; Li, Z.H.; Yu, Z.Q.; Yin, T.T.; Zhu, H.X. News Text Classification Method Based on the GRU_CNN Model. Int. Trans. Electr. Energy Syst. 2022, 2022, 1197534. [Google Scholar] [CrossRef]
- Sun, W.W.; Guan, S.P. A GRU-based traffic situation prediction method in multi-domain software defined network. PeerJ Comput. Sci. 2022, 8, e1011. [Google Scholar] [CrossRef]
Environment Type | Project Name | Value |
---|---|---|
Hardware environment | Operating system | Windows 11 |
CPU | Intel i7-12700H 2.30 GHz | |
Memory | 16GB | |
Graphics card | RTX 3070Ti | |
Software environment | Development tools | PyCharm 2020 1.3 |
Programming language | Python3.7.0 | |
Basic platform | Anaconda4.5.11 | |
Learning framework | keras2.1.0 and TensorFlow 1.14.0 |
Trade_Date | Open | High | Low | Close | Change | Settle | Vol | Oi |
---|---|---|---|---|---|---|---|---|
5 January 2015 | 3498 | 3516 | 3478 | 3507 | −17 | 3500 | 51379800 | 41042000 |
6 January 2015 | 3490 | 3566 | 3462 | 3554 | 54 | 3517 | 219997200 | 45015800 |
7 January 2015 | 3544 | 3596 | 3530 | 3554 | 37 | 3556 | 186587600 | 40197400 |
8 January 2015 | 3540 | 3578 | 3537 | 3548 | −8 | 3558 | 143412200 | 41246400 |
9 January 2015 | 3568 | 3586 | 3544 | 3555 | −3 | 3562 | 141589000 | 40017000 |
Trade_Date | SPX | US30 | NAS100 | USDI | AU | SSI |
---|---|---|---|---|---|---|
5 January 2015 | 2000.63 | 17362 | 4102.8999 | 11648 | 242.15 | 3350.519 |
6 January 2015 | 2026.38 | 17590 | 4155.8999 | 11655 | 244.45 | 3351.446 |
7 January 2015 | 2060.1299 | 17881 | 4236.8999 | 11684 | 245.25 | 3373.9541 |
8 January 2015 | 2041.88 | 17720 | 4207.6001 | 11690 | 244.5 | 3293.4561 |
9 January 2015 | 2041.88 | 17720 | 4207.6001 | 11633 | 245.15 | 3285.4121 |
Model | Layer | Parameters |
---|---|---|
Prophet | Prophet | interval_width = 0.8 |
SVR | SVR | kernel = ‘linear’, epsilon = 0.07, C = 4 |
MLP | MLP | activation = “tanh” |
ARIMA | ARIMA | dynamic = false |
LSTM | LSTM | activation = ‘tanh’, units = 128 |
Bi-LSTM | Bi-LSTM | activation = ‘tanh’, units = 128 |
GRU | GRU | activation = ‘tanh’, units = 128 |
NGU | NGU | activation = ‘tanh’, units = 128 |
CNN-LSTM | Conv1D LSTM | filters = 16, kernel_size = 3, activation = ‘tanh’, units = 128 |
CNN-GRU | Conv1D GRU | filters = 16, kernel_size = 3, activation = ‘tanh’, units = 128 |
CNN-NGU | Conv1D NGU | filters = 16, kernel_size = 3, activation = ‘tanh’, units = 128 |
CNN-SA-LSTM | Conv1D SA LSTM | filters = 16, kernel_size = 3, initializer = ‘uniform’, activation = ‘tanh’, units = 128 |
CNN-SA-GRU | Conv1D SA GRU | filters = 16, kernel_size = 3, initializer = ‘uniform’, activation = ‘tanh’, units = 128 |
CNN-SA-NGU | Conv1D SA NGU | filters = 16, kernel_size = 3, initializer = ‘uniform’, activation = ‘tanh’, units = 128 |
Model | MAE | EVS | Training Time (t/s) | |
---|---|---|---|---|
Prophet | 176.829765 | 0.899582 | 0.864999 | 73.432 |
SVR | 182.038698 | 0.928241 | 0.903835 | 50.824 |
MLP | 190.168172 | 0.848885 | 0.837680 | 5.598 |
ARIMA | 168.655063 | 0.907159 | 0.907148 | 24.946 |
LSTM | 116.539392 | 0.940564 | 0.940126 | 450.684 |
Bi-LSTM | 119.670333 | 0.941758 | 0.941239 | 1306.247 |
GRU | 118.748377 | 0.939636 | 0.936895 | 334.112 |
NGU | 103.960158 | 0.955276 | 0.953869 | 278.847 |
CNN-LSTM | 113.772953 | 0.956882 | 0.944692 | 398.622 |
CNN-GRU | 108.031883 | 0.947018 | 0.944206 | 272.832 |
CNN-NGU | 97.277688 | 0.965663 | 0.963685 | 253.501 |
CNN-SA-LSTM | 102.664546 | 0.954118 | 0.952839 | 428.042 |
CNN-SA-GRU | 97.424566 | 0.960515 | 0.957547 | 328.642 |
CNN-SA-NGU | 87.898771 | 0.970745 | 0.970169 | 332.777 |
Model | MAE | EVS | Training Time (t/s) | |
---|---|---|---|---|
Prophet | 7.328386 | 0.889623 | 0.849623 | 61.752 |
SVR | 5.767165 | 0.935615 | 0.915764 | 45.185 |
MLP | 7.012249 | 0.901912 | 0.861166 | 9.969 |
ARIMA | 6.757669 | 0.941629 | 0.898242 | 28.905 |
LSTM | 4.871939 | 0.942918 | 0.939975 | 479.996 |
Bi-LSTM | 4.855796 | 0.944959 | 0.943941 | 1098.907 |
GRU | 4.736281 | 0.946534 | 0.944854 | 323.123 |
NGU | 4.814574 | 0.972503 | 0.955799 | 279.747 |
CNN-LSTM | 4.625511 | 0.962245 | 0.951108 | 465.302 |
CNN-GRU | 4.528336 | 0.959778 | 0.953008 | 306.796 |
CNN-NGU | 4.032819 | 0.971674 | 0.966912 | 257.907 |
CNN-SA-LSTM | 4.264018 | 0.960852 | 0.956380 | 483.592 |
CNN-SA-GRU | 4.185553 | 0.959046 | 0.959038 | 374.097 |
CNN-SA-NGU | 3.628549 | 0.972574 | 0.971670 | 367.560 |
Model | MAE | EVS | Training Time (t/s) | |
---|---|---|---|---|
Prophet | 47.545572 | 0.902315 | 0.901356 | 63.558 |
SVR | 31.234645 | 0.959948 | 0.958887 | 36.740 |
MLP | 40.541882 | 0.942551 | 0.933907 | 8.011 |
ARIMA | 39.251600 | 0.955644 | 0.955076 | 25.791 |
LSTM | 28.944838 | 0.968379 | 0.967678 | 466.249 |
Bi-LSTM | 28.409177 | 0.969849 | 0.968916 | 1327.013 |
GRU | 27.071643 | 0.971395 | 0.970907 | 304.327 |
NGU | 26.573712 | 0.979191 | 0.975161 | 290.925 |
CNN-LSTM | 28.279052 | 0.977564 | 0.972431 | 489.508 |
CNN-GRU | 25.767393 | 0.978223 | 0.975720 | 273.203 |
CNN-NGU | 23.452398 | 0.979790 | 0.979602 | 256.740 |
CNN-SA-LSTM | 27.767957 | 0.979228 | 0.978946 | 495.647 |
CNN-SA-GRU | 25.957919 | 0.983123 | 0.980307 | 386.600 |
CNN-SA-NGU | 22.639894 | 0.984826 | 0.984815 | 377.040 |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2023 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
Wang, H.; Dai, B.; Li, X.; Yu, N.; Wang, J. A Novel Hybrid Model of CNN-SA-NGU for Silver Closing Price Prediction. Processes 2023, 11, 862. https://doi.org/10.3390/pr11030862
Wang H, Dai B, Li X, Yu N, Wang J. A Novel Hybrid Model of CNN-SA-NGU for Silver Closing Price Prediction. Processes. 2023; 11(3):862. https://doi.org/10.3390/pr11030862
Chicago/Turabian StyleWang, Haiyao, Bolin Dai, Xiaolei Li, Naiwen Yu, and Jingyang Wang. 2023. "A Novel Hybrid Model of CNN-SA-NGU for Silver Closing Price Prediction" Processes 11, no. 3: 862. https://doi.org/10.3390/pr11030862
APA StyleWang, H., Dai, B., Li, X., Yu, N., & Wang, J. (2023). A Novel Hybrid Model of CNN-SA-NGU for Silver Closing Price Prediction. Processes, 11(3), 862. https://doi.org/10.3390/pr11030862