Abstract
Hidden Markov Model (HMM) which is frequently used in time series modeling with satisfactory results is commonly used for predicting stock prices in many studies. Due to its more transparent structure than most of the current Neural Network (NN) models and its sensitivity to the initial parameter settings, we propose a hybrid model that combines Recurrent NN (RNN) and HMM in modeling stock prices to eliminate initial parameter influence. Despite its common application to speech recognition data with categorical variables, we reconstruct RNN and HMM for financial data. RNN is used as a solution to the probability of not reaching the global maximum based on the HMM’s initial parameters selection. To do so, we improve the classification power of HMM to achieve the hidden states that do not get stuck at a local maximum but provide the global maximum. In addition, unlike the literature, the loss function is not chosen as the maximum likelihood but is defined directly over the prices. Thus, the model does not only detect the states appropriately, yet the predictions can get closer to the actual prices. Besides, a multivariate comparison is performed to determine the effect of different numbers and types of variables through bivariate and trivariate models. The application is made on S &P 500, Nasdaq daily closing prices and daily EUR/USD exchange rates data from 2000 to 2021. It is shown that the accuracy is increased significantly compared to the implementations of HMM and RNN methods separately.
Similar content being viewed by others
Availability of data and materials
The datasets analysed during the current study are openly available in the public domain resource [Yahoo Finance] at https://finance.yahoo.com.
References
Bishop CM, Nasrabadi NM (2006) Pattern Recognition and Machine Learning. Springer, New York
Collobert, R., Weston, J.: A unified architecture for natural language processing: Deep neural networks with multitask learning. In: Proceedings of the 25th International Conference on Machine Learning, pp. 160–167 (2008)
Khan AI, Al-Habsi S (2020) Machine learning in computer vision. Procedia Computer Science 167:1444–1451
Boukerche A, Wang J (2020) Machine learning-based traffic prediction models for intelligent transportation systems. Computer Networks 181:107530
Fujiyoshi H, Hirakawa T, Yamashita T (2019) Deep learning-based image recognition for autonomous driving. IATSS research 43(4):244–252
Kononenko I (2001) Machine learning for medical diagnosis: history, state of the art and perspective. Artificial Intelligence in medicine 23(1):89–109
Gogas P, Papadimitriou T (2021) Machine learning in economics and finance. Computational Economics 57(1):1–4
Wang, H., Li, C., Gu, B., Min, W.: Does ai-based credit scoring improve financial inclusion? evidence from online payday lending. In: 40th International Conference on Information Systems, ICIS 2019 (1984). Association for Information Systems
Hochreiter S, Schmidhuber J (1997) Long short-term memory. Neural computation 9(8):1735–1780
Chung, J., Gulcehre, C., Cho, K., Bengio, Y.: Empirical evaluation of gated recurrent neural networks on sequence modeling. arXiv preprint arXiv:1412.3555 (2014)
Hsieh T-J, Hsiao H-F, Yeh W-C (2011) Forecasting stock markets using wavelet transforms and recurrent neural networks: An integrated system based on artificial bee colony algorithm. Applied soft computing 11(2):2510–2525
Nelson, D.M., Pereira, A.C., De Oliveira, R.A.: Stock market’s price movement prediction with lstm neural networks. In: 2017 International Joint Conference on Neural Networks (IJCNN), pp. 1419–1426 (2017). IEEE
Shao, X., Ma, D., Liu, Y., Yin, Q.: Short-term forecast of stock price of multi-branch lstm based on k-means. In: 2017 4th International Conference on Systems and Informatics (ICSAI), pp. 1546–1551 (2017). IEEE
Sethia, A., Raut, P.: Application of lstm, gru and ica for stock price prediction. In: Information and Communication Technology for Intelligent Systems: Proceedings of ICTIS 2018, Volume 2, pp. 479–487 (2019). Springer
Minh DL, Sadeghi-Niaraki A, Huy HD, Min K, Moon H (2018) Deep learning approach for short-term stock trends prediction based on two-stream gated recurrent unit network. Ieee Access 6:55392–55404
Polamuri SR, Srinivas K, Mohan AK (2020) Multi model-based hybrid prediction algorithm (mm-hpa) for stock market prices prediction framework (smppf). Arabian Journal for Science and Engineering 45:10493–10509
Jain, S., Gupta, R., Moghe, A.A.: Stock price prediction on daily stock data using deep neural networks. In: 2018 International Conference on Advanced Computation and Telecommunication (ICACAT), pp. 1–13 (2018). IEEE
Patel J, Shah S, Thakkar P, Kotecha K (2015) Predicting stock market index using fusion of machine learning techniques. Expert Systems with Applications 42(4):2162–2172
Zhang Y, Tiňo P, Leonardis A, Tang K (2021) A survey on neural network interpretability. IEEE Transactions on Emerging Topics in Computational Intelligence 5(5):726–742
Vaswani, A., Shazeer, N., Parmar, N., Uszkoreit, J., Jones, L., Gomez, A.N., Kaiser, Ł., Polosukhin, I.: Attention is all you need. Advances in neural information processing systems 30 (2017)
Corbetta M, Shulman GL (2002) Control of goal-directed and stimulus-driven attention in the brain. Nature reviews neuroscience 3(3):201–215
Niu Z, Zhong G, Yu H (2021) A review on the attention mechanism of deep learning. Neurocomputing 452:48–62
Hu, Z., Liu, W., Bian, J., Liu, X., Liu, T.-Y.: Listening to chaotic whispers: A deep learning framework for news-oriented stock trend prediction. In: Proceedings of the Eleventh ACM International Conference on Web Search and Data Mining, pp. 261–269 (2018)
Liu, J., Lin, H., Liu, X., Xu, B., Ren, Y., Diao, Y., Yang, L.: Transformer-based capsule network for stock movement prediction. In: Proceedings of the First Workshop on Financial Technology and Natural Language Processing, pp. 66–73 (2019)
Wang, H., Wang, T., Li, Y.: Incorporating expert-based investment opinion signals in stock prediction: A deep learning framework. In: Proceedings of the AAAI Conference on Artificial Intelligence, vol. 34, pp. 971–978 (2020)
Xu H, Chai L, Luo Z, Li S (2020) Stock movement predictive network via incorporative attention mechanisms based on tweet and historical prices. Neurocomputing 418:326–339
Zhang Q, Qin C, Zhang Y, Bao F, Zhang C, Liu P (2022) Transformer-based attention network for stock movement prediction. Expert Systems with Applications 202:117239
Alotaibi SS (2021) Ensemble technique with optimal feature selection for saudi stock market prediction: a novel hybrid red deer-grey algorithm. IEEE Access 9:64929–64944
Visser, I., Speekenbrink, M.: Introduction and Preliminaries, pp. 1–43. Springer, Cham (2022). https://doi.org/10.1007/978-3-031-01440-6_1
Bengio, Y., Cardin, R., De Mori, R., Normandin, Y.: A hybrid coder for hidden markov models using a recurrent neural networks. In: International Conference on Acoustics, Speech, and Signal Processing, pp. 537–540 (1990). IEEE
Hassan MR, Nath B, Kirley M (2007) A fusion model of hmm, ann and ga for stock market forecasting. Expert Systems with Applications 33(1):171–180
Bengio Y, De Mori R, Flammia G, Kompe R (1992) Global optimization of a neural network-hidden markov model hybrid. IEEE Transactions on Neural Networks 3(2):252–259
Tang, X.: Hybrid hidden markov model and artificial neural network for automatic speech recognition. In: 2009 Pacific-Asia Conference on Circuits, Communications and Systems, pp. 682–685 (2009). IEEE
Rabiner LR (1989) A tutorial on hidden markov models and selected applications in speech recognition. Proceedings of the IEEE 77(2):257–286
Ghahramani Z (2001) An introduction to hidden markov models and bayesian networks. International journal of pattern recognition and artificial intelligence 15(01):9–42
Bhar R, Hamori S (2004) Hidden Markov Models: Applications to Financial Economics, vol 40. Springer, New York
Dempster, A.P., Laird, N.M., Rubin, D.B.: Maximum likelihood from incomplete data via the em algorithm. Journal of the royal statistical society. Series B (methodological), 1–38 (1977)
Visser, I., Speekenbrink, M.: Multivariate Hidden Markov Models, pp. 201–230. Springer, Cham (2022). https://doi.org/10.1007/978-3-031-01440-6_6
Oflaz ZN, Yozgatligil C, Selcuk-Kestel AS (2019) Aggregate claim estimation using bivariate hidden markov model. ASTIN Bulletin: The Journal of the IAA 49(1):189–215
Abraham, A.: Artificial neural networks. handbook of measuring system design (2005)
He X, Xu S (2010) Process Neural Networks: Theory and Applications. Springer, New York
Rojas R (2013) Neural Networks: a Systematic Introduction. Springer, New York
Funding
The authors did not receive support from any organization for the submitted work.
Author information
Authors and Affiliations
Corresponding authors
Ethics declarations
Conflict of interest
The authors have no relevant financial or non-financial interests to disclose.
Additional information
Publisher's Note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Appendix: Parameters of the RNN, RNN-HMM, LSTM and GRU experiments
Appendix: Parameters of the RNN, RNN-HMM, LSTM and GRU experiments
The common parameters of each RNN, RNN-HMM, LSTM and GRU experiment are mentioned in Section 3.2. Moreover, the remaining parameters of learning rate and epoch numbers of RNN and RNN-HMM are presented in Table 15, and the unmentioned parameters of LSTM and GRU are shown in Table 16 and 17, respectively.
Rights and permissions
Springer Nature or its licensor (e.g. a society or other partner) holds exclusive rights to this article under a publishing agreement with the author(s) or other rightsholder(s); author self-archiving of the accepted manuscript version of this article is solely governed by the terms of such publishing agreement and applicable law.
About this article
Cite this article
Aydogan-Kilic, D., Selcuk-Kestel, A.S. Modification of hybrid RNN-HMM model in asset pricing: univariate and multivariate cases. Appl Intell 53, 23812–23833 (2023). https://doi.org/10.1007/s10489-023-04762-7
Accepted:
Published:
Issue Date:
DOI: https://doi.org/10.1007/s10489-023-04762-7