پیش‌بینی شاخص کل بورس اوراق بهادار تهران با استفاده از تقویت گرادیان طبیعی و مقادیر SHAP

نوع مقاله : علمی - پژوهشی

نویسندگان

1 دانشکده مدیریت و حسابداری، دانشگاه علامه طباطبایی، تهران، ایران

2 گروه مالی و بانکداری، دانشگاه علامه طباطبایی، تهران، ایران

3 دانشیار گروه مالی و بانکداری، دانشگاه علامه طباطبایی، تهران، ایران

4 استادیار گروه مالی و بانکداری، دانشگاه علامه طباطبایی، تهران، ایران.

چکیده

هدف: بازار سهام یکی از کلیدی‌ترین عناصر اقتصادهای در حال توسعه است. به همین جهت مطالعات گسترده‌ای با استفاده از تحلیل‌های تکنیکال و بنیادی، به پیش‌بینی سری‌های زمانی مالی پرداخته‌اند تا بتوانند به سرمایه‌گذاران در معاملاتشان یاری رسانند. در همین راستا مدل‌های یادگیری ماشین توانسته‌اند به عنوان ابزاری کارآمد برای مسائل گوناگون، نقش آفرینی کنند. اما علی‌رغم عملکرد قابل توجه مدل‌های یادگیری ماشین در این حوزه، دو ایراد مهم به آنها وارد است. مسئله اول تفسیرناپذیری نتایج است که در این مدل‌ها نحوه تبدیل ورودی‌ها به خروجی‌ها و یا سهم هر یک از ورودی‌ها در شکل دادن به خروجی مدل مشخص نمی‌باشد. دوم، قابل اتکا بودن نتایج حاصل از پیش‌بینی این مدل‌هاست که به طور مستقیم از مدل قابل استخراج نمی‌باشد. به همین جهت در این پژوهش از جدیدترین روش‌های ارائه شده در حوزه یادگیری ماشین برای پاسخ گویی به این دو مسئله استفاده شده است.

روش: با توجه به اینکه در این مدل‌ها انتخاب ویژگی‌های ورودی از اهمیت بسیار زیادی در شکل‌دهی خروجی مدل برخوردار است، در این پژوهش با روشی نظام‌مند، از طریق مرور سیستماتیک ویژگی‌های به کارگرفته شده در پژوهش‌های مرتبط در پنج سال اخیر استخراج شده و نهایتاً 34 ویژگی که داده‌های آنها به شکل روزانه موجود می‌باشند به عنوان ورودی مدل انتخاب شده‌اند. در گام بعد، از مدل تقویت گرادیان طبیعی برای پیش‌بینی داده‌های شاخص کل بورس اوراق بهادار تهران از ابتدای سال 1389 تا سال 1403 استفاده شده است. عملکرد این مدل با استفاده از معیارهای RMSE، MAE و MAPE سنجیده شده و با جدیدترین روش‌های یادگیری ماشین برای پیش‌بینی سری‌های زمانی مقایسه شده است. در ادامه از مقادیر SHAP برای تفسیر نتایج مدل تقویت گرادیان طبیعی استفاده شده است و سهم هر یک از ویژگی‌ها در تخمین خروجی مدل ارزیابی شده است. مقادیر SHAP ابزاری قدرتمند برای سنجش اثرگذاری هر یک از ویژگی‌های ورودی بر تخمین خروجی فراهم می‌آورد که اطلاعات ارزشمندی را در اختیار کاربران مدل‌های یادگیری ماشین قرار می‌دهد.

یافته‌ها: مقایسه مقادیر خطای مدل ارائه شده با سایر مدل‌های یادگیری ماشین، نشان از عملکرد بهتر این مدل در پیش‌بینی دارد. این مدل، برخلاف سایر مدل‌های یادگیری ماشین که یک پیش‌بینی به عنوان بهترین حدس را به عنوان خروجی ارائه می‌دهند، یک توزیع احتمال که بر اساس پارامترهای آن قابل توصیف است ارائه می‌دهد. شکل توزیع پارامتریک در نظر گرفته شده در این پژوهش تابع توزیع نرمال است که با پارامترهای میانگین و انحراف معیار قابل توصیف می‌باشد. در واقع مقدار پیش‌بینی شده، همان میانگین توزیع تخمین زده شده می‌باشد. برای پیش‌بینی شاخص بورس اوراق بهادار تهران، اثرگذارترین ویژگی‌ها قیمت پایانی، اندیکاتور EMA و اندیکاتور SMA هستند. تفسیر پارامتر انحراف معیار پیش‌بینی انجام شده، نشان می‌دهد که بیشترین اثرگذاری در این پارامتر را اندیکاتور ATR، قیمت پایانی و TEMA دارند که هر چقدر مقدار نسبی این متغیرها بیشتر باشد، انحراف معیار توزیع تخمینی بیشتر بوده و بنابراین پیش‌بینی انجام شده قابلیت اتکای کمتری خواهد داشت.

نتیجه‌گیری: مدل تقویت گرادیان طبیعی می‌تواند به‌عنوان ابزاری مؤثر در پیش‌بینی شاخص کل بورس اوراق بهادار تهران مورد استفاده قرار گیرد. تفسیر نتایج با استفاده از مقادیر SHAP، امکان شناسایی مهم‌ترین ویژگی‌های ورودی و همچنین نحوه تشکیل خروجی از ویژگی‌های ورودی را فراهم کرده و به بهینه‌سازی مدل کمک می‌نماید. این رویکرد نه‌تنها دقت پیش‌بینی را بهبود می‌بخشد، بلکه به فعالان بازار سرمایه و سیاست‌گذاران کمک می‌کند تا تصمیم‌گیری‌های آگاهانه‌تری در مدیریت ریسک و تخصیص منابع داشته باشند. در نهایت، مقایسه با سایر مدل‌ها نشان می‌دهد که این روش می‌تواند به‌عنوان یک راهکار عملی و قابل اعتماد در تحلیل بازارهای مالی به کار گرفته شود.

کلیدواژه‌ها


عنوان مقاله [English]

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

نویسندگان [English]

  • Madjid Ghods 1
  • Meysam Amiry 2
  • Moslem Peymani Forooshani 3
  • Mohammadali Dehghan Dehnavi 4
1 Department of Finance and Banking, University of Allameh Tabataba’i ,Tehran, Iran
2 Department of Finance and Banking, University of Allameh Tabataba’i ,Tehran, Iran
3 Department of Finance and Banking, University of Allameh Tabataba’i ,Tehran, Iran
4 Department of Finance and Banking, University of Allameh Tabataba’i ,Tehran, Iran
چکیده [English]

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.

کلیدواژه‌ها [English]

  • Stock Price Prediction
  • Natural Gradient Boosting
  • SHAP Values
  • Tehran Stock Exchange
  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.