Interpreting Forecast the Return of the Price Index of Manufacturing Industries in the Tehran Stock Exchange Using Explainable Ensemble Learning

Document Type : Original Article

Authors

1 Professor of finance management, faculty of accounting and finance, college of management, university of Tehran. Iran.

2 Msc of finance management, faculty of accounting and finance, college of management, university of Tehran. Iran.

3 Assistant Professor, Industrial Management Deptment, Meybod University, Meybod, Iran

4 Msc Student of Algrithms and Computations, faculty of Electrical and Computer Engineering (ECE), college of Engineering, University of Tehran. Iran.

Abstract

Purpose: In recent years, machine learning has gained significant attention as an effective tool for forecasting financial time series. However, many of these models function as black boxes, and their lack of transparency has led to reduced trust in their predictions. To address this limitation, the use of explainable artificial intelligence (XAI) models-capable of providing detailed insights into the prediction mechanisms-has become essential. Accordingly, the aim of this study is to develop and evaluate an artificial intelligence (AI)-based forecasting model that not only delivers high accuracy but also offers strong interpretability. In this context, the contribution and role of input variables in the model's predictions are explicitly identified, and the stability of the results in terms of both accuracy and explain ability is assessed using cross-validation techniques, particularly time series splitting.
Method: This applied research adopts a descriptive-analytical method with a quantitative forecasting approach. For the first time in Iran, it investigates the explain ability of optimized artificial intelligence models in forecasting the return of the price index for eight manufacturing industries listed on the Tehran Stock Exchange. The dataset, covering the period from 2018 to 2023, was collected from the Bourse View database. The Random Forest algorithm, as an ensemble learning method, was trained using a combination of technical, fundamental, and macroeconomic variables as input features. A Genetic Algorithm was utilized to optimize the model’s hyperparameters. To enhance transparency and model credibility, the SHAP (shapley additive explanations) technique was employed to analyze the influence and importance of each feature in the prediction process.
Findings: The results demonstrate that combining the Random Forest algorithm with Genetic Algorithm-based hyperparameter optimization and incorporating explain ability techniques such as SHAP values not only improves the prediction accuracy of the price index returns for Tehran’s manufacturing industries but also enhances model transparency and reliability. The findings highlight those technical indicators-particularly the Exponential Moving Average (EMA), MACD (Moving Average Convergence Divergence) index, trading volume, and free float shares-play the most significant role in enhancing predictive accuracy. In contrast, fundamental variables such as the price-to-earnings ratio and interest rates are influential but less impactful compared to technical indicators. Furthermore, time series cross-validation confirms the robustness and generalizability of the proposed model across different time periods.
Conclusion: In line with reputable international studies, the results suggest that explainable artificial intelligence (AI) models not only outperform traditional models in predictive tasks but also assist financial analysts in making informed and effective decisions. These models can play a pivotal role in risk management and portfolio optimization. Therefore, the proposed model-featuring operational transparency and high reliability- is introduced as an effective tool for financial analysts, opening new horizons for the application of explainable artificial intelligence (AI) in Iran’s financial sector.

Keywords


  1. Adadi, A., & Berrada, M. (2018). Peeking inside the black-box: A survey on explainable artificial intelligence (XAI). IEEE Access, 6, 52138–52160.
  2. Ammann, M., Coqueret, G., & Schade, F. (2022). Machine learning in asset pricing. Journal of Financial Economics, 144(2), 424-453.
  3. Arsenault, P., Wang, S., & Patenande, J. (2024). A Survey of Explainable Artificial Intelligence (XAI) in Financial Time Series Forecasting. ArXiv, abs/2407.15909.
  4. Babaei, G., Giudici, P., & Raffinetti, E. (2022). Explainable artificial intelligence for crypto asset allocation. Finance Research Letters, 47, 102941.
  5. Bergmeir, C., Hyndman, R. J., & Koo, B. (2018). A note on the validity of cross-validation for evaluating autoregressive time series prediction. Computational Statistics & Data Analysis, 120, 70–83.
  6. Box, G. E. P. (2013). Box and Jenkins: Time series analysis, forecasting and control. In A Very British affair: Six Britons and the development of time series analysis during the 20th century (pp. 161–215). Palgrave Macmillan.
  7. Campbell, J. Y., & Thompson, S. B. (2008). Predicting excess stock returns out of sample: Can anything beat the historical average, The Review of Financial Studies, 21(4), 1509-1531.
  8. Cartea, Á., Jaimungal, S., & Penalva, J. (2015). Algorithmic and high-frequency trading. Cambridge University Press.
  9. Chen, Z., Li, C., & Sun, W. (2020). Bitcoin price prediction using machine learning: An approach to sample dimension engineering. Journal of Computational and Applied Mathematics, 365, 112395.
  10. Deng, S., Huang, X., Zhu, Y., Su, Z., Fu, Z., & Shimada, T. (2023). Stock index direction forecasting using an explainable eXtreme Gradient Boosting and investor sentiments. The North American Journal of Economics and Finance, 64, 101848.
  11. Doshi-Velez, F., & Kim, B. (2017). Towards a rigorous science of interpretable machine learning. arXiv preprint arXiv:1702.08608.
  12. Eghtesad, A. and Mohammadi,. (2023). Portfolio optimization with return prediction using LSTM, Random forest, and ARIMA. Financial Management Perspective, 13(43), 9-28. (in Persian)
  13. Fama, E. F., & French, K. R. (1992). The cross-section of expected stock returns. The Journal of Finance, 47(2), 427–465.
  14. Fischer, T., & Krauss, C. (2018). Deep learning with long short-term memory networks for financial market predictions. European Journal of Operational Research, 270(2), 654–669.
  15. Gilpin, L. H., Bau, D., Yuan, B. Z., Bajwa, A., Specter, M., & Kagal, L. (2018). Explaining explanations: An overview of interpretability of machine learning. In 2018 IEEE 5th International Conference on Data Science and Advanced Analytics (DSAA) (pp. 80–89). IEEE.
  16. Goodell, J. W., Kumar, S., Lim, W. M., & Pattnaik, D. (2021). Artificial intelligence and machine learning in finance: Identifying foundations, themes, and research clusters from bibliometric analysis. Journal of Behavioral and Experimental Finance, 32, 100577.
  17. Gholami, N. and Shams Gharne, N. (2024). Presenting an Optimized CNN-LSTM Model for Stock Price Forecasting in the Tehran Stock Exchange. Financial Management Perspective, 14(45), 123-147. (in Persian)
  18. Gu, S., Kelly, B., & Xiu, D. (2020). Empirical asset pricing via machine learning. The Review of Financial Studies, 33(5), 2223-2273.
  19. Harel, A., & Harpaz, G. (2021). Forecasting stock prices. International Review of Economics & Finance, 73, 249–256.
  20. Heidari, M. and 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. (in Persian)
  21. Hyndman, R. J., & Athanasopoulos, G. (2018). Forecasting: Principles and practice (2nd ed.). OTexts.
  22. Lipton, Z. C. (2018). The mythos of model interpretability. Communications of the ACM, 61(10), 36-43.
  23. Liu, Y., Li, Z., Nekhili, R., & Sultan, J. (2023). Forecasting cryptocurrency returns with machine learning. Research in International Business and Finance, 64, 101905.
  24. Lundberg, S. M., Erion, G., Chen, H., DeGrave, A., Prutkin, J. M., Nair, B., ... & Lee, S.-I. (2020). From local explanations to global understanding with explainable AI for trees. Nature Machine Intelligence, 2(1), 56-67.
  25. Moayedfar, S., Mohebbi, H., Mozaffaree Pour, N., & Sharifi, A. (2025). Developing a localized resilience assessment framework for historical districts: A case study of Yazd, Iran. PLoS One, 20(2), e0317088.
  26. Molnar, C. (2022). Interpretable machine learning. Independently published.
  27. Nallakaruppan, M., Chaturvedi, H., Grover, V., Balusamy, B., Jaraut, P., Bahadur, J., Meena, V., & Hameed, I. (2024). Credit Risk Assessment and Financial Decision Support Using Explainable Artificial Intelligence. Risks.
  28. Orte, F., Mira, J., Sánchez, M. J., & Solana, P. (2023). A random forest-based model for crypto asset forecasts in futures markets with out-of-sample prediction. Research in International Business and Finance, 64, 101829.
  29. Patel, J., Shah, S., Thakkar, P., & Kotecha, K. (2015). Predicting stock market index fusing fusion of machine learning techniques. Expert Systems with Applications, 42(4), 2162–2172.
  30. 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.
  31. Strumbelj, E., & Kononenko, I. (2014). Explaining prediction models and individual predictions with feature contributions. Knowledge and Information Systems, 41(3), 647-665.
  32. West, J., & Bhattacharya, M. (2016). Intelligent financial fraud detection: A comprehensive review. Computers & Security, 57, 47-66.
  33. Zhang, C. A., Cho, S., & Vasarhelyi, M. (2022). Explainable artificial intelligence (XAI) in auditing. International Journal of Accounting Information Systems, 46, 100572.