Probabilistic LSTM Modeling For Stock Price Prediction With Monte Carlo Dropout Long Short-Term Memory Network
Probabilistic LSTM Modeling For Stock Price Prediction With Monte Carlo Dropout Long Short-Term Memory Network
Probabilistic LSTM Modeling For Stock Price Prediction With Monte Carlo Dropout Long Short-Term Memory Network
ISSN No:-2456-2165
Abstract:- Investors and financial professionals in today's feature extraction methods [8]. Deep learning algorithms have
dynamic stock markets attach great significance to precise emerged as attractive option among these methods since they
forecasts of stock returns. This emphasis is not only on are adaptable and produce a high accuracy level [28], [24],
accurate forecasting models but also their reliability. While [11], [22], [8], [2]. However, most machine learning
conventional machine learning models can predict algorithms rely on point estimates, providing a single
nonlinear datasets with high accuracy, they often overlook prediction without considering uncertainty. This can lead to a
uncertainties in their predictions, leading to unreliable lack of transparency and potentially misleading results. Many
outcomes. This study employed the Bayesian LSTM (Long researchers have attempted to develop an accurate stock price
Short-Term Memory) model for stock price prediction and forecasting method from linear to nonlinear models and
examined its performance with that of the conventional diverse machine learning algorithms. However, the concept of
LSTM model. The findings revealed that the Bayesian more resilient techniques continue to emerge. Utilizing the
LSTM model produces better results than the conventional Auto-regressive Integrated Moving Average (ARIMA) model
LSTM model considering the 𝑹𝟐 (R-squared), MAPE to forecast the prices of stocks on the New York Stock
(Mean Absolute Percentage Error), and RMSE (Root Exchange (NYSE) and National Stock Exchange (NSE), [1]
Mean Squared Error) values. The Bayesian LSTM model discovered promising results for short-term forecasting.
acknowledged the presence of inherent uncertainty in the Advanced machine learning and deep learning strategies for
underlying data and refrained from exhibiting excessive stock price forecasting were proposed by [27]. Their results
confidence in its predictions, having a confidence level of demonstrated that a deep learning LSTM network combined
48.67% in predicting the S&P 500 data for the study. This with high gradient boosting performs better than the
study provides a more reliable approach for stock price traditional ARIMA approach. [26] employed various machine
prediction to help investors and financial professionals learning techniques and conventional statistical methodologies
make informed decisions. to forecast Karachi Stock Exchange (KSE) market
performance. According to their findings, the multilayer
Keywords:- Bayesian LSTM Model; Monte Carlo Dropout; perceptron (MLP) algorithm outperforms the benchmark
Stock Price Prediction; LSTM Model; Machine Learning. methods. In a study by [17], different forecasting models were
compared, and it was discovered that the convolutional neural
I. INTRODUCTION network-Long Short-Term Memory (CNN-LSTM) approach
achieved the highest prediction accuracy for stock prices. [7]
Investors and financial professionals today place high addressed the challenge of stock price forecasting in dynamic
importance on accurate stock return forecasts in the ever- situations by proposing an LSTM-based model, which
changing world of stock markets. This results from the stock achieved good accuracy with low error rates when trained on a
prices' patterns being nonlinear and volatile [2]. One of the sizable dataset. In a recent study by [4], the LSTM model was
most crucial institutions in any economy is the stock market used to predict the next day closing price of the S&P 500
[8]. Therefore, it is essential to design a reliable model that index. Their findings indicate that a single-layer LSTM model
can capture the nonlinear nature and produce credible outperforms multilayer LSTM models, offering a better fit and
accuracy. To forecast stock prices, researchers have explored a higher prediction accuracy for the task. [20] also employed the
variety of statistical models [1], [12], [23], [19], but their transformer model to forecast the future stock prices on the
accuracy cannot be compared to machine learning techniques Dhaka Stock Exchange (DSE), the prominent stock exchange
[14], [21]. This is because machine learning can better capture in Bangladesh. The transformer algorithm exhibited strong
nonlinear patterns and produce accurate results [13]. Machine performance with promising accuracy, surpassing the ARIMA
learning techniques for stock prediction have recently attracted model's forecasting capabilities from the study's findings.
a lot of interest to improve their performance through various
The Price dynamics of the data for this study (S&P 500)
are shown in Figure 1. Even though there are dynamics in the
price movement, there is evidence of an increasing trend, as
indicated by the Mann-Kendall test in Table 1.
Table 2 shows the Bayesian LSTM model and predictions. Additionally, Figure 5 displays the forecast's
conventional LSTM models' performance metrics. From the posterior probability distribution, which indicates that the
table, the Bayesian LSTM model offers a better performance model assigns higher probability to the prices that fall between
with a lower MAPE (0.0097), RMSE (47.82), and a higher 𝑅2 $ 4,200 and $ 4,800. The broad tail on the left of the posterior
(0.9594) compared to the LSTM model with MAPE (0.0154), probability distribution graph suggests a larger span of
RMSE (80.00) and 𝑅2 (0.8865). These results indicate that the potential outcomes for lower stock prices. This indicates that
Bayesian LSTM model provides more accurate and reliable accurately forecasting these lower values poses more
predictions, capturing a higher percentage of the variance in difficulties for the model. This characteristic of the Bayesian
the target variable, which is also evident in the residual plot LSTM model proves advantageous, especially in scenarios
shown in Figure 4. involving significant fluctuations or volatility in the data. It
enables decision-makers to consider various potential
Table 2 Performance Metrics outcomes, enhancing their ability to make informed choices.
MODEL MAPE 𝑹𝟐 RMSE
LSTM 0.0154 0.8865 80.00
BAYESIAN
0.0097 0.9594 47.82
LSTM
The Actual and the predicted plot of the two models are
shown in Figure 2, indicating the model's performance in
predicting the S&P 500. In Figure 2, both models seem to
capture the dynamic nature of the S&P 500 prices. However,
the Bayesian LSTM model captured the nonlinear nature of
the S&P 500 data for the study period's test set. With the
Bayesian LSTM model demonstrating high prediction
accuracy, the uncertainty inclusion provides valuable
information, as depicted in Figure 3. The figure illustrates how
the model acknowledges the presence of inherent uncertainty
in the underlying data and avoids excessive confidence in its
Fig 3. The Bayesian LSTM prediction with Uncertainty. Fig 5. Posterior Probability distribution of the Prediction with
uncertainty
B. Discussion.
The study's outcomes suggest that the proposed
probabilistic LSTM model incorporating Monte Carlo dropout
demonstrates promising performance in forecasting stock
prices. By introducing uncertainty through dropout during
training, the model becomes better suited to address the
inherent unpredictability of financial markets. The model's
capability to provide probabilistic predictions is particularly
valuable for decision-makers, enabling them to grasp the range
of potential outcomes and make well-informed choices. These
findings align with existing literature such as [6], [5], [10], and
[3] on the advantages of probabilistic modeling for prediction
compared to traditional deterministic methods. The adoption
of Monte Carlo dropout in LSTM networks has been effective
in capturing uncertainty, consistent with other studies that