Long Short Term Memory Using Stochastic Gradient Descent and Adam for Stock Prediction

Muhammad Athanabil Andi Fawazdhia, Zani Anjani Rafsanjani HSM

Abstract


The stock market is a place to carry out stock buying and selling transactions, the expected return of course has a profitable difference. Predicting stock prices can be done in various ways, one of which is by using deep learning models. Long Short Term Memory (LSTM) is a method that can be used to predict time series data. This method is a development of the Recurrent Neural Network (RNN), so this method is more complicated and powerful. To conduct training on the LSTM model, optimization is needed to minimize errors. There are lots of optimizations that can be used, but in this research, we use SGD and Adam. Several parameters such as learning rate 0.01, 0.001, 0.0001 and several variations of epochs such as epoch 25, epoch 50, epoch 100, epoch 200, epoch 400, and epoch 1000 were used in this study. The research data used are stock data of BBRI, BBNI, BMRI, and BBTN. This study also tries to predict stock prices on the next day using 5 historical stock price data, the result is that LSTM SGD and LSTM Adam succeeded in predicting the next day

Keywords


Long Short Term Memory; Stochastic Gradient Descent; Adam; Predict; Stocks

Full Text:

PDF

References


[1] Muchlas and T. Sutikno, “Prediksi harga saham berbasis web dengan sistem inferensi fuzi tsukamoto,” 2007.

[2] S. T. Wahyudi, “The ARIMA model for the Indonesia stock price,” Int. J. Econ. Manag., vol. 11, no. SpecialIssue1, pp. 223–236, 2017.

[3] Z. A. R. HSM, “Analisa Laju Perubahan Harga Saham Lq45 Menggunakan Persamaan Diferensial,” J. Ris. Akunt. Politala, vol. 3, no. 2, pp. 60–66, 2020, doi: 10.34128/jra.v3i2.68.

[4] G. L. Shelley, A. Traian, and W. J. Trainor, “Stock market ‘prediction’ models,” Econ. Bull., vol. 40, no. 2, pp. 1548–1556, 2020.

[5] A. Nilsen, “Perbandingan Model RNN , Model LSTM , dan Model GRU dalam Memprediksi Harga Saham-Saham LQ45,” vol. 6, no. 1, pp. 137–147, 2022.

[6] A. Olawoyin and Y. Chen, “Predicting the future with artificial neural network,” Procedia Comput. Sci., vol. 140, pp. 383–392, 2018, doi: 10.1016/j.procs.2018.10.300.

[7] Z. E. Mohamed, “Using the artificial neural networks for prediction and validating solar radiation,” J. Egypt. Math. Soc., vol. 27, no. 1, 2019, doi: 10.1186/s42787-019-0043-8.

[8] M. Abdul Dwiyanto Suyudi, E. C. Djamal, A. Maspupah Jurusan Informatika, and F. Sains dan Informatika Universitas Jenderal Achmad Yani Cimahi, “Prediksi Harga Saham menggunakan Metode Recurrent Neural Network,” Semin. Nas. Apl. Teknol. Inf., pp. 1907–5022, 2019.

[9] W. Wahyu et al., Recurrent neural network-long short term memory. 2021.

[10] S. Hochreiter and J. Schmidhuber, “Long Short-Term Memory,” Neural Comput., vol. 9, no. 8, 1997, doi: 10.1162/neco.1997.9.8.1735.

[11] J. Dawani, Hands-On Mathematics for Deep Learning. Mumbai.

[12] O. Calin, Deep Learning Architectures : A Mathematical Approach. 2020.

[13] J. K. Lubis and I. Kharisudin, “Metode Long Short Term Memory dan Generalized Autoregressive Conditional Heteroscedasticity untuk Pemodelan Data Saham,” Prism. Pros. Semin. Nas, vol. 4, pp. 652–658, 2021,

[14] M. Hardt, B. Recht, and Y. Singer, “Train faster, generalize better: Stability of stochastic gradient descent,” in 33rd International Conference on Machine Learning, ICML 2016, 2016, vol. 3.

[15] D. P. Kingma and J. L. Ba, “Adam: A method for stochastic optimization,” 3rd Int. Conf. Learn. Represent. ICLR 2015 - Conf. Track Proc., pp. 1–15, 2015.

[16] E. Bisong, Training a Neural Network. 2019.

[17] J. Brownlee, “Long Short-Term Memory Networks With Python,” Mach. Learn. Mastery With Python, vol. 1, no. 1, p. 228, 2017.

[18] T. Jayalakshmi and A. Santhakumaran, “Statistical Normalization and Back Propagationfor Classification,” Int. J. Comput. Theory Eng., vol. 3, no. 1, pp. 89–93, 2011, doi: 10.7763/ijcte.2011.v3.288.

[19] A. Karpathy, J. Johnson, and L. Fei-Fei, “Visualizing and Understanding Recurrent Networks,” pp. 1–12, 2015,

[20] K. Greff, R. K. Srivastava, J. Koutn, and B. R. Steunebrink, “LSTM : A Search Space Odyssey,” pp. 1–12, 2016, doi: 10.1109/TNNLS.2016.2582924.

[21] K. Johan, J. C. Young, and S. Hansun, “LSTM-RNN automotive stock price prediction,” Int. J. Sci. Technol. Res., vol. 8, no. 9, pp. 173–176, 2019.

[22] A. Nurjaman, A. H.-P. 2021, “Long Short-Term Memory (LSTM) untuk Prediksi Harga Saham Pfizer Inc,” Prosiding.Statistics.Unpad.Ac.Id, 2021.

[23] Z. C. Lipton, J. Berkowitz, and C. Elkan, “A Critical Review of Recurrent Neural Networks for Sequence Learning,” pp. 1–38, 2015.

[24] C. A. Goodfellow lan, Bengio Yoshua, “Deep Learning - Ian Goodfellow, Yoshua Bengio, Aaron Courville - Google Books,” MIT Press. 2016.

[25] A. Graves, Supervised Sequence Labelling with Recurrent Neural Networks. 2008.

[26] I. Sutskever, “Training Recurrent Neural Networks,” 2013.

[27] M. Hagan, H. Demuth, M. Beale, and O. De Jesus, “Neural Network Design, Boston,” PWS Pub. Co. USA, 1996.

[28] Z. Maohua, X. Yuan, R. Minsoo, C. Jason, and W. K. Stephen, “Training Long Short-Term Memory With Spar-Sified Stochastic Gradient Descent,” Iclr, no. 2, pp. 1–10, 2017.

[29] X. S. Yang, Optimization techniques and applications with examples. 2018.

[30] D. Wallach and B. Goffinet, “Mean squared error of prediction as a criterion for evaluating and comparing system models,” Ecol. Modell., vol. 44, no. 3–4, pp. 299–306, 1989, doi: 10.1016/0304-3800(89)90035-5.




DOI: https://doi.org/10.18860/ca.v8i2.17789

Refbacks

  • There are currently no refbacks.


Copyright (c) 2023 Zani Anjani Rafsanjani HSM, Muhammad Athanabil Andi Fawazdhia, Nursyiva Irsalinda, Yudi Ari Adi

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

Editorial Office
Mathematics Department,
Universitas Islam Negeri Maulana Malik Ibrahim Malang
Gajayana Street 50 Malang, East Java, Indonesia 65144
Faximile (+62) 341 558933
e-mail: cauchy@uin-malang.ac.id

Creative Commons License
CAUCHY: Jurnal Matematika Murni dan Aplikasi is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.