Perbandingan Akurasi Algoritma Long Short Term Memory dan Transformer Peramalan Harga Saham Volatilitas Tinggi
DOI:
https://doi.org/10.69693/ijmst.v5i1.14725Keywords:
LSTM, Transformer, Harga Saham, Volitalitas TinggiAbstract
Penelitian membandingkan akurasi algoritma Long Short-Term Memory (LSTM) dan Transformer dalam meramalkan harga saham dengan volatilitas tinggi, khususnya saham PT Paragon Karya Perkasa Tbk (PKPK). Data yang digunakan merupakan harga penutupan (close price) saham PKPK dari Yahoo Finance periode 23 September 2021 hingga 30 September 2026 sebanyak 1.024 data. Data melalui tahap normalisasi min-max, kemudian dibagi menjadi data latih dan data uji untuk dilatih menggunakan model LSTM dan Transformer. Evaluasi kinerja model dilakukan menggunakan metrik Root Mean Square Error (RMSE), Mean Absolute Error (MAE), dan Mean Absolute Percentage Error (MAPE). Hasil penelitian menunjukkan bahwa model LSTM terbaik diperoleh dengan konfigurasi 150 hidden layer, dropout 0,01, dan 100 epoch, menghasilkan akurasi 96,99%. Sementara itu, model Transformer terbaik diperoleh dengan self-attention mechanism 10, multi-head attention 100, dan 5 hidden layer, dengan akurasi 95,69%. Pada pengujian peramalan lima hari ke depan, Transformer menghasilkan akurasi 92,84%, sedikit lebih tinggi dibandingkan LSTM yang mencapai 92,79%. Temuan ini menunjukkan bahwa Transformer lebih baik dalam meramalkan harga saham dengan volatilitas tinggi pada periode validasi, meskipun LSTM memiliki akurasi pelatihan yang lebih tinggi. Namun, kedua model mengalami penurunan performa ketika harga saham mencapai all-time high, sehingga diperlukan pengembangan model yang lebih adaptif terhadap perubahan harga ekstrem, seperti penambahan sentimen analisis.
References
1. Y. Xu and J. Zhao, “Can sentiments on macroeconomic news explain stock returns? Evidence from social network data,” Int. J. Finance Econ., vol. 27, no. 2, pp. 2073–2088, 2022.
2. S. Hochreiter and J. Schmidhuber, “Long short-term memory,” Neural Comput., vol. 9, no. 8, pp. 1735–1780, 1997, doi: 10.1162/neco.1997.9.8.1735.
3. H. N. Bhandari, B. Rimal, N. R. Pokhrel, R. Rimal, K. R. Dahal, and R. K. C. Khatri, “Predicting stock market index using LSTM,” Mach. Learn. Appl., vol. 9, Art. no. 100320, 2022, doi: 10.1016/j.mlwa.2022.100320.
4. G. Bathla, R. Rani, and H. Aggarwal, “Stocks of year 2020: Prediction of high variations in stock prices using LSTM,” Multimed. Tools Appl., vol. 82, no. 7, pp. 9727–9743, 2023, doi: 10.1007/s11042-022-12390-5.
5. T. Fischer and C. Krauss, “Deep learning with long short-term memory networks for financial market predictions,” Eur. J. Oper. Res., vol. 270, no. 2, pp. 654–669, 2018, doi: 10.1016/j.ejor.2017.11.054.
6. O. B. Sezer, M. U. Gudelek, and A. M. Ozbayoglu, “Financial time series forecasting with deep learning: A systematic literature review: 2005–2019,” Appl. Soft Comput., vol. 90, Art. no. 106181, 2020, doi: 10.1016/j.asoc.2020.106181.
7. A. M. Ozbayoglu, M. U. Gudelek, and O. B. Sezer, “Deep learning for financial applications: A survey,” Appl. Soft Comput., vol. 93, Art. no. 106384, 2020, doi: 10.1016/j.asoc.2020.106384.
8. W. Jiang, “Applications of deep learning in stock market prediction: Recent progress,” Expert Syst. Appl., vol. 184, Art. no. 115537, 2021, doi: 10.1016/j.eswa.2021.115537.
9. A. Vaswani et al., “Attention is all you need,” in Proc. Adv. Neural Inf. Process. Syst. (NIPS), vol. 30, 2017, pp. 5998–6008.
10. B. Lim and S. Zohren, “Time-series forecasting with deep learning: A survey,” Philos. Trans. R. Soc. A, vol. 379, no. 2194, Art. no. 20200209, 2021, doi: 10.1098/rsta.2020.0209.
11. Q. Wen et al., “Transformers in time series: A survey,” in Proc. 32nd Int. Joint Conf. Artif. Intell. (IJCAI), 2023, pp. 6778–6786, doi: 10.24963/ijcai.2023/759.
12. H. Zhou et al., “Informer: Beyond efficient transformer for long sequence time-series forecasting,” in Proc. AAAI Conf. Artif. Intell., 2021, vol. 35, no. 12, pp. 11106–11115, doi: 10.1609/aaai.v35i12.17325.
13. H. Wu, J. Xu, J. Wang, and M. Long, “Autoformer: Decomposition transformers with auto-correlation for long-term series forecasting,” in Proc. Adv. Neural Inf. Process. Syst. (NeurIPS), vol. 34, 2021, pp. 22419–22430.
14. B. Lim, S. Ö. Arık, N. Loeff, and T. Pfister, “Temporal Fusion Transformers for interpretable multi-horizon time series forecasting,” Int. J. Forecast., vol. 37, no. 4, pp. 1748–1764, 2021, doi: 10.1016/j.ijforecast.2021.03.012.
15. Y. Nie, N. H. Nguyen, P. Sinthong, and J. Kalagnanam, “A time series is worth 64 words: Long-term forecasting with Transformers,” in Proc. Int. Conf. Learn. Represent. (ICLR), 2023.
16. A. Zeng, M. Chen, L. Zhang, and Q. Xu, “Are Transformers effective for time series forecasting?,” in Proc. AAAI Conf. Artif. Intell., 2023, vol. 37, no. 9, pp. 11121–11128, doi: 10.1609/aaai.v37i9.26317.
17. Q. Zhang, C. Qin, Y. Zhang, F. Bao, C. Zhang, and P. Liu, “Transformer-based attention network for stock movement prediction,” Expert Syst. Appl., vol. 202, Art. no. 117239, 2022, doi: 10.1016/j.eswa.2022.117239.
18. Q. Ding, S. Wu, H. Sun, J. Guo, and J. Guo, “Hierarchical multi-scale Gaussian Transformer for stock movement prediction,” in Proc. 29th Int. Joint Conf. Artif. Intell. (IJCAI), 2020, pp. 4640–4646, doi: 10.24963/ijcai.2020/640.
19. H. Y. Kim and C. H. Won, “Forecasting the volatility of stock price index: A hybrid model integrating LSTM with multiple GARCH-type models,” Expert Syst. Appl., vol. 103, pp. 25–37, 2018, doi: 10.1016/j.eswa.2018.03.002.
20. S.-H. Poon and C. W. J. Granger, “Forecasting volatility in financial markets: A review,” J. Econ. Lit., vol. 41, no. 2, pp. 478–539, 2003.
21. TradingView, “Most volatile Indonesian stocks,” TradingView. Accessed: Oct. 1, 2026. [Online]. Available: https://id.tradingview.com/markets/stocks-indonesia/market-movers-most-volatile/
22. Yahoo Finance, “PT Paragon Karya Perkasa Tbk (PKPK.JK) stock price, news, quote & history,” Yahoo Finance. Accessed: Oct. 1, 2026. [Online]. Available: https://finance.yahoo.com/quote/PKPK.JK/
23. A. Pranolo et al., “Enhanced multivariate time series analysis using LSTM: A comparative study of min-max and z-score normalization techniques,” ILKOM J. Ilm., vol. 16, no. 2, pp. 210–220, 2024, doi: 10.33096/ilkom.v16i2.2333.210-220.
24. D. Singh and B. Singh, “Investigating the impact of data normalization on classification performance,” Appl. Soft Comput., vol. 97, Art. no. 105524, 2020, doi: 10.1016/j.asoc.2019.105524.
25. H. Hewamalage, C. Bergmeir, and K. Bandara, “Recurrent neural networks for time series forecasting: Current status and future directions,” Int. J. Forecast., vol. 37, no. 1, pp. 388–427, 2021, doi: 10.1016/j.ijforecast.2020.06.008.
26. K. Greff, R. K. Srivastava, J. Koutník, B. R. Steunebrink, and J. Schmidhuber, “LSTM: A search space odyssey,” IEEE Trans. Neural Netw. Learn. Syst., vol. 28, no. 10, pp. 2222–2232, 2017, doi: 10.1109/TNNLS.2016.2582924.
27. Y. Bengio, P. Simard, and P. Frasconi, “Learning long-term dependencies with gradient descent is difficult,” IEEE Trans. Neural Netw., vol. 5, no. 2, pp. 157–166, 1994, doi: 10.1109/72.279181.
28. A. Rahman, S. Wahjuni, and K. Priandana, “The development of hydroponic nutrient solutions control using fuzzy and BPNN for celery plant,” Int. J. Adv. Sci. Eng. Inf. Technol., vol. 12, pp. 431–436, 2022.
29. T. O. Hodson, “Root mean square error (RMSE) or mean absolute error (MAE): When to use them or not,” Geosci. Model Dev., vol. 15, no. 14, pp. 5481–5487, 2022, doi: 10.5194/gmd-15-5481-2022.
30. N. Jing, Z. Wu, and H. Wang, “A hybrid model integrating deep learning with investor sentiment analysis for stock price prediction,” Expert Syst. Appl., vol. 178, Art. no. 115019, 2021, doi: 10.1016/j.eswa.2021.115019.
Downloads
Published
How to Cite
Issue
Section
License
Copyright (c) 2026 Indonesian Journal of Multidisciplinary on Social and Technology

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














