Stock Price Prediction: Evaluating the Efficacy of CNN, LSTM, CNN-LSTM, and CNN-BILSTM Models

Authors

  • Ebiesuwa Seun, Adebanjo Olawunmi Asake, Adesoji Adedeji Adegbola, Adegbenjo Aderonke A, Okesola, Kikelomo Ibiwumi, Falana Taye Oluwaseun, Awoniyi Tolulope Amos

Keywords:

Stock price, CNN, LSTM, BiLSTM

Abstract

The stock market's dynamic nature predicts accurate prices which is a daunting task for analysts and investors. Conventional statistical models struggle with this due to hidden non-linear relationships and time-dependent patterns in financial data. This sparks a rising interest in harnessing the power of machine learning, particularly neural networks, for improved stock price forecasting. This study uses four neural network models - CNN, LSTM, CNN-LSTM, and CNN-BILSTM to forecast stock prices. Their performance is evaluated through four metrics: Mean Absolute Error (MAE), Root Mean Squared Error (RMSE), R-squared (R²), and Mean Absolute Percentage Error (MAPE). The US stock price dataset from 1998-2021 was used, the dataset was obtained from Kaggle and was preprocessed by normalizing and scaling. Python was used to train the models, the study then compares the hybrid models (CNN-LSTM and CNN-BILSTM) to their standalone counterparts, aiming to reveal their potential superiority in prediction accuracy and error minimization. Analysis that the hybrid models, particularly CNN-LSTM with its attention mechanism, outperformed their standalone counterparts in predicting stock prices and minimizing errors. CNN-BiLSTM followed closely, demonstrating strong performance as well. While CNN exhibited the lowest RMSE and MAE, its high MAPE suggests limited predictive power. This may be due to CNN's focus on feature extraction rather than temporal dependencies, highlighting the effectiveness of hybrid models in capturing complex market dynamics.

Downloads

Download data is not yet available.

References

P.-F. Pai and C.-S. Lin, "A hybrid ARIMA and support vector machines model in stock price forecasting," Omega, vol. 33, no. 5, pp. 497-505, 2005

W. Lu, J. Li, Y. Li, A. Sun, and J. Wang, "A CNN-LSTM-based model to forecast stock prices," Hindawi Complexity, vol. 2020, Article ID 6622927, 2020. [Online]. Available: https://doi.org/10.1155/2020/6622927

R. Adhikari and R. K. Agrawal, "A combination of artificial neural network and random walk models for financial time series forecasting," Neural Comput. & Appl., vol. 24, pp. 305-315, 2014. [Online]. Available: https://doi.org/10.1007/s00521-013-1386-y

L. Zhang, F. Wang, B. Xu, W. Chi, Q. Wang, and T. Sun, "Prediction of stock prices based on LM-BP neural network and the estimation of overfitting point by RDCI," Neural Comput. & Appl., vol. 30, no. 5, pp. 1425-1444, 2018.

A. Graves, A. Mohamed, and G. Hinton, "Speech recognition with deep recurrent neural networks," in Proc. IEEE Int. Conf. Acoust., Speech, Signal Process., pp. 6645-6649, 2013.

X. Pang, Y. Zhou, P. Wang, W. Lin, and V. Chang, "An innovative neural network approach for stock market prediction," J. Supercomput., vol. 76, no. 3, pp. 2098-2118, 2020.

D. M. Nelson, A. C. Pereira, and R. A. de Oliveira, "Stock market’s price movement prediction with LSTM neural networks," in Proc. Int. Joint Conf. Neural Netw., pp. 1419-1426, 2017.

B. Hu, Z. Lu, H. Li, and Q. Cheng, "Convolutional neural network architectures for matching natural language sentences," in Adv. Neural Inf. Process. Syst., vol. 27, pp. 2042-2050, 2014.

Y. Hu, "Stock market timing model based on convolutional neural network – a case study of Shanghai composite index," Finance & Econ., vol. 4, pp. 71-74, 2018.

F. Kamalov, "Forecasting significant stock price changes using neural networks," arXiv preprint arXiv:1912.08791, 2019. [Online]. Available: https://arxiv.org/pdf/1912.08791.pdf

Y. Xue, C. Wang, and C. Miao, "Research on financial assets transaction prediction model based on LSTM neural network," Neural Comput. & Appl., 2020. [Online]. Available: https://doi.org/10.1007/s00521-020-04992-7

J. Zhang, L. Ye, and Y. Lai, "Stock price prediction using CNN-BiLSTM-Attention model," Mathematics, vol. 11, no. 9, p. 1985, 2023. [Online]. Available: https://doi.org/10.3390/math11091985

Y. Lecun, L. Bottou, Y. Bengio, and P. Haffner, "Gradient-based learning applied to document recognition," Proc. IEEE, vol. 86, no. 11, pp. 2278-2324, 1998.

L. Qin, N. Yu, and D. Zhao, "Applying the convolutional neural network deep learning technology to behavioral recognition in intelligent video," Tehnicki Vjesnik-Technical Gazette, vol. 25, no. 2, pp. 528-535, 2018.

D. Chicco, M. J. Warrens, and G. Jurman, "The coefficient of determination R-squared is more informative than SMAPE, MAE, MAPE, MSE and RMSE in regression analysis evaluation," PeerJ Computer Science, vol. 7, p. e623, Jul. 2021, doi: 10.7717/peerj-cs.623.

A. Salehpour, "Predicting Automobile Stock Prices Index in the Tehran Stock Exchange Using Machine Learning Models," I.J. Intelligent Systems and Applications, vol. 5, pp. 12-27, Oct. 2023. [Online]. Available: http://www.mecs-press.org/. DOI: 10.5815/ijisa.2023.05.02

Z. Cui, R. Ke, and Y. Wang, "Deep bidirectional and unidirectional LSTM recurrent neural network for network-wide traffic speed prediction," arXiv preprint arXiv:1801.02143, 2018.

A. R. Gosthipaty, D. Chakraborty, and R. Raha, "Long Short-Term Memory Networks," PyImageSearch, 2022. [Online]. Available: https://pyimagesearch.com/2022/08/01/long-short-term-memory-networks

S. Hochreiter and J. Schmidhuber, "Long short-term memory," MIT Press, vol. 9, no. 8, pp. 1735-1780, 1997.

Sidharth, "Convolutional Neural Network (CNN): Architecture Explained | Deep Learning," PyCodeMates, 2023. [Online]. Available: https://www.pycodemates.com/2023/06/introduction-to-convolutional-neural-networks.htmlF.

E. Alibasic, B. Fazo, and I. Petrovic, "A new approach to calculating electrical energy losses on power lines with a new improved three-mode method," Tehnicki Vjesnik-Technical Gazette, vol. 26, no. 2, pp. 405-411, 2019.

Sidharth, "Derivation of Backpropagation in Convolutional Neural Network (CNN)," PyCodeMates, Aug. 15, 2023. [Online]. Available: https://www.pycodemates.com/2023/07/backward-pass-in-convolutional-neural-network-explained.html. Accessed: Oct. 20, 2023.

Downloads

Published

13.11.2024

How to Cite

Ebiesuwa Seun. (2024). Stock Price Prediction: Evaluating the Efficacy of CNN, LSTM, CNN-LSTM, and CNN-BILSTM Models. International Journal of Intelligent Systems and Applications in Engineering, 12(4), 4259–4268. Retrieved from https://www.ijisae.org/index.php/IJISAE/article/view/7044

Issue

Section

Research Article