Time Series Forecasting for Stock Market Prediction Using Two-Layer Stacked Long Short-Term Memory Network
摘要
The application of sequence learning models for forecasting stock market prices has attracted a lot of attention from academia and industry alike. This paper investigates the capability of stacked Long Short-Term Memory (LSTM) neural networks to model and forecast time series data pertaining to financial stock markets. Stacking multiple LSTM layers enables hierarchical feature representation and learning, with model parameters distributed over a wider space than with a single layer. Broadly, we experiment with different configurations of LSTMs, including stacked LSTMs and bidirectional LSTMs (BiLSTMs), with and without attention mechanisms, in order to determine the optimal LSTM network configuration for accurate stock market prediction. Experiments on scraped data from Apple stocks, in the duration of 1 January 2018 to 30 September 2024, reveal that the two-layer stacked LSTM model achieves the best prediction, outperforming the traditional Autoregressive Integrated Moving Average (ARIMA) and Facebook (FB) Prophet time series forecasting models, in terms of four different performance indices (mean square error (MSE): 11.428; root mean square error (RMSE): 3.380; mean absolute error (MAE): 2.574; mean absolute percentage error (MAPE): 0.014).