Amazon Stock Price Prediction Using Long Short-Term Memory (LSTM) and Gated Recurrent Unit (GRU)
DOI:
https://doi.org/10.57152/predatecs.v3i1.1656Keywords:
Amazon, Deep Learning, Gated Recurrent Unit, Long Short-Term Memory, PredictionAbstract
Stocks have become one of the largest and most intricate financial markets globally due to their high popularity, making them very challenging to predict as they can process millions of transactions rapidly. The objective of this study is to enhance the field by creating a dependable and accurate model for predicting the stock price of Amazon. This will be achieved via the use of advanced algorithms such as Long Short-Term Memory (LSTM) and Gated Recurrent Unit (GRU). This research utilised historical data on Amazon's stock price from the past five years, which was acquired from Yahoo Finance. The data was partitioned using a hold-out validation technique, allocating 80% for training and 20% for testing. The model underwent training using different optimizers (Adam, SGD, RMSprop), batch sizes (8, 16, 32), and learning rates (0.001, 0.0001). The evaluation criteria comprised of mean squared error (MSE), root mean squared error (RMSE), mean absolute error (MAE), and mean absolute percentage error (MAPE). The results suggest that the GRU model, when trained with the RMSprop optimizer using a batch size of 16 and a learning rate of 0.0001, as well as with the SGD optimizer using a batch size of either 16 or 32 and a learning rate of either 0.001 or 0.0001, produced the lowest error metrics, indicating superior performance. This study enables more precise forecasts of stock prices and more efficient investment techniques.
References
A. Arfan and L. ETP, “Perbandingan Algoritma Long Short-Term Memory dengan SVR Pada Prediksi Harga Saham di Indonesia,” Petir, vol. 13, no. 1, pp. 33–43, 2020, doi: 10.33322/petir.v13i1.858.
Xiaojian, Z. (2022). Stock price prediction based on CNN model for Apple, Google and Amazon. BCP Business & Management, EMFRM, 38. doi : https://doi.org/10.54691/bcpbm.v38i.3696
Gumelar, Farhat, Et Al. Peramalan Harga Saham Bank Bumn Indonesia Menggunakan Long Short-Term Memory (Lstm). E-Journal Biastatistics| Departemen Statistika Fmipa Universitas Padjadjaran, 2022, 2022.1: Stat8-Stat8.
H. Wang, J. Wang, L. Cao, Y. Li, Q. Sun, and J. Wang, “A Stock Closing Price Prediction Model Based on CNN-BiSLSTM,” Complexity, vol. 2021, 2021, doi: 10.1155/2021/5360828.
Janastu, I. Nyoman Cerdas; Wutsqa, Dhoriva Urwatul. Prediksi Harga Saham Pada Sektor Perbankan Menggunakan Algoritma Long Short-Term Memory. Jurnal Statistika Dan Sains Data, 2024, 1.2: 1-14.
Hansun, Seng; Young, Julio Christian. Predicting Lq45 Financial Sector Indices Using Rnn-Lstm. Journal Of Big Data, 2021, 8.1: 104.
Garner, S., Pan, Y., & Shi, M. (2024). Amazon’s Stock Trends Prediction based on ARIMA Model. Highlights in Business, Economics and Management. doi : https://doi.org/10.54097/g3yrh896
A. Delfanti, “Machinic dispossession and augmented despotism: Digital work in an Amazon warehouse,” New Media Soc., vol. 23, no. 1, pp. 39–55, 2021, doi: 10.1177/1461444819891613.
Khalis Sofi, Aswan Supriyadi Sunge, Sasmitoh Rahmad Riady, and Antika Zahrotul Kamalia, “Perbandingan Algoritma Linear Regression, Lstm, Dan Gru Dalam Memprediksi Harga Saham Dengan Model Time Series,” Seminastika, vol. 3, no. 1, pp. 39–46, 2021, doi: 10.47002/seminastika.v3i1.275.
N. T. Luchia, E. Tasia, I. Ramadhani, A. Rahmadeyan, and R. Zahra, “Performance Comparison Between Artificial Neural Network, Recurrent Neural Network and Long Short-Term Memory for Prediction of Extreme Climate Change,” Public Res. J. Eng. Data Technol. Comput. Sci., vol. 1, no. 2, pp. 62–70, 2024, doi: 10.57152/predatecs.v1i2.864.
Smith, N., Varadharajan, V., Kalla, D., Kumar, G. R., & Samaah, F. (2024). Stock Closing Price and Trend Prediction with LSTM-RNN. Journal of Artificial Intelligence and Big Data, 1-13. doi: 10.31586/jaibd.2024.877
Zhou, C. (2023). Long Short-term Memory Applied on Amazon's Stock Prediction. Highlights in Science, Engineering and Technology, 34, 71-76. doi: https://doi.org/10.54097/hset.v34i.5380
Tan, J. (2023). Amazon Stock Price Prediction During COVID-19 Based on the LSTM Model and Linear Regression Model. Advances in Economics, Management and Political Sciences, 46(1), 269–276. https://doi.org/10.54254/2754-1169/46/20230353
Garba, N., Danchadi, N. S., & Abdulmumin, M. K. (2021). Evaluating the Performance of Ordinary Least Square and Polynomial Regression with Respect to Sample Size. International Journal of Science for Global Sustainability: A Publication of Faculty of Science, Federal University Gusau, 7(4),25+.https://link.gale.com/apps/doc/A697862343/AONE?u=anon~bdeb6dc6&sid=googleScholar&xid=cbd74f27
W. Hastomo, A. S. B. Karno, N. Kalbuana, E. Nisfiani, and L. ETP, “Optimasi Deep Learning untuk Prediksi Saham di,” … (Jurnal Edukasi dan …, vol. 7, no. 2, pp. 133–140, 2021, [Online]. Available: https://jurnal.untan.ac.id/index.php/jepin/article/view/47411
Liu, Hui; Long, Zhihao. An Improved Deep Learning Model For Predicting Stock Market Price Time Series. Digital Signal Processing, 2020, 102: 102741.
Wiranda, Laras; Sadikin, Mujiono. Penerapan Long Short Term Memory Pada Data Time Series Untuk Memprediksi Penjualan Produk Pt. Metiska Farma. Jurnal Nasional Pendidikan Teknik Informatika: Janapati, 2019, 8.3: 184-196.
Baiq Nurul Azmi, Arief Hermawan, and Donny Avianto, “Analisis Pengaruh Komposisi Data Training dan Data Testing pada Penggunaan PCA dan Algoritma Decision Tree untuk Klasifikasi Penderita Penyakit Liver,” JTIM J. Teknol. Inf. dan Multimed., vol. 4, no. 4, pp. 281–290, 2023, doi: 10.35746/jtim.v4i4.298.
Koo, Eunho; Kim, Geonwoo. Prediction Of Bitcoin Price Based On Manipulating Distribution Strategy. Applied Soft Computing, 2021, 110: 107738.
A. F. A. Zen, E. S. Pramukantoro, K. Amron, V. Wardhani, and P. A. Kamila, “Prediksi Detak Jantung Berbasis LSTM pada Raspberry Pi untuk Pemantauan Kesehatan Portabel,” J. Teknol. Inf. dan Ilmu Komput., vol. 10, no. 7, pp. 1555–1562, 2023, doi: 10.25126/jtiik.1078015.
Y. Karyadi, “Prediksi Kualitas Udara Dengan Metoda LSTM, Bidirectional LSTM, dan GRU,” JATISI (Jurnal Tek. Inform. dan Sist. Informasi), vol. 9, no. 1, pp. 671–684, 2022, doi: 10.35957/jatisi.v9i1.1588.
Z. Zhao, W. Chen, X. Wu, P. C. Y. Chen, and J. Liu, “LSTM network: A deep learning approach for Short-term traffic forecast,” IET Intell. Transp. Syst., vol. 11, no. 2, pp. 68–75, 2017, doi: 10.1049/iet-its.2016.0208.
K. Karunia, A. E. Putri, M. D. Fachriani, and M. H. Rois, “Evaluation of the Effectiveness of Neural Network Models for Analyzing Customer Review Sentiments on Marketplace,” Public Res. J. Eng. Data Technol. Comput. Sci., vol. 2, no. 1, pp. 52–59, 2024, doi: 10.57152/predatecs.v2i1.1100.
X. Li, C. Wang, X. Huang, and Y. Nie, “A GRU-based Mixture Density Network for Data-Driven Dynamic Stochastic Programming,” pp. 1–11, 2020, [Online]. Available: http://arxiv.org/abs/2006.16845
A. Rahmadeyan and Mustakim, “Long Short-Term Memory and Gated Recurrent Unit for Stock Price Prediction,” Procedia Comput. Sci., vol. 234, pp. 204–212, 2024, doi: 10.1016/j.procs.2024.02.167.
K. E. ArunKumar, D. V. Kalaga, C. M. S. Kumar, M. Kawaji, and T. M. Brenza, “Forecasting of COVID-19 using deep layer Recurrent Neural Networks (RNNs) with Gated Recurrent Units (GRUs) and Long Short-Term Memory (LSTM) cells,” Chaos, Solitons and Fractals, vol. 146, p. 110861, 2021, doi: 10.1016/j.chaos.2021.110861.
A. T. N. Hartono and H. D. Purnomo, “Pengembangan Stochastic Gradient Descent dengan Penambahan Variabel Tetap,” J. JTIK (Jurnal Teknol. Inf. dan Komunikasi), vol. 7, no. 3, pp. 359–367, 2023, doi: 10.35870/jtik.v7i3.840.
Xu, Dongpo, Et Al. Convergence Of The Rmsprop Deep Learning Method With Penalty For Nonconvex Optimization. Neural Networks, 2021, 139: 17-23.
Zou, Fangyu, Et Al. A Sufficient Condition For Convergences Of Adam And Rmsprop. In: Proceedings Of The Ieee/Cvf Conference On Computer Vision And Pattern Recognition. 2019. P. 11127-11135.
N. Garba, N. S. Danchadi, and M. K. Abdulmumin, “Evaluating the Performance of Ordinary Least Square and Polynomial Regression with Respect to Sample Size,” Int. J. Sci. Glob. Sustain., vol. 7, no. 3, p. 6, 2021.
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.
Moghar, A., & Hamiche, M. (2020). Stock market prediction using LSTM recurrent neural network. Procedia computer science, 170, 1168-1173.doi : https://doi.org/10.1016/j.procs.2020.03.049
Downloads
Published
How to Cite
Issue
Section
License
Copyright (c) 2025 Muthia Tshamaroh, Nur Shabrina Nasution, Nurin Nadhirah, Rizka Ayu Alfira, Zeng Xintong

This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
Copyright © by Author; Published by Institut Riset dan Publikasi Indonesia (IRPI)
This Public Research Journal of Engineering, Data Technology and Computer Science is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.