Configuration Effects on LSTM-Based Stock Prediction: A Case Study on Coca-Cola
Abstract
Long Short-Term Memory (LSTM) has long been a popular prediction model across multiple fields, and extensive research has been conducted on its applications. Among these studies, most employ the traditional train–test split ratio for experiments. However, in the field of stock prediction, this ratio-based split is not practical. From an investment perspective, a key consideration lies in determining the optimal length of historical data required to produce robust and accurate predictions for future market periods. To address the practical utilization of prediction models, this study examines how external parameters—such as time window, training size, and test size (in terms of time length)—affect the performance of the LSTM model in predicting the stock price of The Coca-Cola Company. The dataset includes the historical Open, Low, High, and Close prices from January 1, 2000, to December 31, 2024, with the Close price serving as the target variable. Model performances under different parameter settings are compared using Mean Squared Error (MSE) and prediction plots. The experimental results provide insights into how these external parameters influence the LSTM’s performance in stock prediction.
References
- Sepp Hochreiter, Jürgen Schmidhuber; Long Short-Term Memory. Neural Comput 1997; 9 (8): 1735–1780. doi: https: //doi.org/10.1162/neco.1997.9.8.1735
- Zhang, Z. (2023). Comparison of LSTM and ARIMA in price forecasting: Evidence from five indexes. In Proceedings of the 2023 2nd International Conference on Economics, Smart Finance and Contemporary Trade (ESFCT 2023) (pp. 40–46). Atlantis Press. https: //doi.org/10.2991/978-94-6463-268-2_6
- Holm, A., & Åkesson, A. (2024). A comparison of LSTM and ARIMA forecasting of the stock market.
- Saputra, M.P., Ibrahim, R.A., & Saputra, R.S. (2025). Comparative Analysis of LSTM and GRU Models for Ethereum (ETH) Price Prediction. International Journal of Business, Economics, and Social Development.
- Barua, M., Kumar, T., Raj, K., & Roy, A. M. (2024). Comparative Analysis of Deep Learning Models for Stock Price Prediction in the Indian Market. FinTech, 3(4), 551-568. https: //doi.org/10.3390/fintech3040029
- Zhang, X., & Pinsky, E. (2025). S& P-500 vs. Nasdaq-100 price movement prediction with LSTM for different daily periods. Machine Learning with Applications, 19, 100617. https: //doi.org/10.1016/j.mlwa.2024.100617
- Kobiela, D., Krefta, D., Król, W., & Weichbroth, P. (2022). ARIMA vs LSTM on NASDAQ stock exchange data. Procedia Computer Science, 207, 3836–3845. https: //doi.org/10.1016/j.procs.2022.09.445
- Sebastian, A., & Tantia, V. (2025). Multi-variate LSTM with attention mechanism for the Indian stock market. International Journal of Information Management Data Insights, 5(2), 100350. https: //doi.org/10.1016/j.jjimei.2025.100350
- Gülmez, B. (2024). Stock price prediction using the Sand Cat Swarm Optimization and an improved deep long short-term memory network. Borsa Istanbul Review, 24(Suppl. 2), 32–46. https: //doi.org/10.1016/j.bir.2024.12.002
- AL Theeb, N., Smadi, H., & Al-qaydeh, N. (2025). Bayesian-optimized ensemble deep learning models for demand forecasting in the volatile situations: A case study of grocery demand during Covid-19 outbreaks. Journal of Industrial Engineering and Management, 18(1), 193-213. doi: https: //doi.org/10.3926/jiem.6571
- Diagram illustrating the gate structure of an LSTM unit. Adapted from Understanding LSTM Networks, by C. Olah, 2015, Colah’s Blog. https: //colah.github.io/posts/2015-08-Understanding-LSTMs/
- Hichenway. (n.d.). stock_predict_with_LSTM [Source code]. GitHub. https: //github.com/hichenway/stock_predict_with_LSTM
- Yahoo Finance. (2025). The Coca-Cola Company (KO) stock historical data [Data set]. Yahoo Finance. Retrieved October 7, 2025, from https: //finance.yahoo.com/quote/KO/history