Author: Fung Yee Tang
Supervisor: Julia Neidhardt
Abstract
For many years, stock price prediction has been a challenging task due to market volatility and the complex, nonlinear factors that influence financial markets. While traditional methods such as fundamental and technical analysis are widely used, they often fail to capture the intricate patterns in modern financial data. Although advanced variants of Recurrent Neural Networks (RNNs) and ensemble learning methods have shown promise individually, limited research has examined their combined potential for stock price prediction.This master’s thesis develops and evaluates RNN-based ensemble learning models for daily stock price prediction, specifically Long Short-Term Memory (LSTM) and Gated Recurrent Unit (GRU) architectures. The approach systematically determines the optimal lookback window sizes, performs comprehensive hyperparameter tuning, and employs simple averaging of predictions from different models as an ensemble method. Model performance is evaluated using R-squared metrics, Mean Squared Error (MSE) and Mean Absolute Error (MAE).The findings reveal distinct behavioral patterns across different RNN architectures regarding temporal dependencies. LSTM models achieve optimal performance with short lookback window sizes (L = 1–2), whereas GRU models perform best with longer lookback window sizes, reaching the lowest scaled MAE of 0.0271 at L = 59 in the manually tuned configuration. Hybrid LSTM-GRU and 1D-CNN-GRU models did not provide additional predictive advantages over pure GRU architectures. Initially, ensemble models comprising single RNN variants showed decreased performance compared to individual models, while those with two variants exhibited only marginal reductions.All ensemble models consistently outperformed linear regression baselines, highlighting the superiority of RNN-based approaches in capturing the temporal dependencies and nonlinear dynamics of financial time series data. Additionally, a time lag was observed between the predicted and actual stock prices.Therefore, an offline experiment using Empirical Mode Decomposition (EMD) was incorporated to compensate for the time lag. This mitigated the temporal lag in the RNN-based models and significantly reduced its impact. With this enhancement, all ensemble configurations in the offline experiment surpassed the optimal performance of the manually tuned GRU model. However, the offline method uses the whole dataset, including the future stock prices. Thus, in its current form, it is not appropriate for real forecasting. Instead, it demonstrates potential for improved prediction and may be used for subsequent correction when applying the EMD method. The results show that RNN-based ensemble models, especially when combined with techniques to reduce temporal lag, perform significantly better than traditional linear methods for predicting stock prices. This points to a promising path for future financial forecasting research.
