VSF-Net: A variational encoder and Sharpness-Aware attention framework for robust forecasting of non-stationary financial time series
摘要
Predicting financial time series and mainly the extremely volatile and non-stationary dynamics of the stock prices is a challenging task. Deep learning models have trouble in overfitting, interpretability and robustness in case of rapid market changes. To address these problems, this paper presents a new hybrid architecture VSF-Net (Variational Sequence Forecasting Network) by incorporating a Variational Autoencoder (VAE) for latent feature compression, a Transformer decoder with channel-wise attention for dynamic temporal learning, and Sharpness-Aware Minimization (SAM) optimizer to facilitate better generalization. The architecture is back-tested with historical data of the four top NASDAQ stocks, including AAPL, MSFT, AMZN and NVDA over both daily and monthly time spans. Pre-processing includes normalization and windowed segmentation, and is followed by extraction of learned latent features from raw data and attention-based sequence decoding. The effectiveness of the model is quantitatively compared with the state-of-the-art deep learning models including LSTM (long short term memory), GRU (gated recurrent unit), CNN-LSTM (convolutional neural network-long short term memory), Transformer and TSMixer. VSF-Net performs the best in all the evaluation metrics, with an R² of 0.921, RMSE of 12.45, MAE of 8.31, and MAPE of 4.2%. These results are highly significant relative to the next-best model and also verify the effectiveness and robustness of the proposed model in learning long-term memory dependencies and coping with noisy and complex market dynamics.