Predicting Stock Market Returns Using Temporal Fusion Transformer: A Comprehensive Data-Driven Approach

Document Type : Original Article

Authors

1 Department of Management, School of Industrial Engineering and Management, Shahrood University of Technology, Shahrood, Iran

2 Department of Computer Science, University of Passau, Passau, Germany

3 Department of Computer Engineering, Imam Reza International University, Mashhad, Iran.

10.22067/ijaaf.2025.93675.1562

Abstract

Stock market return prediction remains a highly challenging task due to the complex, dynamic, and noisy nature of financial markets. Although machine learning and deep learning models have been widely explored, many approaches struggle to capture long-term temporal dependencies and to provide interpretable feature selection. To address these challenges, this study employs the Temporal Fusion Transformer (TFT) for multi-horizon time series forecasting of daily returns in the Tehran Stock Exchange (TSE). Building on this backbone, the research introduces a novel feature selection strategy, Initial Selected Features–Mutual Information Difference (ISF-MID), which extends the Minimum Redundancy Maximum Relevance (mRMR) method by more effectively reducing redundancy and prioritizing significant variables. ISF-MID is integrated into a dual preprocessing framework, along with mRMR and Principal Component Analysis (PCA), which enhances both predictive accuracy and interpretability through a refined input representation. Extensive comparisons with benchmark models, including Long Short-Term Memory (LSTM), Multi-Layer Perceptron (MLP), and Random Forest (RF), were conducted using Mean Absolute Error (MAE), Mean Squared Error (MSE), and the coefficient of determination (R²). The results demonstrate that the proposed framework shows competitive performance compared with benchmark models, with TFT obtaining an R², of 98.9%, MAE of 0.00043, and MSE of 0.000018 on the out-of-sample test set, along with high directional accuracy. In general, the integration of TFT with the ISF-MID feature selection strategy offers methodological innovation and practical value, providing a useful framework that may support evidence-based return prediction and informed, risk-conscious investment decisions.

Keywords

Main Subjects


CAPTCHA Image