ANALISIS PERBANDINGAN ALGORITMA LOGISTIC REGRESSION, RANDOM FOREST, XGBOOST, DAN LSTM DALAM PREDIKSI SAHAM APPLE DENGAN BACKTESTING DATA HISTORIS

Fachrizal Irfansyah El Zacky, Yusuf Sulistyo Nugroho

Abstract


Harga saham teknologi memiliki volatilitas yang tinggi sehingga diperlukan pendekatan analitis yang mampu menghasilkan prediksi akurat untuk mendukung pengambilan keputusan investasi. Penelitian ini bertujuan membandingkan kinerja empat algoritma, yaitu Logistic Regression, Random Forest, XGBoost, dan Long Short-Term Memory (LSTM) dalam memprediksi arah pergerakan saham teknologi. Data penelitian berupa harga saham Apple Inc. selama lima tahun, diperkaya indikator teknikal dan variabel makroekonomi. Keempat model dilatih untuk klasifikasi biner (naik/turun) dan dievaluasi menggunakan Accuracy, Precision, Recall, dan F1-Score. Hasil menunjukkan bahwa LSTM memberikan performa terbaik dengan Accuracy 77,42% dan F1-Score 0,811 karena mampu memanfaatkan dependensi temporal. Logistic Regression menghasilkan recall tinggi namun bias terhadap kelas dominan, sedangkan Random Forest dan XGBoost memberikan akurasi moderat dengan keterbatasan dalam menangkap dinamika deret waktu. Seluruh model diimplementasikan dalam aplikasi web berbasis Streamlit untuk mendukung analisis interaktif dan visualisasi proyeksi. Penelitian ini menyimpulkan bahwa pendekatan deep learning, khususnya LSTM, lebih sesuai untuk data saham yang volatil, serta menegaskan pentingnya pemilihan algoritma yang selaras dengan karakteristik data dan penerapan backtesting untuk memastikan keandalan prediksi pada kondisi pasar nyata.

Keywords


Predikasi Saham; Machine Learning; Saham Teknologi; Klasifikasi; Backtesting

Full Text:

PDF

References


T. C. Rawat, “The Effect of AI Development on Stock Prices,” Int. J. Soc. Sci. Econ. Res., vol. 09, no. 10, pp. 4532–4561, 2024, doi: 10.46609/ijsser.2024.v09i10.036.

M. Maryam, D. A. Anggoro, M. F. Tika, and F. C. Kusumawati, “An Intelligent Hybrid Model Using Artificial Neural Networks and Particle Swarm Optimization Technique For Financial Crisis Prediction,” Pakistan J. Stat. Oper. Res., vol. 18, no. 4, pp. 1015–1025, 2022, doi: 10.18187/pjsor.v18i4.3927.

H. Htun, M. Biehl, and N. Petkov, “Survey of Feature Selection and Extraction Techniques for Stock Market Prediction,” Financ. Innov., vol. 9, no. 1, p. 26, 2023, doi: 10.1186/s40854-022-00441-7.

M. Li, Y. Zhu, Y. Shen, and M. Angelova, “Clustering-Enhanced Stock Price Prediction Using Deep Learning,” World Wide Web, vol. 26, no. 1, pp. 207–232, 2023, doi: 10.1007/s11280-021-01003-0.

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, 2022, doi: 10.1007/s11042-022-12390-5.

Z. Li, H. Yu, J. Xu, J. Liu, and Y. Mo, “Stock Market Analysis and Prediction Using LSTM: A Case Study on Technology Stocks,” Innov. Appl. Eng. Technol., vol. 2, no. 1, pp. 1–6, 2023, doi: 10.62836/iaet.v2i1.162.

K. Ansah, I. W. Denwar, and J. K. Appati, “Intelligent Models for Stock Price Prediction: A Comprehensive Review,” J. Inf. Technol. Res., vol. 15, no. 1, pp. 1–17, 2022, doi: 10.4018/jitr.298616.

Y. Gong, “The Progress and State-of-Art Applications of Machine Learning for Stock Price Prediction,” BCP Bus. Manag., vol. 23, pp. 537–542, 2022, doi: 10.54691/bcpbm.v23i.1396.

H. Arian, D. N. Mobarekeh, and L. Seco, “Backtest Overfitting in the Machine Learning Era: A Comparison of Out-of-Sample Testing Methods in a Synthetic Controlled Environment,” Knowledge-Based Syst., vol. 305, p. 112477, 2024, doi: 10.1016/j.knosys.2024.112477.

K. Olorunnimbe and H. Viktor, “Deep Learning in the Stock Market—A Systematic Survey of Practice, Backtesting, and Applications,” Artif. Intell. Rev., vol. 56, no. 3, pp. 2057–2109, 2023, doi: 10.1007/s10462-022-10226-0.

S. Karimpouli, G. Kwiatek, Y. Ben‐Zion, P. Martínez‐Garzón, G. Dresen, and M. Bohnhoff, “Empowering Machine Learning Forecasting of Labquake Using Event‐Based Features and Clustering Characteristics,” J. Geophys. Res. Mach. Learn. Comput., vol. 1, no. 2, p. e2024JH000160, 2024, doi: 10.1029/2024jh000160.

S. Ye, “Applying Ensemble Learning to Multiple Stock Price Predictions: A Comparative Study,” Appl. Comput. Eng., vol. 50, no. 1, pp. 189–198, 2024, doi: 10.54254/2755-2721/50/20241501.

J. Zhou, “Predicting Stock Price by Using Attention-Based Hybrid LSTM Model,” Asian J. Basic Sci. Res., vol. 06, no. 02, pp. 145–158, 2024, doi: 10.38177/ajbsr.2024.6211.

C. Zhao, X. Liu, J. Zhou, Y. Cen, and X. Yao, “GCN-Based Stock Relations Analysis for Stock Market Prediction,” Peerj Comput. Sci., vol. 8, p. e1057, 2022, doi: 10.7717/peerj-cs.1057.

Y. Yang, X. Hu, and H. Jiang, “Group Penalized Logistic Regressions Predict Up and Down Trends for Stock Prices,” North Am. J. Econ. Financ., vol. 59, p. 101564, 2022, doi: 10.1016/j.najef.2021.101564.

Y. Zhang and Y. Wang, “A Study of a Prediction Framework Incorporating Random Forests and Gradient Boosting Trees,” Acad. J. Sci. Technol., vol. 15, no. 3, pp. 86–91, 2025, doi: 10.54097/cj7d6a34.

D. Boldini, F. Grisoni, D. Kuhn, L. Friedrich, and S. A. Sieber, “Practical Guidelines for the Use of Gradient Boosting for Molecular Property Prediction,” J. Cheminform., vol. 15, no. 1, p. 73, 2023, doi: 10.1186/s13321-023-00743-7.

Y. Zhong, Y. Ren, G. Cao, F. Li, and H. Qi, “Optimal Starting Point for Time Series Forecasting,” Expert Syst. Appl., vol. 273, p. 126798, 2025, doi: 10.1016/j.eswa.2025.126798.

B. Lindemann, T. Müller, H. Vietz, N. Jazdi, and M. Weyrich, “A Survey on Long Short-Term Memory Networks for Time Series Prediction,” Procedia CIRP, vol. 99, pp. 650–655, 2021, doi: 10.1016/j.procir.2021.03.088.

M. Krichen and A. Mihoub, “Long Short-Term Memory Networks: A Comprehensive Survey,” AI, vol. 6, no. 9, pp. 1–21, 2025, doi: 10.3390/ai6090215.

Y. Dang, Z. Chen, H. Li, and H. Shu, “A Comparative Study of Non-Deep Learning, Deep Learning, and Ensemble Learning Methods for Sunspot Number Prediction,” Appl. Artif. Intell., vol. 36, no. 1, p. 2074129, 2022, doi: 10.1080/08839514.2022.2074129.

F. H. Quradaa, S. Shahzad, and R. S. Almoqbily, “A Systematic Literature Review on the Applications of Recurrent Neural Networks in Code Clone Research,” PLoS One, vol. 19, pp. 1–40, 2024, doi: 10.1371/journal.pone.0296858.

W. Buczynski, F. Cuzzolin, and B. Sahakian, “A Review of Machine Learning Experiments in Equity Investment Decision‑Making: Why Most Published Research Findings Do Not Live Up to Their Promise in Real Life,” Int. J. Data Sci. Anal., vol. 11, no. 3, pp. 221–242, 2021, doi: 10.1007/s41060-021-00245-5.

H. T. Nugroho, “BAB II Landasan Teori,” Tangerang, 2024. [Online]. Available: https://kc.umn.ac.id/id/eprint/40224/3/BAB_II.pdf

A. Pagliaro, “Forecasting Significant Stock Market Price Changes Using Machine Learning: Extra Trees Classifier Leads,” Electron., vol. 12, no. 21, pp. 1–23, 2023, doi: 10.3390/electronics12214551.

N. Mohseny-Tonekabony, S. J. Sadjadi, E. Mohammadi, M. Tamiz, and D. F. Jones, “Robust, Extended Goal Programming with Uncertainty Sets: An Application to a Multi-Objective Portfolio Selection Problem Leveraging DEA,” Ann. Oper. Res., vol. 346, no. 2, pp. 1497–1552, 2025, doi: 10.1007/s10479-023-05811-7.

S. Y. M. Ze-To, “Fundamental Index Aligned and Excess Market Return Predictability,” J. Forecast., vol. 41, no. 3, pp. 592–614, 2022, doi: 10.1002/for.2829.

J. Guo, “Predict Stock Price Trend by Using Classification Model,” Adv. Econ. Manag. Polit. Sci., vol. 45, no. 1, pp. 70–78, 2023, doi: 10.54254/2754-1169/45/20230260.

H. A. Salman, A. Kalakech, and A. Steiti, “Random Forest Algorithm Overview,” Babylonian J. Mach. Learn., vol. 2024, pp. 69–79, 2024, doi: 10.58496/bjml/2024/007.

M. M. Zühlke and D. Kudenko, “TCR: Topologically Consistent Reweighting for XGBoost in Regression Tasks,” Mach. Learn., vol. 114, no. 4, pp. 1–52, 2025, doi: 10.1007/s10994-024-06704-x.

R. Shwartz-Ziv and A. Armon, “Tabular Data: Deep Learning Is Not All You Need,” Inf. Fusion, vol. 81, pp. 84–90, 2022, doi: 10.1016/j.inffus.2021.11.011.

H. Imaduddin, L. A. Kusumaningtias, and F. Y. A’la, “Application of LSTM and GloVe Word Embedding for Hate Speech Detection in Indonesian Twitter Data,” Int. Inf. Eng. Technol. Assoc., vol. 28, no. 4, pp. 1107–1112, 2023, doi: 10.18280/isi.280430.

J. Lai, “Predicting the Stock Prices of Listed Companies Basesd on the LSTM Model of Recurrent Neural Network,” Financ. Econ., vol. 1, no. 2, pp. 1–5, 2025, doi: 10.61173/av49xn45.

H. Lu, “Frontiers in Computing and Intelligent Systems LSTM-Based Stock Price Prediction,” Front. Comput. Sci., vol. 4, no. 2, pp. 68–71, 2023, doi: 10.54097/fcis.v4i2.10208.

Maryam, A. Fagiat, and A. Ardiansyah, “The Comparative Analysis of Hybrid Genetic Algorithm Feature Selection Method and Particle Swarm Optimization on the High Dimensional Data,” Int. J. Eng. Res. Technol., vol. 13, no. 12, pp. 4394–4401, 2020.

H. A. Khoirunissa and Y. S. Nugroho, “Exploring Algorithmic Approaches for Academic Classification in Application: UMS Study Case,” Int. Conf. Educ. All, vol. 2, no. 1, pp. 180–193, 2024.

H. Halul and K. H. Kamil, “Malaysian Daily Stock Prediction Analysis Using Supervised Learning Algorithms,” Malaysian J. Sci. Heal. Technol., vol. 8, no. 2, pp. 31–37, 2022, doi: 10.33102/2022229.

Z. S. Priyambudi and Y. S. Nugroho, “Which Algorithm Is Better ? An Implementation of Normalization to Predict Student Performance,” AIP Conf. Proc., vol. 2926, no. 1, p. 020110, 2024, doi: 10.1063/5.0182879.

M. Gong, “A Novel Performance Measure for Machine Learning Classification,” Int. J. Manag. Inf. Technol., vol. 13, no. 1, pp. 11–19, 2021, doi: 10.5121/ijmit.2021.13101.

A. Rahman, S. Islam, Y. S. Nugroho, F. Y. Al Irsyadi, and J. Hossain, “An Exploratory Analysis of Feature Selection for Malware Detection with Simple Machine Learning Algorithms,” J. Commun. Softw. Syst., vol. 19, no. 3, pp. 207–219, 2023, doi: 10.24138/jcomss-2023-0091.




DOI: https://doi.org/10.29100/jipi.v11i3.9936

Refbacks

  • There are currently no refbacks.


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

JIPI (Jurnal Ilmiah Penelitian dan Pembelajaran Informatika)
ISSN 2540-8984
Published by
Prodi Pendidikan Teknologi Informasi
Universitas Bhinneka PGRI

Website :https://jurnal.stkippgritulungagung.ac.id/index.php/jipi/index
Email: jipistkippti@gmail.com


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