Long Short-Term Memory and Gated Recurrent Unit Modeling for Stock Price Forecasting

Authors

  • Nurul Khairunisa Khairunisa Program Studi Matematika, Universitas Negeri Semarang
  • Putriaji Hendikawati Program Studi Statistika Terapan dan Komputasi, Universitas Negeri Semarang

DOI:

https://doi.org/10.20956/j.v21i1.35930

Keywords:

stocks, LSTM, GRU, RMSE, MAPE

Abstract

The rapid advancement of deep learning technology offers significant benefits, particularly for time series data forecasting. LSTM and GRU are two deep learning methods used for forecasting. This study aims to compare the LSTM and GRU methods in predicting the stock prices of PT Mayora Indah Tbk, listed on the Indonesia Stock Exchange (IDX), accessed through Yahoo Finance. The model architecture was developed using combinations of data splitting, learning rate, epoch count, and neuron count. The combinations used in this study include data splits of 70:30 and 80:20, with varying parameter combinations of learning rates at 0.01, 0.001, and 0.0001, epoch counts of 50, 100, and 150, and neuron counts of 50 and 100. The results indicate that the GRU method outperforms the LSTM method in prediction accuracy. The RMSE and MAPE tests show that the GRU method yields RMSE and MAPE of 34.4233 and 1.27%, respectively, compared to the LSTM method with RMSE and MAPE of 35.3775 and 1.28%. The best GRU architecture was achieved with a learning rate of 0.001, 50 neurons, and 150 epochs, while the best LSTM architecture was achieved with a learning rate of 0.001, 100 neurons, and 150 epochs. The optimal architecture for both methods was found with a data split of 70:30

References

Anishnama, 2018. Understanding Gated Recurrent Unit (GRU) in Deep Learning. Medium Publishing, Amerika. https://medium.com/@anishnama20/understanding-gated-recurrent-unit-gru-in-deep-learning-2e54923f3e2. [4 Mei 2024].

Awaludin, A., & Oktarina, T., 2023. Application of the LSTM Algorithm in Predicting Urea Fertilizer Production at IIB Plant PT. Pupuk Sriwidjaja Palembang. Jurnal Sains Komputer & Informatika, Vol. 7, No. 2, 1015-1024. https://tunasbangsa.ac.id/ejurnal/index.php/jsakti/issue/view/30.

Geron, A. 2017. Hands-On Machine Learning with Scikit-Learn and TensorFlow.

Gers, F. A., Schmidhuber, U. J., & Cummins, F., 2000. Learning to Forget: Continual Prediction with LSTM. Neural Computation, Vol. 12, No. 10, 2451-2471. https://doi.org/10.1162/089976600300015015.

Haq, D. Z., Rini, N. D. C., Hamid, A., Ulinnuha, N., Arnita, Farida, Y., Nugraheni, R. D., Nariswari, R., Ilham, Rohayani, H., Pramulya, R., & Widjayanto, A., 2021. Long Short-Term Memory Algorithm for Rainfall Prediction Based on El-Nino and IOD data. Procedia Computer Science, Vol. 179, 829–837. https://doi.org/10.1016/j.procs.2021.01.071.

Hochreiter, S. & Schmidhuber, U. J., 1997. Long Short-Term Memory. Neural Computation, Vol. 9, No. 8, 1735–1780. https://doi.org/10.1162/neco.1997.9.8.1735.

https://doi.org/10.52166/ujmc.v6i01.1927.

Korstanje, J., 2021. Advanced Forecasting with Python. Apress Media.

Kostadinov, S., 2017. Understanding GRU Networks. Medium Publishing, Amerika. https://towardsdatascience.com/understanding-gru-networks-2ef37df6c9be. [4 Mei 2024] .

Kumar, D. A., Kumar, A., García, D. V., Kumar, S. A., & Kanhaiya, K., 2021. Study and analysis of SARIMA and LSTM in forecasting time series data. Sustainable Energy Technologies and Assessments, 47. https://doi.org/10.1016/j.seta.2021.101474.

Liu, H., & Long, Z., 2020. An improved deep learning model for predicting stock market price time series. Digital Signal Processing: A Review Journal, 102, 102741. https://doi.org/10.1016/j.dsp.2020.102741.

Maliki, M. A., Cholissodin, I., & Yudistira, N., 2022. Prediksi Pergerakan Harga Cryptocurrency Bitcoin terhadap Mata Uang Rupiah menggunakan Algoritme LSTM. Jurnal Pengembangan Teknologi Informasi dan Ilmu Komputer, Vol. 6, No. 7, 3259-3268. https://j-ptiik.ub.ac.id/index.php/j-ptiik/issue/view/70.

Natarajan, S., Kumar, M., Gadde, S. K. K., & Venugopal, V., 2023. Outbreak Prediction of COVID-19 using Recurrent Neural Network with Gated Recurrent Units. Materials Today: Proceedings, 80, 3433–3437. https://doi.org/10.1016/j.matpr.2021.07.266.

Pangestu, P. S., & Wijayanto, A., 2020. Pengaruh Return on Assets (ROA), Return on Equity (ROE), Earning Per Share (EPS), Price Earning Ratio (PER), Dandebt to Equity Ratio (DER) Terhadap Return Saham. Ilmu Administrasi Bisnis, Vol. 9, No. 1, 63–71. https://doi.org/https://doi.org/10.14710/jiab.2020.26220.

Panggabean, S., Sihombing, P. R., Dewi, K. H. S., & Pramartha, I. N. B., Junaidy, J., & Syahruddin, S., 2021. Simulasi Exponential Moving Avarage dan Single Exponential Smoothing: Sebuah Perbandingan Akurasi Metode Peramalan. Jurnal Pemikiran dan Penelitian Pendidikan Matematika, Vol. 4, No. 1, 1–10. https://journal.rekarta.co.id/index.php/jp3m/issue/view/12.

Sofi, K., Sunge, A. S., Riady, S. R., & Kamalia, A. Z., 2021. Perbandingan Algoritma Linear Regression, LSTM, Dan GRU dalam Memprediksi Harga Saham dengan Model Time Series. PROSIDING SEMINASTIKA, Vol. 3, No. 1, 39–46. https://doi.org/10.47002/seminastika.v3i1.275.

Van Houdt, G., Mosquera, C., & Nápoles, G., 2020. A review on the long short-term memory model. Artificial Intelligence Review, Vol. 53, No. 8, 5929–5955. https://doi.org/10.1007/s10462-020-09838-1.

Wayan, N., Aryati, M., Komang, I., Ganda Wiguna, A., Putri, S., Widiartha, K., Luh, N., Sri, W., & Ginantra, R., 2024. Komparasi Metode LSTM dan GRU dalam Memprediksi Harga Saham. Jurnal Media Informatika Budidarma. Vol. 8, No. 2, 1131-1140. https://doi.org/10.30865/mib.v8i2.7342.

Yamak, P. T., Yujian, L., & Gadosey, P. K., 2019. A Comparison between ARIMA, LSTM, and GRU for Time Series Forecasting. In Proceedings of the 2019 2nd International Conference on Algorithms, Computing and Artificial Intelligence (pp. 49-55). https://doi.org/10.1145/3377713.3377722.

Yotenka, R., Fikri, F., & Huda, E., 2020. Implementasi Long Short-Term Memory Pada Harga Saham Perusahaan Perkebunan di Indonesia. Unisda Journal of Mathematics and Computer, Vol. 6, No. 1, 9–18.

Yulisa, N. P., Al Haris, M., & Arum, R. P., 2023. Peramalan Nilai Ekspor Migas di Indonesia dengan Model Long Short-Term Memory (LSTM) dan Gated Recurrent Unit (GRU). J Statistika: Jurnal Ilmiah dan Aplikasi Statistika, Vol. 16, No. 1, 328-341. https://jurnal.unipasby.ac.id/index.php/jstatistika/issue/view/514.

Zhong, Z., Wu, D., & Mai, W., 2023. Stock Prediction Based on ARIMA Model and GRU Model. Academic Journal of Computing & Information Science, Vol. 6, No. 7, 114-123. https://doi.org/10.25236/ajcis.2023.060715.

Downloads

Published

2024-09-15

How to Cite

Khairunisa, N. K., & Hendikawati, P. . (2024). Long Short-Term Memory and Gated Recurrent Unit Modeling for Stock Price Forecasting. Jurnal Matematika, Statistika Dan Komputasi, 21(1), 321–333. https://doi.org/10.20956/j.v21i1.35930

Issue

Section

Research Articles