Comparing Random Forest and SHAP Feature Selection for LSTM-Based Stock Price Prediction

Authors

  • Fatimatuz Zahra Universitas Teknologi Yogyakarta Author
  • Umar Zaky Universitas Teknologi Yogyakarta Author

DOI:

https://doi.org/10.69533/informatech.volume3number2.657

Keywords:

Feature Selection, LSTM, Random Forest, SHAP, Stock Price Prediction

Abstract

Feature selection is often used in stock price prediction, but its results remain mixed. This study analyzes the effect of feature selection based on Random Forest native feature importance (RF Importance) and SHAP on LSTM performance in predicting ADRO, ASII, and TLKM stock prices. Daily data from May 2021 to May 2026 were processed into 20 relative features from price, volume, technical indicators, and the Jakarta Composite Index (JCI), with return as the target. Both methods used the same Random Forest model and a mean-score threshold, while the LSTM was evaluated with five seeds and compared with a naive model. Feature selection reduced the input from 20 to 9 - 12 features (40% to 55%) and the LSTM parameters from 125,761 to 120,129 - 121,665 (3.3% to 4.5%). The MAPE of all schemes ranged from 1.76% to 1.90%, close to the naive model (1.72% to 1.87%), with differences between schemes of no more than 0.07 percentage points. Only for ADRO did the all-features scheme perform clearly better. Both methods retained the volume and JCI features and removed redundant trend indicators, with SHAP selecting fewer features. Therefore, the main benefit of feature selection was a simpler model input, not better prediction accuracy.

Downloads

Download data is not yet available.

References

I. Navila, N. Q. Nada, and R. Renaldy, “Banking Stock Price Prediction Dashboard Using Long Short-Term Memory,” J. Tek. Inform. Jutif, vol. 7, no. 2, pp. 2008–2022, Apr. 2026, doi: 10.52436/1.jutif.2026.7.2.5802.

D. R. Sanjaya, B. Surarso, and Tarno, “Modification of the LSTM Model in Time Series Data Prediction,” Lontar Komput. J. Ilm. Teknol. Inf., vol. 16, no. 1, pp. 14–26, Oct. 2025, doi: 10.24843/LKJITI.2025.v16.i01.p02.

A. T. Haryono, R. Sarno, and K. R. Sungkono, “Stock Price Forecasting in Indonesia Stock Exchange Using Deep Learning: A Comparative Study,” Int. J. Electr. Comput. Eng. IJECE, vol. 14, no. 1, pp. 861–869, Feb. 2024, doi: 10.11591/ijece.v14i1.pp861-869.

A. F. Risnandar, F. Supriadi, and D. I. Junaedi, “Prediksi Harga Saham Indofood Menggunakan Long Short-Term Memory,” JATI J. Mhs. Tek. Inform., vol. 9, no. 3, pp. 4694–4701, May 2025, doi: 10.36040/jati.v9i3.13321.

R. M. Dhokane and S. Agarwal, “LSTM Deep Learning Based Stock Price Prediction with Bollinger Band, RSI, MACD, and OHLC Features,” Int. J. Intell. Syst. Appl. Eng., vol. 12, no. 3, pp. 1169–1176, Mar. 2024.

M. I. Saputra, E. Nurmawati, and R. Abyasa, “Predicting Stock Price Movements with Technical, Fundamental, and Sentiment Analysis Using the LSTM Model,” J. Inform., vol. 12, no. 1, pp. 1–9, Mar. 2025, doi: 10.31294/inf.v12i1.22299.

Y. C. Tjen and H. F. Zuhri, “Impact of Volatility and Feature Engineering on the Forecasting Performance of LSTM and XGBoost Models: Evidence from Indonesian Banking Stocks,” Ingénierie Systèmes Inf., vol. 31, no. 5, pp. 1389–1402, May 2026, doi: 10.18280/isi.310502.

J. Lee and L. Cai, “Comparing Model-Specific and Model-Agnostic Features Importance Methods Using Machine Learning with Technical Indicators: A NASDAQ Sector-Based Study,” Mach. Learn. Appl., vol. 23, p. 100799, Mar. 2026, doi: 10.1016/j.mlwa.2025.100799.

H. Wang, Q. Liang, J. T. Hancock, and T. M. Khoshgoftaar, “Feature Selection Strategies: A Comparative Analysis of SHAP-Value and Importance-Based Methods,” J. Big Data, vol. 11, no. 1, p. 44, Mar. 2024, doi: 10.1186/s40537-024-00905-w.

S. Azman, D. Pathmanathan, and V. Balakrishnan, “A Two-Stage Forecasting Model Using Random Forest Subset-Based Feature Selection and BiGRU with Attention Mechanism: Application to Stock Indices,” PLOS One, vol. 20, no. 5, p. e0323015, May 2025, doi: 10.1371/journal.pone.0323015.

H. Pabuccu and A. Barbu, “Feature Selection with Annealing for Forecasting Financial Time Series,” Financ. Innov., vol. 10, no. 1, p. 87, Oct. 2024, doi: 10.1186/s40854-024-00617-3.

J. Wijaya and M. R. Pribadi, “Prediksi Harga Saham Sektor Perbankan LQ45 Menggunakan BiLSTM Dengan Perbandingan Metode Feature Selection,” JATI J. Mhs. Tek. Inform., vol. 10, no. 1, pp. 413–419, Jan. 2026, doi: 10.36040/jati.v10i1.16769.

R. Dunne et al., “Thresholding Gini variable importance with a single-trained random forest: An empirical Bayes approach,” Comput. Struct. Biotechnol. J., vol. 21, pp. 4354–4360, Jan. 2023, doi: 10.1016/j.csbj.2023.08.033.

H. A. Bukhori, S. Bukhori, S. Anam, F. I. Yusuf, and M. Sari, “GWO-Enhanced Hybrid Deep Learning with SHAP for Explainable TLKM.JK Stock Forecasting,” J. Tek. Inform. Jutif, vol. 6, no. 4, pp. 2566–2585, Sep. 2025, doi: 10.52436/1.jutif.2025.6.4.5205.

H. 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, Jan. 2023, doi: 10.1186/s40854-022-00441-7.

J. T. Hancock, T. M. Khoshgoftaar, and Q. Liang, “A problem-agnostic approach to feature selection and analysis using SHAP,” J. Big Data, vol. 12, no. 1, p. 12, Jan. 2025, doi: 10.1186/s40537-024-01041-1.

Z. Guo, “Research on the Augmented Dickey-Fuller Test for Predicting Stock Prices and Returns,” Adv. Econ. Manag. Polit. Sci., vol. 44, no. 1, pp. 101–106, Nov. 2023, doi: 10.54254/2754-1169/44/20232198.

E. G. A. Osman and F. A. Otaibi, “Integrating Deep Learning and Econometrics for Stock Price Prediction: A Comprehensive Comparison of LSTM, Transformers, and Traditional Time Series Models,” Mach. Learn. Appl., vol. 22, p. 100730, Dec. 2025, doi: 10.1016/j.mlwa.2025.100730.

N. A. Burhani, D. Saepudin, and D. Adytia, “Prediksi Return Saham Berdasarkan Data Histori Dan Data Fundamental Menggunakan LSTM,” Log. J. Penelit. Inform., vol. 3, no. 1, Sep. 2025, doi: 10.25124/logic.v3i1.9236.

N. Beck, J. Dovern, and S. Vogl, “Mind the naive forecast! a rigorous evaluation of forecasting models for time series with low predictability,” Appl. Intell., vol. 55, no. 6, p. 395, Apr. 2025, doi: 10.1007/s10489-025-06268-w.

A. Rosyd, A. I. Purnamasari, and I. Ali, “Penerapan Metode Long Short Term Memory (LSTM) Dalam Memprediksi Harga Saham PT Bank Central Asia,” JATI J. Mhs. Tek. Inform., vol. 8, no. 1, pp. 501–506, Feb. 2024, doi: 10.36040/jati.v8i1.8440.

M. S. Zakka and E. Emigawaty, “Stock Price Prediction Using Deep Learning (LSTM) with a Recursive Approach,” J. Appl. Inform. Comput., vol. 9, no. 5, pp. 2468–2477, 2025, doi: 10.30871/jaic.v9i5.10514.

F. H. D. Aryanto, R. H. P. Sejati, and F. I. Sanjaya, “Pengembangan Sistem Prediksi Saham Menggunakan Model Hybrid Gated Recurrent Unit–Long Short-Term Memory Berbasis Integrasi Indikator Teknikal Konvensional,” Terap. Inform. Nusant., vol. 6, no. 8, pp. 1296–1307, 2026, doi: 10.47065/tin.v6i8.8988.

E. J. Prasetyo and K. D. Hartomo, “Multi-Industry Stock Forecasting Using GRU-LSTM Deep Transfer Learning Method,” J. INFOTEL, vol. 15, no. 2, pp. 30–43, May 2023, doi: 10.20895/infotel.v15i2.941.

E. A. H. Talib and A. F. Watratan, “Comparative Analysis of the Application of Feature Selection in Random Forest Regression for Stock Price Prediction,” Nusant. Hasana J., vol. 5, no. 3, pp. 334–348, Aug. 2025.

Downloads

Published

2026-12-01

How to Cite

Comparing Random Forest and SHAP Feature Selection for LSTM-Based Stock Price Prediction. (2026). Jurnal Ilmiah Informatika Dan Komputer, 3(2), 166-176. https://doi.org/10.69533/informatech.volume3number2.657