Prediction of Tehran Stock Exchange Total Index Using Natural Gradient Boosting and SHAP Values

Document Type : Original Article

Authors

Department of Finance and Banking, University of Allameh Tabataba’i ,Tehran, Iran

Abstract

Purpose: The stock market represents one of the most pivotal components of developing economies. Consequently, extensive research employing both technical and fundamental analyses has sought to predict financial time series in order to assist investors with their trading decisions. In this regard, machine learning models have emerged as effective tools for addressing a variety of challenges. Nevertheless, despite the notable performance of machine learning models in this area, two significant criticisms persist. The first concerns the lack of interpretability of the results; in such models, the process by which inputs are transformed into outputs, as well as the contribution of each input to the model’s output, is not clearly defined. The second issue pertains to the reliability of the predictions generated by these models, as this reliability cannot be directly inferred from the model itself. Accordingly, this study utilizes the latest methods developed in the field of machine learning to address these two issues.



Methods: Considering that the selection of input features plays a crucial role in shaping the output of these models, this study employs a systematic approach to extract features used in related research over the past five years through a systematic review using the Scopus scientific database. Ultimately, 34 features with daily available data were selected as inputs for the model. In the next step, the Natural Gradient Boosting model was utilized to predict the data of the Tehran Stock Exchange Total Index from March 2010 to January 2025. The performance of this model was evaluated using the RMSE, MAE, and MAPE metrics and compared with the latest machine learning methods for time series prediction. Subsequently, SHAP values were employed to interpret the results of the Natural Gradient Boosting model. This approach allowed for the assessment of the contribution of each feature to the estimation of the model’s output. SHAP values provide a powerful tool for evaluating the impact of each input feature on the output estimation, offering valuable insights to users of machine learning models.



Findings: A comparison of the error values of the proposed model with those of other machine learning models indicates superior predictive performance for the proposed approach. Unlike conventional machine learning models, which provide a single prediction as the best estimate, the proposed model outputs a probability distribution that can be described by its parameters. In this study, the assumed parametric form of the distribution is the normal distribution, which is characterized by its mean and standard deviation. In fact, the predicted value corresponds to the mean of the estimated distribution. For forecasting the Tehran Stock Exchange index, the most influential features are the closing price, the EMA indicator, and the SMA indicator. Interpretation of the predicted standard deviation parameter reveals that the ATR indicator, closing price, and TEMA indicator have the greatest impact on this parameter. As the relative values of these variables increase, the standard deviation of the estimated distribution also increases, indicating that the corresponding prediction is less reliable.



Conclusion: The findings of this study demonstrate that the Natural Gradient Boosting model can serve as an effective tool for predicting the Tehran Stock Exchange Total Index. The interpretation of results using SHAP values enables the identification of the most important input features and the manner in which the output is formed from these features, thereby aiding in model optimization. This approach not only enhances prediction accuracy but also assists market participants and policymakers in making more informed decisions regarding risk management and resource allocation. Ultimately, comparisons with other models indicate that this method can be employed as a practical and reliable solution for financial market analysis.

Keywords


  1. Afsharirad, E., Alavi, S. E., & Sinaei, H. (2018). Developing an Intelligent Model to Predict Stock Trend Using the Technical Analysis. Financial Research Journal, 20(2), 249-264.
  2. Amari, S.-I. (1998). Natural gradient works efficiently in learning. Neural computation, 10(2), 251-276.
  3. Çelik, T. B., İcan, Ö., & Bulut, E. (2023). Extending machine learning prediction capabilities by explainable AI in financial time series prediction. Applied Soft Computing, 109876,
  4. Chen, T., & Guestrin, C. (2016). Xgboost: A scalable tree boosting system. Proceedings of the 22nd acm sigkdd international conference on knowledge discovery and data mining,
  5. Chipman, H. A., George, E. I., & McCulloch, R. E. (2010). BART: Bayesian additive regression trees.
  6. Dawid, A. P., & Musio, M. (2014). Theory and applications of proper scoring rules. Metron, 72(2), 169-183.
  7. Enke, D., & Thawornwong, S. (2005). The use of data mining and neural networks for forecasting stock market returns. Expert Systems with applications, 29(4), 927-940.
  8. Gandhmal, D., & Kumar, K. (2019). Systematic analysis and review of stock market prediction techniques. Comput Sci Rev 34: 100190. In.
  9. Gneiting, T., & Raftery, A. E. (2007). Strictly proper scoring rules, prediction, and estimation. Journal of the American statistical Association, 102(477), 359-378.
  10. Haj Seyed Javady, S. M. R., heydari, r., & Abbasi, F. (2023). Forecasting the future price of pistachio in agricultural commodity exchange using of the hybrid model of Wavelet-XGBoost. Agricultural Economics, 17(1), 79-108.
  11. Heidari, M., & Amiri, H. (2022). Inspecting the Predictive Power of Artificial Intelligence Models in Predicting the Stock Price Trend in Tehran Stock Exchange. Financial Research Journal, 24(4), 602-623.
  12. Htun, H. H., Biehl, M., & Petkov, N. (2023). Survey of feature selection and extraction techniques for stock market prediction. Financial Innovation, 9(1), 26.
  13. Jabeur, S. B., Mefteh-Wali, S., & Viviani, J.-L. (2024). Forecasting gold price with the XGBoost algorithm and SHAP interaction values. Annals of Operations Research, 334(1), 679-699.
  14. Kianizadeh, H., Baghani, A., & hamidian, m. (2023). Comparing the accuracy of selected Machin learning models for stock price prediction in stock exchange market. Journal of Securities Exchange, 16(62), 75-102.
  15. Kou, G., Xu, Y., Peng, Y., Shen, F., Chen, Y., Chang, K., & Kou, S. (2021). Bankruptcy prediction for SMEs using transactional data and two-stage multiobjective feature selection. Decision Support Systems, 140, 113429.
  16. Kumar, P., Hota, L., Tikkiwal, V. A., & Kumar, A. (2024). Analysing Forecasting of Stock Prices: An Explainable AI Approach. Procedia Computer Science, 235, 2009-2016.
  17. Lundberg, S. M., & Lee, S.-I. (2017). A unified approach to interpreting model predictions. Advances in neural information processing systems, 30.
  18. Mohebbi, S., Fadaeinejad, M. E., & Hamidizadeh, M. r. (2021). The Proposed Algorithm to Select Appropriate Features for Predicting Tehran Stock Exchange Index. Financial Management Perspective, 11(34), 35-67.
  19. Mohebi, S., Fadaeinejad, M. E., Osoolian, M., & Hamidizadeh, M. R. (2022). Feature Selection for the Prediction Model of the Tehran Stock Exchange Index by Dimensionality Reduction Techniques. Financial Research Journal, 24(4), 577-601.
  20. Nti, I. K., Adekoya, A. F., & Weyori, B. A. (2020). A systematic review of fundamental and technical analysis of stock market predictions. Artificial Intelligence Review, 53(4), 3007-3057.
  21. Park, H. J., Kim, Y., & Kim, H. Y. (2022). Stock market forecasting using a multi-task approach integrating long short-term memory and the random forest framework. Applied Soft Computing, 114, 108106.
  22. Salehi, M., & Garshasbi, F. (2019). Tehran Stock Exchange Index Forecasting Using Approach Adaptive Neural-Fuzzy Inference System and Imperialist Competitive Algorithm. Business Intelligence Management Studies, 8(29), 5-34.
  23. Schumaker, R. P., & Chen, H. (2009). A quantitative stock prediction system based on financial Information Processing & Management, 45(5), 571-583.
  24. Sezer, O. B., Gudelek, M. U., & Ozbayoglu, A. M. (2020). Financial time series forecasting with deep learning: A systematic literature review: 2005–2019. Applied Soft Computing, 90, 106181.
  25. Shapley, L. S. (1953). A value for n-person games.
  26. Sheikhzadeh, M. J., & Rahmany, S. (2023). Identification of effective indicators on predicting trends of total index of Tehran Stock Exchange using feature selection and classification algorithms. Financial Engineering and Portfolio Management, 56(14), 142-159.
  27. SOHRABI, M., Seyed Mozaffar, S. M., Chirani, E., & Kheradyar, S. (2022). Modeling the Prediction of Stock Market Jumps Based on the Recurrent Neural Network and Deep Learning. Journal of Securities Exchange, 15(59), 245-268.
  28. Thakkar, A., & Chaudhari, K. (2021). A comprehensive survey on deep neural networks for stock market: The need, challenges, and future directions. Expert Systems with applications, 177, 114800.
  29. Vaziri Kordestani, J., Farid, D., Nazemi Ardakani, M., & Hosseini Bamakan, S. M. (2022). Evaluation of PSO-BiLSTM method for stock price forecasting using stock price time series data (Case study: Iran Stock Exchange and OTC stock). Financial Management Strategy, 10(4), 125-150.
  30. Williams, C. K., & Rasmussen, C. E. (2006). Gaussian processes for machine learning (Vol. 2). MIT press Cambridge, MA.
  31. Yañez, C., Kristjanpoller, W., & Minutolo, M. C. (2024). Stock market index prediction using transformer neural network models and frequency decomposition. Neural Computing and Applications, 36(25), 15777-15797.