Abstract
Stock price prediction is a complex time-series problem because price movements are dynamic and exhibit temporal patterns. This study aims to implement and evaluate a Long Short-Term Memory (LSTM) model for forecasting the closing price of Apple Inc. (AAPL) stock using historical data obtained from Yahoo Finance for the 2022–2024 period. The data were preprocessed using Min-Max Scaling, transformed into sequences with a 60-day time step, and chronologically divided into 80% training data and 20% testing data. The model employed two LSTM layers with a dropout rate of 0.2, the Adam optimizer, and Mean Squared Error as the loss function. The evaluation results yielded a Root Mean Squared Error (RMSE) of 3.31 and a Mean Absolute Error (MAE) of 2.68. The visualization indicates that the predicted values generally follow the actual price trend, although deviations occur during several periods of sharper price changes. These findings indicate that the LSTM model can learn temporal patterns in AAPL closing prices and generate forecasts that approximate the actual values.
References
Agarwal, S., Sharma, S., Faisal, K. N., & Sharma, R. R. (2025). Time-series forecasting using SVMD-LSTM: A hybrid approach for stock market prediction. Journal of Probability and Statistics, 2025(1), Article 9464938. https://doi.org/10.1155/jpas/9464938
Alizadegan, H., Rashidi Malki, B., Radmehr, A., Karimi, H., & Ilani, M. A. (2025). Comparative study of long short-term memory (LSTM), bidirectional LSTM, and traditional machine learning approaches for energy consumption prediction. Energy Exploration & Exploitation, 43(1), 281–301. https://doi.org/10.1177/01445987241269496
Andi, T., & Kusuma, C. J. C. (2025). Stock price forecasting using long short-term memory. Internet of Things and Artificial Intelligence Journal, 5(1), 187–193. https://doi.org/10.31763/iota.v5i1.900
Chaudhary, R. (2025). Advanced stock market prediction using long short-term memory networks: A comprehensive deep learning framework. arXiv. https://doi.org/10.48550/arXiv.2505.05325
Gao, Y., Wang, R., & Zhou, E. (2021). Stock prediction based on optimized LSTM and GRU models. Scientific Programming, 2021(1), Article 4055281. https://doi.org/10.1155/2021/4055281
Janiesch, C., Zschech, P., & Heinrich, K. (2021). Machine learning and deep learning. Electronic Markets, 31(3), 685–695. https://doi.org/10.1007/s12525-021-00475-2
Kulkarni, S. A., Gurav, S., Lahade, A., Gudavalekar, D., & Sangale, N. (2024). Stock price prediction using LSTM. Indian Journal of Computer Science and Technology, 3(1), 22–24. https://doi.org/10.59256/indjcst.20240301001
Li, Z., Yu, H., Xu, J., Liu, J., & Mo, Y. (2023). Stock market analysis and prediction using LSTM: A case study on technology stocks. Innovations in Applied Engineering and Technology, 2(1), 1–6. https://doi.org/10.62836/iaet.v2i1.162
Nasution, M. A., & Al-Khowarizmi, A.-K. (2025). Data-driven portfolio optimization using K-means and Markowitz model: Evidence from LQ45 stocks. Economic: Journal Economic and Business, 4(2), 349–354. https://doi.org/10.56495/ejeb.v4i2.1155
Pardeshi, K., Gill, S. S., & Abdelmoniem, A. M. (2023). Stock market price prediction: A hybrid LSTM and sequential self-attention based approach. arXiv. https://doi.org/10.48550/arXiv.2308.04419
Sherstinsky, A. (2020). Fundamentals of recurrent neural network (RNN) and long short-term memory (LSTM) network. Physica D: Nonlinear Phenomena, 404, Article 132306. https://doi.org/10.1016/j.physd.2019.132306
Switrayana, I. N., Hammad, R., Irfan, P., Sujaka, T. T., & Nasri, M. H. (2025). Comparative analysis of stock price prediction using deep learning with data scaling method. Jurnal Teknologi Informasi dan Multimedia, 7(1), 78–90. https://doi.org/10.35746/jtim.v7i1.650

This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
Copyright (c) 2026 Prayoga Sungkowo, Al-Khowarizmi Al-Khowarizmi