Bayesian-Optimized LSTM Framework for Accurate Stock Price Prediction

Authors

  • Muhammad Idham Maulana Brawijaya University
  • Syaiful Anam Brawijaya University
  • Hilmi Aziz Bukhori Brawijaya University

DOI:

https://doi.org/10.30871/jaic.v10i2.11756

Keywords:

Bayesian optimization, deep learning, financial forecasting, LSTM, stock price prediction

Abstract

Stock price prediction remains a challenging task due to the highly volatile and non-linear nature of financial market data. Long Short-Term Memory (LSTM) networks have shown remarkable success in modelling temporal dependencies, yet their predictive performance heavily depends on optimal hyperparameter tuning. Conventional methods such as Grid Search and Random Search are often computationally expensive and suboptimal. This study proposes a systematic and data-driven framework that integrates Bayesian Optimization (BO) to enhance the performance of LSTM models for stock price prediction (LSTM+BO Model). Using Amazon (AMZN) daily stock data from 2019 to 2025, the LSTM+BO model was rigorously compared with a standard LSTM and several deep learning and machine learning benchmarks. All models were evaluated over 25 independent runs to ensure statistical reliability. The results demonstrate that the LSTM+BO model achieved the lowest Mean Absolute Percentage Error (2.4413%) and the highest R² score (0.8736), outperforming all benchmarks. Moreover, the optimized model exhibited greater stability and computational efficiency compared to the default configuration. These findings confirm that BO offers an effective and robust approach for systematically developing accurate and efficient forecasting models in financial analytics, providing a strong foundation for the development of automated and adaptive financial forecasting systems.

Downloads

Download data is not yet available.

References

[1] A. Sarkar and G. Vadivu, “An Advanced Ensemble Deep Learning Framework for Stock Price Prediction Using VAE, Transformer, and LSTM Model,” 2025.

[2] Z. Hu, Y. Zhao, and M. Khushi, “A survey of forex and stock price prediction using deep learning,” Applied System Innovation, vol. 4, no. 1, pp. 1–30, 2021, doi: 10.3390/ASI4010009.

[3] T. Fischer and C. Krauss, “Deep learning with long short-term memory networks for financial market predictions,” Eur. J. Oper. Res., vol. 270, no. 2, pp. 654–669, 2018, doi: 10.1016/j.ejor.2017.11.054.

[4] S. Deviana, Nusyirwan, D. Azis, and P. Ferdias, “Analisis Model Autoregressive Integrated Moving Average Data Deret Waktu Dengan Metode Momen Sebagai Estimasi Parameter,” Jurnal Siger Matematika, vol. 02, no. 02, pp. 57–67, 2021.

[5] A. Gifty and Dr. Yang Li, “A Comparative Analysis of LSTM, ARIMA, XGBoost Algorithms in Predicting Stock Price Direction,” Engineering and Technology Journal, vol. 09, no. 08, pp. 4978–4986, 2024, doi: 10.47191/etj/v9i08.50.

[6] S. Hochreiter and J. Schmidhuber, “Long Short-Term Memory,” Neural Comput., vol. 9, no. 8, pp. 1735–1780, 1997, doi: 10.1162/neco.1997.9.8.1735.

[7] Z. Zhang, Comparison of LSTM and ARIMA in Price Forecasting: Evidence from Five Indexes, no. Esfct 2023. Atlantis Press International BV, 2024. doi: 10.2991/978-94-6463-268-2_6.

[8] B. Gautam, S. Kandel, M. Shrestha, and S. Thakur, “Comparative Analysis of Machine Learning Models for Stock Price Prediction: Leveraging LSTM for Real-Time Forecasting,” Journal of Computer and Communications, vol. 12, no. 08, pp. 52–80, 2024, doi: 10.4236/jcc.2024.128004.

[9] S. Mehtab and J. Sen, “Stock Price Prediction Using CNN and LSTM-Based Deep Learning Models,” 2020 International Conference on Decision Aid Sciences and Application, DASA 2020, pp. 447–453, 2020, doi: 10.1109/DASA51403.2020.9317207.

[10] S. Mehtab, J. Sen, and A. Dutta, “Stock Price Prediction Using Machine Learning and LSTM-Based Deep Learning Models | Papers With Code”.

[11] A. Flavia and C. Mio, “Performance Comparison of Standard LSTM and LSTM with Random Search Optimization for Spark New Zealand Limited Stock Price Prediction,” International Journal Artificial Intelligent and Informatics, vol. 3, no. 2, pp. 60–66, 2025, doi: 10.33292/ijarlit.v3i2.48.

[12] A. Parkin, M. Herrera, and D. A. Coley, “Energy or carbon? Exploring the relative size of universal zero carbon and zero energy design spaces,” Building Services Engineering Research and Technology, vol. 40, no. 3, pp. 319–339, May 2019, doi: 10.1177/0143624418815780.

[13] T. Yu and H. Zhu, “Hyper-Parameter Optimization: A Review of Algorithms and Applications,” pp. 1–56, 2020.

[14] P. I. Frazier, “A Tutorial on Bayesian Optimization,” no. Section 5, pp. 1–22, 2018.

[15] B. Dinda, “Gated recurrent neural network with TPE Bayesian optimization for enhancing stock index prediction accuracy,” 2022.

[16] B. K. Chan, O. V. Johnson, X. Chew, K. W. Khaw, M. H. Lee, and A. Alnoor, “Proposed Bayesian Optimization Based LSTM-CNN Model for Stock Trend Prediction,” Computing and Informatics, vol. 43, no. 1, pp. 38–63, 2024, doi: 10.31577/cai_2024_1_38.

[17] W. Huang, Y. Nakamori, and S. Wang, “Stock prediction based on Bayesian-LSTM,” in International Conference on Machine Learning and Cybernetics, 2018. doi: 10.1109/ICMLC.2018.8527025.

[18] B. K. Chan, O. V Johnson, X. Chew, K. W. Khaw, M. H. Lee, and A. Alnoor, “Proposed Bayesian Optimization Based LSTM-CNN Model for Stock Trend Prediction,” Computing and Informatics, vol. 43, no. 1, pp. 38–63, 2024, doi: 10.31577/cai_2024_1_38.

[19] K. Chen, Y. Zhao, and F. Dai, “A Critical Review of Recurrent Neural Networks for Sequence Learning,” in 2015 IEEE International Conference on Big Data (Big Data), Oct. 2015. [Online]. Available: http://arxiv.org/abs/1506.00019

[20] T. Yu and H. Zhu, “Hyper-parameter optimization: A review of algorithms and applications,” arXiv preprint arXiv:2003.05689, 2020.

[21] T. Fischer and C. Krauß, “Deep Learning With Long Short-Term Memory Networks for Financial Market Predictions,” Eur. J. Oper. Res., 2018, doi: 10.1016/j.ejor.2017.11.054.

[22] A. Moghar and M. Hamiche, “Stock market prediction using LSTM recurrent neural network,” Procedia Comput. Sci., vol. 170, pp. 1168–1173, 2020, doi: 10.1016/j.procs.2020.03.049.

[23] P. I. Frazier, “A Tutorial on Bayesian Optimization,” 2018. [Online]. Available: https://arxiv.org/abs/1807.02811

[24] M. Martínez-Ramón, M. Ajith, and A. Rajendra Kurup, Deep Learning: A Practical Introduction., 1st ed. Chichester.

[25] R. Garnett, Bayesian Optimization. Cambridge, UK: Cambridge University Press, 2023. doi: 10.1017/9781108348973.

[26] S. Anam, H. A. Bukhori, A. Maulana, M. I. Maulana, and H. Rasikhun, “An Enhanced Particle Swarm Optimization with Mutation for Mean-Value-at-Risk Portfolio Optimization in the Indonesian Banking Sector,” Jurnal Teknik Informatika (Jutif), vol. 6, no. 4, pp. 2648–2666, 2025, doi: 10.52436/1.jutif.2025.6.4.5191.

[27] 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 Comput. Sci., vol. 7, pp. 1–24, 2021, doi: 10.7717/PEERJ-CS.623.

Downloads

Published

2026-04-16

How to Cite

[1]
M. I. Maulana, S. Anam, and H. A. Bukhori, “Bayesian-Optimized LSTM Framework for Accurate Stock Price Prediction”, JAIC, vol. 10, no. 2, pp. 1282–1290, Apr. 2026.

Similar Articles

1 2 3 4 5 > >> 

You may also start an advanced similarity search for this article.