Hyperparameter Tuning of the LSTM model for Stock Price Prediction

Authors

  • Vikas Deswal , Dharminder Kumar

Keywords:

LSTM, Adaboost, MSE, MAE, R2, epoch, batch size, neurons, learning rate, and dropout rate1.

Abstract

The stock market serves as a mirror, revealing the actual state of the nation's economy. Experts can monitor the nation's economic status by following the stock market's fluctuations. Predicting the stock market is so essential in the cutthroat world of today. Because stock prices are chaotic, dynamic, and nonlinear, predicting them is challenging. Stock price forecasting is aided by deep learning methods such as LSTM. The algorithm's forecast is erroneous since its hyperparameter was not chosen correctly.

This work contributes to developing a hyper-tuned LSTM model for stock price prediction. Numerous hyperparameters are included, such as neurons, batch size, epoch, learning rate, and dropout rate. The primary goal is to identify the optimal set of parameters that will enable the LSTM forecasting algorithm to operate at a high level of performance. Three widely used error metrics are used to assess algorithm performance: R2, which indicates how well our predictions match the actual data; MSE, which displays the discrepancy between the predicted and actual data; and MAE, which indicates the average deviation between our predictions and the actual data. For training, testing, and validating the data set, values of three error metrics for various parameter combinations are gathered. The best value of these error metrics helps in selecting the best possible combination of parameters.

A proven prediction method called Adaboost is compared with the output error metrics of the LSTM model to confirm our hyperparameter tunning efforts. The LSTM model's potential for precise stock price prediction is strongly confirmed if its error metrics value is comparable to or superior to Adaboost's.

Downloads

Download data is not yet available.

References

D. S. N. Ulum and A. S. Girsang, “Hyperparameter Optimization of Long-Short Term Memory using Symbiotic Organism Search for Stock Prediction,” International Journal of Innovative Research and Scientific Studies, vol. 5, no. 2, pp. 121–133, 2022, doi: 10.53894/ijirss.v5i2.415.

V. Deswal and D. Kumar, “Stock price prediction of AAPL stock by using machine learning techniques: A comparative study”, 2023 12th International Conference on System Modeling & Advancement in Research Trends (SMART),Moradabad, India, pp.189-197.

K. E. Hoque and H. Aljamaan, “Impact of hyperparameter tuning on machine learning models in stock price forecasting,” IEEE Access, vol. 9, pp. 163815–163830, 2021, doi: 10.1109/ACCESS.2021.3134138.

N. Reimers and I. Gurevych, "Optimal hyperparameters for deep lstm-networks for sequence labeling tasks," arXiv preprint arXiv:1707.06799, vol. 1, pp. 1 - 34, 2017.Available at: https://doi.org/10.48550/arXiv.1707.06799.

M. Hermans and B. Schrauwen, "Training and analyzing deep recurrent neural networks," in Proceedings of the 26th International Conference on Neural Information Processing Systems, 2013, pp. 190-198.

Yadav, C. K. Jha, and A. Sharan, “Optimizing LSTM for time series prediction in Indian stock market,” in Procedia Computer Science, Elsevier B.V., 2020, pp. 2091–2100. doi: 10.1016/j.procs.2020.03.257.

L. Li, K. Jamieson, G. DeSalvo, A. Rostamizadeh, and F. Talwalkar, "Hyperband: A novel bandit-based approach to hyperparameter optimization," Journal of Machine Learning Research, vol. 18, no. 185, pp. 1-52, 2017.

Hewamalage, H., Bergmeir, C., Bandara, K.: Recurrent neural networks for time series forecasting: Current status and future directions. International Journal of Forecasting 37(1), 388–427 (2021). doi:10.1016/j.ijforecast.2020.06.008.

S. Girsang, F. Lioexander, and D. Tanjung, "Stock price prediction using LSTM and search economics optimization," IAENG International Journal of Computer Science, vol. 47, pp. 758-764, 2020.

E. Ismanto, “LSTM Network Hyperparameter Optimization for Stock Price Prediction Using the Optuna Framework,” Jurnal Ilmiah Teknik Elektro Komputer dan Informatika (JITEKI), vol. 9, no. 1, pp. 22–35, 2023, doi: 10.26555/jiteki.v9i1.24944.

U. K. Lilhore et al., “Hybrid CNN-LSTM model with efficient hyperparameter tuning for prediction of Parkinson’s disease,” Sci Rep, vol. 13, no. 1, Dec. 2023, doi: 10.1038/s41598-023-41314-y.

Y. Li, Y. Zhang, and Y. Cai, “A new hyper-parameter optimization method for power load forecast based on recurrent neural networks,” Algorithms, vol. 14, no. 6, 2021, doi: 10.3390/a14060163.

N. Gorgolis, I. Hatzilygeroudis, Z. Istenes, and L. N. G. Gyenne, “Hyperparameter Optimization of LSTM Network Models through Genetic Algorithm,” in 10th International Conference on Information, Intelligence, Systems and Applications, IISA 2019, Institute of Electrical and Electronics Engineers Inc., Jul. 2019. doi: 10.1109/IISA.2019.8900675.

J. Bergstra, R. Bardenet, Y. Bengio, and B. Kégl, “Algorithms for Hyper-Parameter Optimization.”

J. Bergstra, J. B. Ca, and Y. B. Ca, “Random Search for Hyper-Parameter Optimization Yoshua Bengio,” 2012. [Online]. Available: http://scikit-learn.sourceforge.net.

L. Yang and A. Shami, “On Hyperparameter Optimization of Machine Learning Algorithms: Theory and Practice,” Jul. 2020, doi: 10.1016/j.neucom.2020.07.061.

P. Probst, M. Wright, and A.-L. Boulesteix, “Hyperparameters and Tuning Strategies for Random Forest,” Apr. 2018, doi: 10.1002/widm.1301.

N. Bakhashwain and A. Sagheer, “Online Tuning of Hyperparameters in Deep LSTM for Time Series Applications,” International Journal of Intelligent Engineering and Systems, vol. 14, no. 1, pp. 212–220, 2020, doi: 10.22266/IJIES2021.0228.21.

T. Makarovskikh, M. Abotaleb, Z. Albadran, and A. J. Ramadhan, “Hyper-parameter tuning for the long short-term memory algorithm,” in 4TH INTERNATIONAL SCIENTIFIC CONFERENCE OF ALKAFEEL UNIVERSITY (ISCKU 2022), AIP Publishing, Dec. 2023, p. 020097. doi: 10.1063/5.0181833.

D. S. N. Ulum and A. S. Girsang, “Hyperparameter Optimization of Long-Short Term Memory using Symbiotic Organism Search for Stock Prediction,” International Journal of Innovative Research and Scientific Studies, vol. 5, no. 2, pp. 121–133, 2022, doi: 10.53894/ijirss.v5i2.415.

S. Girsang, F. Lioexander, and D. Tanjung, “Stock Price Prediction Using LSTM and Search Economics Optimization.”

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

K. Cho, B. van Merrienboer, C. Gulcehre, D. Bahdanau, F. Bougares, H. Schwenk, and Y. Bengio, "Learning phrase representations using RNN encoder-decoder for statistical machine translation," in Proc. Conference on Empirical Methods in Natural Language Processing (EMNLP), 2014, pp. 1724-1734.

Kim, Y.; Roh, J.H.; Kim, H. Early Forecasting of Rice Blast Disease Using Long Short-Term Memory Recurrent Neural Networks. Sustainability 2017, 10, 34.

Y. Liu, Y. Zhou, S. Wen, and C. Tang, “A Strategy on Selecting Performance Metrics for Classifier Evaluation,” Int. J. Mob. Comput. Multimed. Commun., vol. 6, no. 4, pp. 20–35, 2014, doi: 10.4018/IJMCMC.2014100102.

A. Behera and A. Chinmay, “Stock Price Prediction using Machine Learning,” Proc. - 2022 Int. Conf. Mach. Learn. Comput. Syst. Secur. MLCSS 2022, no. January, pp. 3–5, 2022, doi: 10.1109/MLCSS57186.2022.00

Downloads

Published

20.06.2024

How to Cite

Vikas Deswal. (2024). Hyperparameter Tuning of the LSTM model for Stock Price Prediction. International Journal of Intelligent Systems and Applications in Engineering, 12(4), 705–712. Retrieved from https://ijisae.org/index.php/IJISAE/article/view/6274

Issue

Section

Research Article