Improving Forecasting Accuracy of Stock Market Indices Utilizing Attention-Based LSTM Networks with a Novel Asymmetric Loss Function
Abstract
1. Introduction
2. Literature Review
2.1. Asymmetric Loss Functions
- (1)
- AdjLoss1:
- (2)
- AdjLoss2:
- (3)
- AdjLoss3:
- (4)
- AdjLoss4: (fully differentiable)
- The MADL loss is defined as
- The GMADL function is defined as
2.2. Drawbacks of Present Asymmetric Loss Functions
3. Methodology
3.1. Proposed Loss Function
3.2. Data Collection and Preprocessing
3.3. Model Architecture
3.4. Software and Hardware Setup
4. Results and Comparative Analysis
4.1. Evaluation Metrics
- MADL, GMADL and AdjMSE:
4.2. Proposed Functions
5. Conclusions and Future Improvements
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Conflicts of Interest
References
- Box, G.E.P.; Jenkins, G.M. Time Series Analysis: Forecasting and Control; Holden-Day: San Francisco, CA, USA, 1976. [Google Scholar]
- Bollerslev, T. Generalized autoregressive conditional heteroskedasticity. J. Econom. 1986, 31, 307–327. [Google Scholar] [CrossRef]
- Patel, J.; Shah, S.; Thakkar, P.; Kotecha, K. Predicting stock market index using fusion of machine learning techniques. Expert Syst. Appl. 2015, 42, 2162–2172. [Google Scholar] [CrossRef]
- Huang, W.; Nakamori, Y.; Wang, S.Y. Forecasting stock market movement direction with support vector machine. Comput. Oper. Res. 2005, 32, 2513–2522. [Google Scholar] [CrossRef]
- Kyoung-jae, K. Financial time series forecasting using support vector machines. Neurocomputing 2003, 55, 307–319. [Google Scholar] [CrossRef]
- Barua, M.; Kumar, T.; Raj, K.; Roy, A.M. Comparative Analysis of Deep Learning Models for Stock Price Prediction in the Indian Market. FinTech 2024, 3, 551–568. [Google Scholar] [CrossRef]
- Granger, C.W. Outline of forecast theory using generalized cost functions. Span. Econ. Rev. 1999, 1, 161. [Google Scholar] [CrossRef]
- Christoffersen, P.F.; Diebold, F.X. Optimal prediction under asymmetric loss. Econom. Theory 1997, 13, 808–817. [Google Scholar] [CrossRef]
- Michańków, J.; Sakowski, P.; Ślepaczuk, R. Mean Absolute Directional Loss as a New Loss Function for Machine Learning Problems in Algorithmic Investment Strategies. arXiv 2023, arXiv:2309.10546. [Google Scholar] [CrossRef]
- Michańków, J.; Sakowski, P.; Ślepaczuk, R. Generalized Mean Absolute Directional Loss as a Solution to Overfitting and High Transaction Costs in Machine Learning Models Used in High-Frequency Algorithmic Investment Strategies. arXiv 2024, arXiv:2412.18405. [Google Scholar] [CrossRef]
- Dessain, J. Improving the Prediction of Asset Returns With Machine Learning by Using a Custom Loss Function. Adv. Artif. Intell. Mach. Learn. 2023, 3, 1640–1653. [Google Scholar] [CrossRef]
- Kontopoulou, V.I.; Panagopoulos, A.D.; Kakkos, I.; Matsopoulos, G.K. A Review of ARIMA vs. Machine Learning Approaches for Time Series Forecasting in Data Driven Networks. Future Internet 2023, 15, 255. [Google Scholar] [CrossRef]
- Kumar, M.; Thenmozhi, M. Forecasting stock index returns using ARIMA-SVM, ARIMA-ANN, and ARIMA-random forest hybrid models. Int. J. Bank. Account. Financ. 2014, 5, 284. [Google Scholar] [CrossRef]
- Nelson, D.M.; Pereira, A.C.; Oliveira, R.A.D. Stock market’s price movement prediction with LSTM neural networks. In Proceedings of the International Joint Conference on Neural Networks, Anchorage, AK, USA, 14–19 May 2017. [Google Scholar] [CrossRef]
- Fischer, T.; Krauss, C. Deep learning with long short-term memory networks for financial market predictions. Eur. J. Oper. Res. 2018, 270, 654–669. [Google Scholar] [CrossRef]
- Ghosh, P.; Neufeld, A.; Sahoo, J.K. Forecasting directional movements of stock prices for intraday trading using LSTM and random forests. Financ. Res. Lett. 2022, 46, 102280. [Google Scholar] [CrossRef]
- Chandola, D.; Mehta, A.; Singh, S.; Tikkiwal, V.A.; Agrawal, H. Forecasting Directional Movement of Stock Prices using Deep Learning. Ann. Data Sci. 2023, 10, 1361–1378. [Google Scholar] [CrossRef] [PubMed]
- Elliott, G.; Komunjer, I.; Timmermann, A. Estimation and Testing of Forecast Rationality under Flexible Loss. Rev. Econ. Stud. 2005, 72, 1107–1125. [Google Scholar] [CrossRef]
- Markov, S.; Tan, M. Loss Function Asymmetry and Forecast Optimality: Evidence from Individual Analysts’ Forecasts. Account. Rev. 2006. Available online: https://ink.library.smu.edu.sg/soa_research/165 (accessed on 1 August 2025).
- Patton, A.J.; Timmermann, A. Properties of optimal forecasts under asymmetric loss and nonlinearity. J. Econom. 2007, 140, 884–918. [Google Scholar] [CrossRef]
- Hsu, C.; Tai, L. Exploring the Impact of Magnitude- and Direction-based Loss Function on the Profitability using Predicted Prices from Deep Learning. Int. J. Eng. Manag. Res. 2020, 10, 1–20. Available online: https://ssrn.com/abstract=3560007 (accessed on 1 August 2025). [CrossRef]
- Yin, H. Enhancing Directional Accuracy in Stock Closing Price Value Prediction Using a Direction-Integrated MSE Loss Function. In Proceedings of the 1st International Conference on Data Analysis and Machine Learning (DAML), Kuala Lumpur, Malaysia, 2023; pp. 119–126. Available online: https://www.scitepress.org/Link.aspx?doi=10.5220/0012810200003885 (accessed on 1 August 2025). [CrossRef]
- Liao, H.; Hu, Y.; Yuan, L. Time Series Forecasting with Trend Loss Function. 2024. Available online: https://ssrn.com/abstract=4960118 (accessed on 1 August 2025).
- Guen, V.L.; Thome, N. Shape and Time Distortion Loss for Training Deep Time Series Forecasting Models. arXiv 2019, arXiv:1909.09020. [Google Scholar] [CrossRef]
- Lee, H.; Lee, C.; Lim, H.; Ko, S. TILDE-Q: A Transformation Invariant Loss Function for Time-Series Forecasting. arXiv 2024, arXiv:2210.15050. [Google Scholar]
- Pei, Z.; Yan, J.; Yan, J.; Yang, B.; Li, Z.; Zhang, L.; Liu, X.; Zhang, Y. A Stock Price Prediction Approach Based on Time Series Decomposition and Multi-Scale CNN using OHLCT Images. arXiv 2024, arXiv:2410.19291. [Google Scholar] [CrossRef]
Date (YYYY-MM-DD) | Close | High | Low | Open | Volume |
---|---|---|---|---|---|
1990-01-03 | −0.2586 | 0.2502 | 1.6791 | 1.7799 | 18.6709 |
1990-01-04 | −0.8613 | −0.5075 | −1.3971 | −0.2586 | −7.9707 |
1990-01-05 | −0.9756 | −0.8613 | −0.4364 | −0.8613 | −10.435 |
1990-01-08 | 0.4514 | 0.4021 | 0.3505 | 0.9756 | 11.6193 |
⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ |
2023-12-26 | 0.4232 | 0.2468 | 0.0957 | 0.1660 | 9.2803 |
2023-12-27 | 0.0143 | 0.0140 | 0.2196 | 0.3066 | 9.3297 |
2023-12-28 | 0.0307 | 0.1653 | 0.2533 | 0.2721 | 8.4003 |
2023-12-29 | −0.2826 | −0.1016 | −0.6064 | −0.0744 | 15.8289 |
Layer/Shape | Activation/Regularization | Description |
---|---|---|
Input | — | Accepts preprocessed OHLCV data as percentage changes. |
LSTM-1 | Activation: Tanh; Recurrent: Sigmoid L2 regularization () on kernel and recurrent weights Dropout: 0.2; Recurrent Dropout: 0.2 Initializers: LeCun uniform (kernel), orthogonal (recurrent), zeros (bias) | Extracts local temporal dependencies from the input sequence. |
Self-Attention | — | Computes self-attention over LSTM outputs to highlight relevant temporal features. |
Residual Add | — | Adds attention output back to LSTM activations to enhance feature representation. |
LayerNormalization | — | Normalizes activations to stabilize and accelerate training. |
LSTM-2 | Activation: Tanh; Recurrent: Sigmoid L2 regularization () on kernel and recurrent weights Dropout: 0.2 Initializers: LeCun uniform (kernel), orthogonal (recurrent), zeros (bias) | Aggregates and summarizes sequential information into a condensed feature vector. |
Dense-1 | Linear; Activation: PReLU (learnable ) | Applies adaptive non-linearity to enhance feature representation. |
Dense-2 | Linear; Activation: PReLU (learnable ) | Further refines features and increases model expressiveness. |
Output | Linear | Outputs the predicted percentage change in closing price. |
Loss Function | Train Metrics | Test Metrics | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Dir Acc (%) | MAE | Precision | Recall | Specificity | F1-score | Dir Acc (%) | MAE | Precision | Recall | Specificity | F1-score | |
MSE | 58.10 | 0.68 | 0.57 | 0.90 | 0.21 | 0.70 | 52.88 | 0.80 | 0.56 | 0.85 | 0.21 | 0.69 |
MAE | 56.69 | 0.75 | 0.54 | 0.98 | 0.02 | 0.68 | 52.29 | 0.79 | 0.55 | 0.99 | 0.02 | 0.70 |
Loss Function | Train Metrics | Test Metrics | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Dir Acc (%) | MAE | Precision | Recall | Specificity | F1-score | Dir Acc (%) | MAE | Precision | Recall | Specificity | F1-score | |
MSE | 59.21 | 0.68 | 0.50 | 0.91 | 0.11 | 0.65 | 51.88 | 0.74 | 0.50 | 0.87 | 0.10 | 0.62 |
MAE | 58.29 | 0.70 | 0.51 | 0.98 | 0.03 | 0.66 | 51.08 | 0.77 | 0.51 | 0.97 | 0.02 | 0.70 |
Loss Function | Train Metrics | Test Metrics | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Dir Acc (%) | MAE | Precision | Recall | Specificity | F1-score | Dir Acc (%) | MAE | Precision | Recall | Specificity | F1-score | |
MSE | 57.54 | 0.66 | 0.53 | 0.94 | 0.18 | 0.68 | 52.24 | 0.79 | 0.50 | 0.92 | 0.08 | 0.64 |
MAE | 55.06 | 0.72 | 0.50 | 0.97 | 0.04 | 0.66 | 52.17 | 0.78 | 0.51 | 0.95 | 0.07 | 0.69 |
Loss Function | Train Metrics | Test Metrics | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Dir Acc (%) | MAE | Precision | Recall | Specificity | F1-score | Dir Acc (%) | MAE | Precision | Recall | Specificity | F1-score | |
MADL | 53.35 | 0.78 | 0.53 | 0.99 | 0.0003 | 0.69 | 52.47 | 0.80 | 0.54 | 0.99 | 0.01 | 0.70 |
GMADL (a = 100, b = 1) | 53.34 | 3.29 | 0.53 | 0.99 | 0.00 | 0.69 | 52.30 | 3.19 | 0.54 | 0.99 | 0.00 | 0.70 |
GMADL (a = 100, b = 2) | 53.34 | 4.37 | 0.53 | 0.99 | 0.00 | 0.69 | 52.30 | 4.41 | 0.54 | 0.99 | 0.00 | 0.70 |
GMADL (a = 100, b = 5) | 53.22 | 2.06 | 0.53 | 0.99 | 0.002 | 0.69 | 52.35 | 1.94 | 0.54 | 0.99 | 0.003 | 0.70 |
GMADL (a = 500, b = 1) | 53.34 | 1.77 | 0.53 | 1.00 | 0.00 | 0.69 | 52.30 | 1.79 | 0.54 | 1.00 | 0.00 | 0.70 |
GMADL (a = 500, b = 2) | 53.35 | 2.93 | 0.53 | 1.00 | 0.00 | 0.70 | 52.36 | 2.86 | 0.54 | 0.98 | 0.002 | 0.70 |
GMADL (a = 500, b = 5) | 53.34 | 3.34 | 0.53 | 1.00 | 0.00 | 0.69 | 52.30 | 3.27 | 0.54 | 1.00 | 0.00 | 0.70 |
GMADL (a = 1000, b = 1) | 51.82 | 1.51 | 0.54 | 0.02 | 0.97 | 0.05 | 50.93 | 1.51 | 0.52 | 0.05 | 0.95 | 0.09 |
GMADL (a = 1000, b = 2) | 53.31 | 1.42 | 0.53 | 0.98 | 0.02 | 0.69 | 52.30 | 1.64 | 0.54 | 0.98 | 0.02 | 0.69 |
GMADL (a = 1000, b = 5) | 53.36 | 1.46 | 0.53 | 0.99 | 0.01 | 0.69 | 52.36 | 1.46 | 0.54 | 0.99 | 0.001 | 0.70 |
AdjMSE1 ( = 1.5) | 53.27 | 0.76 | 0.54 | 0.89 | 0.12 | 0.67 | 52.06 | 0.79 | 0.55 | 0.91 | 0.12 | 0.68 |
AdjMSE1 ( = 2.0) | 53.55 | 0.75 | 0.54 | 0.98 | 0.02 | 0.69 | 52.94 | 0.79 | 0.55 | 0.98 | 0.04 | 0.70 |
AdjMSE2 ( = 2.25) | 53.71 | 0.75 | 0.54 | 0.98 | 0.03 | 0.69 | 53.03 | 0.78 | 0.55 | 0.98 | 0.03 | 0.70 |
AdjMSE2 ( = 2.5) | 54.35 | 0.74 | 0.54 | 0.97 | 0.06 | 0.69 | 53.12 | 0.79 | 0.56 | 0.98 | 0.05 | 0.69 |
AdjMSE3 ( = 0.1) | 53.72 | 0.76 | 0.54 | 0.98 | 0.03 | 0.69 | 52.94 | 0.79 | 0.55 | 0.97 | 0.04 | 0.70 |
Loss Function | Train Metrics | Test Metrics | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Dir Acc (%) | MAE | Precision | Recall | Specificity | F1-score | Dir Acc (%) | MAE | Precision | Recall | Specificity | F1-score | |
MADL | 50.38 | 0.73 | 0.53 | 0.21 | 0.79 | 0.31 | 50.06 | 0.78 | 0.55 | 0.26 | 0.74 | 0.36 |
GMADL (a = 100, b = 1) | 52.91 | 2.16 | 0.53 | 1.00 | 0.00 | 0.69 | 51.10 | 2.15 | 0.55 | 1.00 | 0.00 | 0.71 |
GMADL (a = 100, b = 2) | 52.91 | 1.81 | 0.53 | 1.00 | 0.00 | 0.69 | 51.04 | 1.84 | 0.55 | 1.00 | 0.00 | 0.71 |
GMADL (a = 100, b = 5) | 52.91 | 1.99 | 0.53 | 1.00 | 0.00 | 0.69 | 51.04 | 2.01 | 0.55 | 1.00 | 0.00 | 0.71 |
GMADL (a = 500, b = 1) | 52.91 | 1.84 | 0.53 | 1.00 | 0.00 | 0.69 | 51.04 | 1.86 | 0.55 | 1.00 | 0.00 | 0.71 |
GMADL (a = 500, b = 2) | 52.91 | 2.04 | 0.53 | 1.00 | 0.00 | 0.69 | 51.04 | 2.06 | 0.55 | 1.00 | 0.00 | 0.71 |
GMADL (a = 500, b = 5) | 52.91 | 5.35 | 0.53 | 1.00 | 0.00 | 0.69 | 51.04 | 5.58 | 0.55 | 1.00 | 0.00 | 0.71 |
GMADL (a = 1000, b = 1) | 52.91 | 1.91 | 0.53 | 1.00 | 0.00 | 0.69 | 51.10 | 1.93 | 0.55 | 1.00 | 0.01 | 0.71 |
GMADL (a = 1000, b = 2) | 53.95 | 2.56 | 0.00 | 0.00 | 1.00 | 0.00 | 51.90 | 2.65 | 0.00 | 0.00 | 1.00 | 0.00 |
GMADL (a = 1000, b = 5) | 52.91 | 6.16 | 0.53 | 1.00 | 0.00 | 0.69 | 50.10 | 6.13 | 0.55 | 1.00 | 0.00 | 0.71 |
AdjMSE1 ( = 1.5) | 53.86 | 0.70 | 0.54 | 0.92 | 0.11 | 0.68 | 51.09 | 0.79 | 0.56 | 0.95 | 0.08 | 0.71 |
AdjMSE1 ( = 2.0) | 52.52 | 0.73 | 0.53 | 0.89 | 0.11 | 0.67 | 50.72 | 0.78 | 0.56 | 0.92 | 0.12 | 0.69 |
AdjMSE2 ( = 2.25) | 53.14 | 0.73 | 0.53 | 1.00 | 0.01 | 0.69 | 51.53 | 0.78 | 0.55 | 1.00 | 0.02 | 0.71 |
AdjMSE2 ( = 2.5) | 53.45 | 0.73 | 0.53 | 0.98 | 0.03 | 0.69 | 51.34 | 0.78 | 0.56 | 0.98 | 0.05 | 0.71 |
AdjMSE3 ( = 0.1) | 52.91 | 0.73 | 0.53 | 1.00 | 0.00 | 0.69 | 51.16 | 0.78 | 0.55 | 1.00 | 0.00 | 0.71 |
Loss Function | Train Metrics | Test Metrics | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Dir Acc (%) | MAE | Precision | Recall | Specificity | F1-score | Dir Acc (%) | MAE | Precision | Recall | Specificity | F1-score | |
MADL | 52.38 | 1.00 | 0.54 | 0.82 | 0.16 | 0.65 | 51.18 | 1.01 | 0.56 | 0.79 | 0.24 | 0.66 |
GMADL (a = 100, b = 1) | 54.82 | 2.19 | 0.55 | 1.00 | 0.00 | 0.71 | 53.65 | 2.09 | 0.56 | 1.00 | 0.01 | 0.71 |
GMADL (a = 100, b = 2) | 54.85 | 1.71 | 0.55 | 1.00 | 0.00 | 0.71 | 52.59 | 1.62 | 0.56 | 1.00 | 0.00 | 0.71 |
GMADL (a = 100, b = 5) | 54.84 | 1.31 | 0.55 | 1.00 | 0.00 | 0.71 | 53.53 | 1.30 | 0.56 | 1.00 | 0.00 | 0.71 |
GMADL (a = 500, b = 1) | 54.84 | 4.33 | 0.55 | 1.00 | 0.00 | 0.71 | 53.53 | 4.35 | 0.56 | 1.00 | 0.00 | 0.71 |
GMADL (a = 500, b = 2) | 54.94 | 1.70 | 0.55 | 0.99 | 0.02 | 0.71 | 53.76 | 1.61 | 0.56 | 0.99 | 0.01 | 0.71 |
GMADL (a = 500, b = 5) | 51.09 | 6.30 | 0.00 | 0.00 | 1.00 | 0.00 | 50.41 | 6.32 | 0.00 | 0.00 | 1.00 | 0.00 |
GMADL (a = 1000, b = 1) | 54.85 | 2.17 | 0.55 | 0.95 | 0.06 | 0.70 | 52.58 | 1.98 | 0.57 | 0.87 | 0.18 | 0.69 |
GMADL (a = 1000, b = 2) | 54.84 | 5.64 | 0.55 | 1.00 | 0.00 | 0.71 | 52.53 | 5.59 | 0.56 | 1.00 | 0.00 | 0.71 |
GMADL (a = 1000, b = 5) | 54.92 | 3.47 | 0.55 | 1.00 | 0.00 | 0.71 | 53.82 | 3.24 | 0.56 | 1.00 | 0.01 | 0.71 |
AdjMSE1 ( = 1.5) | 55.49 | 0.98 | 0.55 | 0.98 | 0.03 | 0.71 | 53.06 | 1.01 | 0.56 | 0.99 | 0.03 | 0.71 |
AdjMSE1 ( = 2.0) | 55.19 | 1.00 | 0.55 | 0.97 | 0.05 | 0.70 | 53.88 | 1.01 | 0.56 | 0.98 | 0.03 | 0.71 |
AdjMSE2 ( = 2.25) | 55.32 | 1.00 | 0.55 | 0.96 | 0.05 | 0.70 | 54.11 | 1.01 | 0.57 | 0.95 | 0.10 | 0.71 |
AdjMSE2 ( = 2.5) | 55.84 | 0.98 | 0.55 | 0.98 | 0.04 | 0.71 | 54.94 | 1.01 | 0.56 | 0.99 | 0.03 | 0.71 |
AdjMSE3 ( = 0.1) | 54.25 | 1.00 | 0.55 | 0.95 | 0.04 | 0.70 | 53.76 | 1.01 | 0.56 | 0.97 | 0.05 | 0.71 |
& | Train Metrics | Test Metrics | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Dir Acc (%) | MAE | Precision | Recall | Specificity | F1-score | Dir Acc (%) | MAE | Precision | Recall | Specificity | F1-score | |
Tanh | ||||||||||||
59.59 | 0.73 | 0.58 | 0.90 | 0.25 | 0.70 | 54.89 | 0.79 | 0.56 | 0.79 | 0.26 | 0.66 | |
57.22 | 0.70 | 0.56 | 0.90 | 0.19 | 0.69 | 55.04 | 0.81 | 0.56 | 0.84 | 0.22 | 0.67 | |
55.89 | 0.72 | 0.56 | 0.82 | 0.26 | 0.66 | 54.01 | 0.80 | 0.55 | 0.77 | 0.26 | 0.65 | |
Tanh scaled with quadratic function | ||||||||||||
55.43 | 0.75 | 0.53 | 0.98 | 0.02 | 0.69 | 54.71 | 0.78 | 0.54 | 0.98 | 0.02 | 0.70 | |
59.85 | 0.66 | 0.58 | 0.83 | 0.32 | 0.68 | 54.88 | 0.81 | 0.56 | 0.78 | 0.27 | 0.65 | |
55.29 | 0.75 | 0.53 | 0.99 | 0.01 | 0.69 | 54.12 | 0.79 | 0.54 | 0.99 | 0.01 | 0.70 | |
55.54 | 0.75 | 0.53 | 0.88 | 0.13 | 0.67 | 54.41 | 0.78 | 0.55 | 0.83 | 0.19 | 0.66 | |
57.25 | 0.75 | 0.53 | 0.99 | 0.01 | 0.69 | 55.24 | 0.78 | 0.54 | 0.97 | 0.03 | 0.69 | |
55.21 | 0.77 | 0.53 | 0.99 | 0.01 | 0.69 | 54.06 | 0.86 | 0.54 | 0.98 | 0.01 | 0.70 | |
60.24 | 0.71 | 0.57 | 0.93 | 0.22 | 0.71 | 54.82 | 0.83 | 0.55 | 0.84 | 0.19 | 0.67 | |
57.64 | 0.71 | 0.56 | 0.87 | 0.24 | 0.68 | 54.41 | 0.79 | 0.55 | 0.81 | 0.22 | 0.66 | |
55.54 | 0.75 | 0.53 | 0.97 | 0.02 | 0.69 | 54.41 | 0.78 | 0.54 | 0.97 | 0.03 | 0.69 | |
Tanh scaled with exponential function | ||||||||||||
55.10 | 0.75 | 0.53 | 0.97 | 0.04 | 0.69 | 54.82 | 0.78 | 0.54 | 0.96 | 0.04 | 0.69 | |
56.21 | 0.72 | 0.56 | 0.79 | 0.30 | 0.65 | 55.19 | 0.79 | 0.56 | 0.80 | 0.25 | 0.66 | |
54.86 | 0.74 | 0.54 | 0.93 | 0.10 | 0.68 | 54.18 | 0.79 | 0.55 | 0.86 | 0.16 | 0.67 | |
54.32 | 0.75 | 0.53 | 0.99 | 0.01 | 0.69 | 54.41 | 0.78 | 0.54 | 0.99 | 0.01 | 0.70 | |
58.91 | 0.65 | 0.57 | 0.89 | 0.24 | 0.69 | 55.29 | 0.80 | 0.56 | 0.82 | 0.23 | 0.66 | |
56.43 | 0.73 | 0.55 | 0.86 | 0.20 | 0.67 | 55.06 | 0.79 | 0.56 | 0.81 | 0.24 | 0.66 | |
57.57 | 0.73 | 0.56 | 0.89 | 0.20 | 0.69 | 54.76 | 0.78 | 0.55 | 0.80 | 0.24 | 0.65 | |
56.92 | 0.73 | 0.54 | 0.95 | 0.08 | 0.69 | 55.27 | 0.79 | 0.55 | 0.93 | 0.09 | 0.69 | |
55.45 | 0.74 | 0.54 | 0.89 | 0.14 | 0.67 | 54.65 | 0.79 | 0.55 | 0.86 | 0.16 | 0.67 | |
Tanh scaled with linear function | ||||||||||||
57.56 | 0.75 | 0.54 | 0.99 | 0.01 | 0.69 | 54.65 | 0.79 | 0.55 | 0.99 | 0.02 | 0.70 | |
55.98 | 0.76 | 0.55 | 0.84 | 0.21 | 0.66 | 54.36 | 0.79 | 0.54 | 0.99 | 0.01 | 0.70 | |
54.39 | 0.76 | 0.54 | 0.88 | 0.15 | 0.67 | 53.30 | 0.79 | 0.54 | 0.99 | 0.02 | 0.70 | |
56.58 | 0.74 | 0.56 | 0.91 | 0.18 | 0.69 | 54.71 | 0.79 | 0.55 | 0.85 | 0.19 | 0.67 | |
55.44 | 0.72 | 0.55 | 0.95 | 0.10 | 0.70 | 55.06 | 0.79 | 0.55 | 0.91 | 0.12 | 0.69 | |
55.37 | 0.79 | 0.53 | 0.99 | 0.01 | 0.69 | 54.13 | 0.79 | 0.55 | 0.91 | 0.11 | 0.68 | |
56.45 | 0.76 | 0.55 | 0.92 | 0.13 | 0.69 | 54.83 | 0.79 | 0.55 | 0.99 | 0.02 | 0.70 | |
62.85 | 0.60 | 0.60 | 0.88 | 0.34 | 0.72 | 54.89 | 0.81 | 0.56 | 0.76 | 0.30 | 0.65 | |
56.74 | 0.69 | 0.56 | 0.87 | 0.22 | 0.68 | 54.36 | 0.79 | 0.55 | 0.81 | 0.23 | 0.66 |
& | Train Metrics | Test Metrics | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Dir Acc (%) | MAE | Precision | Recall | Specificity | F1-score | Dir Acc (%) | MAE | Precision | Recall | Specificity | F1-score | |
Tanh | ||||||||||||
53.56 | 0.72 | 0.53 | 0.97 | 0.04 | 0.68 | 52.66 | 0.78 | 0.55 | 0.94 | 0.08 | 0.70 | |
53.72 | 0.72 | 0.53 | 0.97 | 0.04 | 0.69 | 52.72 | 0.78 | 0.55 | 0.96 | 0.05 | 0.70 | |
52.75 | 0.72 | 0.52 | 0.96 | 0.04 | 0.68 | 52.72 | 0.78 | 0.55 | 0.97 | 0.04 | 0.70 | |
Tanh scaled with quadratic function | ||||||||||||
52.78 | 0.73 | 0.53 | 0.97 | 0.04 | 0.68 | 51.85 | 0.78 | 0.56 | 0.95 | 0.08 | 0.70 | |
53.59 | 0.72 | 0.53 | 0.97 | 0.05 | 0.69 | 51.91 | 0.78 | 0.56 | 0.95 | 0.08 | 0.70 | |
52.92 | 0.72 | 0.53 | 0.99 | 0.01 | 0.69 | 51.10 | 0.78 | 0.55 | 0.99 | 0.02 | 0.71 | |
53.89 | 0.72 | 0.54 | 0.98 | 0.04 | 0.69 | 51.78 | 0.78 | 0.56 | 0.97 | 0.06 | 0.71 | |
54.09 | 0.71 | 0.54 | 0.94 | 0.09 | 0.68 | 51.47 | 0.78 | 0.56 | 0.93 | 0.09 | 0.70 | |
53.33 | 0.72 | 0.53 | 0.99 | 0.02 | 0.69 | 51.29 | 0.78 | 0.55 | 0.98 | 0.03 | 0.71 | |
53.44 | 0.72 | 0.53 | 0.98 | 0.03 | 0.69 | 51.78 | 0.78 | 0.56 | 0.97 | 0.05 | 0.71 | |
54.57 | 0.70 | 0.54 | 0.88 | 0.17 | 0.67 | 52.03 | 0.79 | 0.57 | 0.87 | 0.18 | 0.69 | |
53.42 | 0.73 | 0.53 | 0.98 | 0.03 | 0.69 | 51.53 | 0.78 | 0.55 | 0.97 | 0.05 | 0.71 | |
Tanh scaled with exponential function | ||||||||||||
54.99 | 0.71 | 0.54 | 0.95 | 0.10 | 0.69 | 52.85 | 0.78 | 0.56 | 0.91 | 0.13 | 0.69 | |
57.78 | 0.65 | 0.57 | 0.87 | 0.25 | 0.69 | 52.91 | 0.79 | 0.57 | 0.82 | 0.24 | 0.67 | |
54.84 | 0.68 | 0.54 | 0.92 | 0.13 | 0.68 | 52.66 | 0.78 | 0.56 | 0.92 | 0.11 | 0.70 | |
54.57 | 0.71 | 0.54 | 0.91 | 0.14 | 0.68 | 52.16 | 0.78 | 0.56 | 0.92 | 0.12 | 0.70 | |
53.61 | 0.72 | 0.53 | 0.94 | 0.08 | 0.68 | 52.91 | 0.78 | 0.56 | 0.94 | 0.09 | 0.70 | |
55.01 | 0.70 | 0.55 | 0.88 | 0.17 | 0.68 | 52.28 | 0.80 | 0.56 | 0.92 | 0.13 | 0.70 | |
53.61 | 0.72 | 0.53 | 0.98 | 0.04 | 0.69 | 51.28 | 0.78 | 0.56 | 0.97 | 0.06 | 0.71 | |
55.94 | 0.68 | 0.55 | 0.94 | 0.13 | 0.69 | 54.59 | 0.78 | 0.56 | 0.92 | 0.13 | 0.70 | |
52.86 | 0.73 | 0.54 | 0.82 | 0.20 | 0.65 | 51.79 | 0.78 | 0.57 | 0.76 | 0.28 | 0.65 | |
Tanh scaled with linear function | ||||||||||||
55.60 | 0.69 | 0.55 | 0.93 | 0.13 | 0.69 | 53.34 | 0.78 | 0.56 | 0.94 | 0.11 | 0.70 | |
54.96 | 0.69 | 0.54 | 0.92 | 0.13 | 0.68 | 53.91 | 0.80 | 0.56 | 0.92 | 0.12 | 0.69 | |
52.80 | 0.75 | 0.53 | 1.00 | 0.00 | 0.69 | 52.10 | 0.80 | 0.55 | 0.99 | 0.01 | 0.71 | |
53.03 | 0.73 | 0.53 | 0.97 | 0.04 | 0.69 | 52.91 | 0.78 | 0.56 | 0.97 | 0.05 | 0.71 | |
54.34 | 0.73 | 0.54 | 0.88 | 0.17 | 0.67 | 53.03 | 0.82 | 0.56 | 0.88 | 0.17 | 0.69 | |
53.44 | 0.74 | 0.54 | 0.83 | 0.21 | 0.65 | 52.16 | 0.81 | 0.56 | 0.84 | 0.20 | 0.67 | |
57.60 | 0.67 | 0.57 | 0.85 | 0.26 | 0.68 | 52.22 | 0.81 | 0.57 | 0.81 | 0.26 | 0.67 | |
54.85 | 0.69 | 0.54 | 0.90 | 0.15 | 0.68 | 52.66 | 0.81 | 0.56 | 0.89 | 0.15 | 0.69 | |
53.33 | 0.73 | 0.53 | 0.95 | 0.07 | 0.68 | 51.47 | 0.79 | 0.55 | 0.96 | 0.05 | 0.70 |
& | Train Metrics | Test Metrics | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Dir Acc (%) | MAE | Precision | Recall | Specificity | F1-score | Dir Acc (%) | MAE | Precision | Recall | Specificity | F1-score | |
Tanh | ||||||||||||
53.56 | 0.72 | 0.53 | 0.97 | 0.04 | 0.68 | 52.66 | 0.78 | 0.55 | 0.94 | 0.08 | 0.70 | |
53.72 | 0.72 | 0.53 | 0.97 | 0.04 | 0.69 | 52.72 | 0.78 | 0.55 | 0.96 | 0.05 | 0.70 | |
52.75 | 0.72 | 0.52 | 0.96 | 0.04 | 0.68 | 51.72 | 0.78 | 0.55 | 0.97 | 0.04 | 0.70 | |
Tanh scaled with quadratic function | ||||||||||||
55.14 | 0.99 | 0.55 | 0.98 | 0.03 | 0.71 | 54.23 | 1.00 | 0.56 | 0.97 | 0.05 | 0.71 | |
54.95 | 1.01 | 0.55 | 0.99 | 0.01 | 0.71 | 53.71 | 1.03 | 0.56 | 1.00 | 0.00 | 0.71 | |
55.25 | 0.99 | 0.56 | 0.92 | 0.11 | 0.69 | 53.48 | 1.00 | 0.56 | 0.89 | 0.11 | 0.68 | |
55.10 | 0.99 | 0.55 | 0.99 | 0.01 | 0.71 | 53.59 | 1.01 | 0.56 | 1.00 | 0.00 | 0.71 | |
55.11 | 0.99 | 0.55 | 1.00 | 0.01 | 0.71 | 53.88 | 1.01 | 0.56 | 0.99 | 0.02 | 0.71 | |
55.51 | 0.99 | 0.55 | 0.98 | 0.04 | 0.71 | 53.30 | 1.01 | 0.56 | 0.97 | 0.04 | 0.71 | |
55.49 | 0.98 | 0.55 | 0.97 | 0.05 | 0.70 | 53.65 | 1.01 | 0.56 | 0.98 | 0.03 | 0.71 | |
54.92 | 1.00 | 0.55 | 0.99 | 0.02 | 0.71 | 52.00 | 1.01 | 0.56 | 0.99 | 0.03 | 0.71 | |
55.20 | 0.99 | 0.55 | 0.99 | 0.02 | 0.71 | 53.53 | 1.00 | 0.56 | 0.99 | 0.02 | 0.71 | |
Tanh scaled with exponential function | ||||||||||||
54.89 | 0.99 | 0.55 | 1.00 | 0.01 | 0.71 | 52.76 | 1.00 | 0.56 | 1.00 | 0.01 | 0.71 | |
57.53 | 0.95 | 0.57 | 0.91 | 0.16 | 0.70 | 53.17 | 1.02 | 0.57 | 0.89 | 0.16 | 0.69 | |
54.78 | 1.00 | 0.55 | 0.99 | 0.01 | 0.71 | 52.94 | 1.01 | 0.56 | 0.98 | 0.03 | 0.71 | |
55.03 | 0.99 | 0.55 | 0.99 | 0.01 | 0.71 | 53.76 | 1.01 | 0.56 | 0.99 | 0.02 | 0.71 | |
55.14 | 0.99 | 0.55 | 0.99 | 0.02 | 0.71 | 53.71 | 1.00 | 0.56 | 0.99 | 0.01 | 0.71 | |
60.22 | 0.86 | 0.59 | 0.93 | 0.21 | 0.72 | 55.88 | 1.02 | 0.57 | 0.89 | 0.14 | 0.69 | |
54.89 | 0.99 | 0.55 | 1.00 | 0.00 | 0.71 | 52.53 | 1.01 | 0.56 | 1.00 | 0.00 | 0.71 | |
55.26 | 0.99 | 0.55 | 0.98 | 0.03 | 0.71 | 53.82 | 1.00 | 0.56 | 0.97 | 0.05 | 0.71 | |
54.97 | 0.99 | 0.55 | 1.00 | 0.01 | 0.71 | 52.59 | 1.00 | 0.56 | 1.00 | 0.01 | 0.71 | |
Tanh scaled with linear function | ||||||||||||
54.91 | 0.99 | 0.55 | 1.00 | 0.01 | 0.71 | 53.71 | 1.00 | 0.56 | 1.00 | 0.01 | 0.71 | |
54.78 | 0.99 | 0.55 | 0.94 | 0.07 | 0.69 | 52.41 | 1.00 | 0.56 | 0.88 | 0.14 | 0.69 | |
54.72 | 0.99 | 0.55 | 0.98 | 0.03 | 0.70 | 52.71 | 1.00 | 0.55 | 0.93 | 0.07 | 0.70 | |
57.54 | 0.96 | 0.57 | 0.93 | 0.14 | 0.71 | 55.82 | 1.04 | 0.56 | 0.91 | 0.12 | 0.70 | |
55.32 | 0.99 | 0.56 | 0.89 | 0.15 | 0.69 | 54.77 | 1.01 | 0.56 | 0.85 | 0.17 | 0.68 | |
55.20 | 0.96 | 0.57 | 0.79 | 0.27 | 0.66 | 54.83 | 1.04 | 0.57 | 0.79 | 0.25 | 0.66 | |
55.00 | 0.99 | 0.55 | 0.99 | 0.02 | 0.71 | 53.82 | 1.01 | 0.56 | 0.99 | 0.02 | 0.71 | |
54.78 | 0.99 | 0.55 | 1.00 | 0.00 | 0.71 | 52.65 | 1.01 | 0.56 | 1.00 | 0.00 | 0.71 | |
57.50 | 0.92 | 0.57 | 0.90 | 0.18 | 0.70 | 54.35 | 1.03 | 0.57 | 0.84 | 0.19 | 0.68 |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2025 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
Rajpal, S.S.; Mahadeva, R.; Goyal, A.K.; Sarda, V. Improving Forecasting Accuracy of Stock Market Indices Utilizing Attention-Based LSTM Networks with a Novel Asymmetric Loss Function. AI 2025, 6, 268. https://doi.org/10.3390/ai6100268
Rajpal SS, Mahadeva R, Goyal AK, Sarda V. Improving Forecasting Accuracy of Stock Market Indices Utilizing Attention-Based LSTM Networks with a Novel Asymmetric Loss Function. AI. 2025; 6(10):268. https://doi.org/10.3390/ai6100268
Chicago/Turabian StyleRajpal, Shlok Sagar, Rajesh Mahadeva, Amit Kumar Goyal, and Varun Sarda. 2025. "Improving Forecasting Accuracy of Stock Market Indices Utilizing Attention-Based LSTM Networks with a Novel Asymmetric Loss Function" AI 6, no. 10: 268. https://doi.org/10.3390/ai6100268
APA StyleRajpal, S. S., Mahadeva, R., Goyal, A. K., & Sarda, V. (2025). Improving Forecasting Accuracy of Stock Market Indices Utilizing Attention-Based LSTM Networks with a Novel Asymmetric Loss Function. AI, 6(10), 268. https://doi.org/10.3390/ai6100268