TL;DR
This paper introduces 2CAT, a novel deep learning model that leverages a context-attentive transformer architecture with signal decomposition and correlation-based attention for improved financial time-series forecasting. By incorporating transfer learning, 2CAT demonstrates robust generalization capabilities across diverse market conditions, outperforming existing state-of-the-art models.
What Problem Does This Paper Address?
Accurately forecasting stock market prices is a critical challenge due to the inherent nonlinearity, non-stationarity, and complex temporal dependencies within financial time-series data. Traditional models like ARIMA struggle with these complexities, while even advanced machine learning techniques can face limitations in capturing both short-term fluctuations and long-term trends simultaneously. Furthermore, global financial markets are interconnected, suggesting that knowledge gained from one market could potentially improve forecasting in others, but effectively transferring this knowledge remains a significant hurdle. This paper aims to address these challenges by developing a model that can capture intricate temporal patterns, generalize across different markets, and leverage transfer learning for enhanced predictive performance.
Methods
The core of this work is the 2CAT (CNN-Correlation-based Attention Transformer) model. It builds upon the transformer architecture but introduces several key modifications tailored for time-series data:
- Signal Decomposition: The input time series is decomposed into trend and seasonal components. This allows the model to process these components separately, improving its ability to capture long-term trajectories and recurring patterns.
- 1D Convolutional Neural Networks (CNNs): Instead of standard linear projections, 1D CNNs are used to extract local patterns and temporal features at different scales.
- Correlation-based Attention: The traditional attention mechanism is replaced with correlation-based approaches (autocorrelation in the encoder, cross-correlation in the decoder). These are computed in the frequency domain using Fast Fourier Transforms (FFT) for efficiency. This helps in finding temporal relationships and identifying informative time lags for prediction.
- Transfer Learning (TL): A three-stage approach is employed:
- Pretraining: The model is trained on a source dataset (e.g., DJIA) to learn general patterns.
- Freezing: The encoder layers are frozen to preserve the learned knowledge.
- Fine-tuning: The decoder is fine-tuned on the target dataset to adapt to its specific characteristics.
Datasets
The study utilizes six public stock index datasets for evaluation:
- Dow Jones Industrial Average (DJIA)
- Nikkei 225 (N225)
- Hang Seng Index (HSI)
- Shanghai Stock Exchange Composite Index (SSE)
- Bombay Stock Exchange (BSE)
- Thailand SET Index (SET)
Daily trading information (opening price, highest price, lowest price, closing price) was collected from Yahoo Finance for the period of February 1, 2021, to January 31, 2024. For transfer learning experiments, DJIA was used as the source domain, and the other five Asian indices served as target domains.
Key Insights and Ideas
- Decomposition is Key: Breaking down time-series data into trend and seasonal components is crucial for models to effectively learn from different temporal scales, much like human analysts do.
- Correlation over Standard Attention: For financial time-series, correlation-based mechanisms seem to be more adept at capturing the specific temporal relationships than standard self-attention, especially when combined with CNNs.
- Transfer Learning Bridges Markets: The study strongly suggests that knowledge transfer between different stock markets is not only feasible but can significantly enhance forecasting accuracy, even when markets have distinct characteristics.
- Robustness Across Markets: The 2CAT model demonstrates remarkable stability and adaptability across various stock indices, including those with high volatility, unlike some other models that show significant performance degradation.
Key Results
- Superior Performance: On the DJIA dataset, 2CAT achieved an MSE of 0.0655, MAE of 0.2023, and R² of 0.9169, outperforming Deep-Transformer (MSE: 0.1360, R²: 0.8274).
- Challenging Markets Handled: For the SET index, where other models struggled and yielded negative R² values, 2CAT achieved a significant R² of 0.9094.
- Transfer Learning Gains: Transfer learning experiments showed statistically significant improvements, reinforcing its value for cross-market applications. For instance, on HSI, transfer learning improved MSE from 0.0146 to 0.0137.
- Architectural Impact: An ablation study confirmed that architectural improvements, particularly rotary positional encoding, consistently contribute to better forecasting accuracy.
- Prediction Horizon: The model maintains acceptable performance even at a 5-day forecast horizon, though accuracy naturally declines as the prediction period extends.
Limitations and Future Work
- Computational Efficiency: The paper acknowledges a lack of computational efficiency assessment and inference latency benchmarks, which are critical for real-time applications.
- Model Retraining: Guidelines for optimal model retraining frequency in dynamic, evolving markets are not provided.
- External Data Integration: The current architecture does not integrate sentiment analysis or external event data, which could further enhance predictive capacity. Preliminary experiments with macroeconomic indicators showed challenges due to temporal misalignment.
- Excluded Models: Advanced architectures like Time2Vec and Temporal Fusion Transformer were excluded due to implementation constraints, leaving a gap in the comparative evaluation.
- Future Directions: Future research should focus on hardware benchmarking for computational efficiency, developing adaptive retraining frameworks, integrating structured financial data with sentiment analysis, and exploring distributed computing for real-time applications. The implementation of excluded models is also suggested.
Summary updated