The objective of this study is to introduce LSTM
to build a stock price prediction model and analyze the
amount of LSTM hidden units to determine the
optimal model for improving the capability of the
stock price forecasting model. To be more specific,
this study explores how different quantities of LSTM
hidden units affect the accuracy and performance of
stock market predictions. By systematically adjusting
the amount of hidden units in the applied LSTM
model, the author can observe the variations in
prediction results and identify the configuration that
yields the best outcomes. The practical significance of
this research lies in utilizing deep learning models,
particularly LSTM models, to analyze and predict
time series data such as stock prices, weather data, etc.
This provides valuable insights and predictions for
decision-making in fields such as finance and
meteorology. he unique aspect of the paper could be
its focus on the influence of the number of hidden
units in LSTM models on the accuracy of stock price
predictions. This is a crucial aspect, as the number of
hidden units is a key hyperparameter that determines
the complexity and capacity of the model. Given the
intricate factors influencing stock prices, a more
complex model might be necessary to encapsulate
these variables. However, an overly complex model
might overfit the training data, leading to subpar
performance on unseen data. Conversely, a model
with an insufficient number of hidden units could
underfit the data, unable to capture the necessary
patterns for accurate prediction.
In this context, the authors' exploration of the
selection of an appropriate number of hidden units and
the impact of varying numbers of hidden units on
prediction accuracy could provide valuable insights.
This differentiates the paper from other research
papers that might not specifically investigate the
influence of the number of hidden units on prediction
accuracy or might not utilize LSTM models for stock
price prediction.
2 METHODOLOGY
2.1 Dataset Description and
Preprocessing
In this study, the author employs the AAPL database
collected from Yahoo Finance (Dataset 2023). The
AAPL database is a compilation of historical market
data for Apple Inc.'s shares. With data spanning from
2016 to 2023, this database offers a wide range of
financial indicators, including Apple's stock's trading
volume, lowest price, highest price, closing price, and
opening price. The following parameters are included
in the AAPL database: Date: The trading session's date.
The opening price, which is the value of the day's first
deal. High: The price attained during the trading
session. Low: The price attained during the trading
session. Close: The closing price, which is the price of
the day's final trade. Adj Close: The adjusted closing
price, which takes stock splits and dividends into
account. Volume: The total number of shares
exchanged during the trading session is referred to as
volume.
2.2 Proposed Approach
The major goal of this study is to analyze and
investigate the data within the AAPL database. By
utilizing LSTM models, the goal is to predict stock
market trends to a certain degree of accuracy.
Furthermore, through comparative analysis, the study
aims to enhance the LSTM model's performance by
adjusting crucial parameters like units. Specifically,
first, the ‘Sequential’ model is used to create an
instance of a sequential model so that the author can
add layers sequentially to build a complete neural
network model. Second, by adding an LSTM layer,
which has units of 125 to the sequential model, the
model is enabled by the author to recognize temporal
dependencies and patterns in the input data. LSTM
layers are particularly effective in capturing long-term
dependencies and are commonly used in time series
analysis and sequence prediction tasks. Third, the
author applies additional non-linear changes to the
input by introducing a fully connected layer to the
sequential model, allowing the model to learn more
complicated representations and patterns. Fully
connected layers are commonly used in neural
networks to perform tasks such as classification or
regression. Then, by compiling the model with the
optimizer and loss function, respectively using
Adaptive Moment Estimation (Adam) model and
Mean Square Error (MSE) lose function, the author
defines how the model will be trained and how the
model's performance will be evaluated. The optimizer
determines how the model's weights will be updated,
and the loss function quantifies the error between
those true values and predicted values, which the
optimizer will minimize during training. The author
last gives a summary function of the LSTM model,
including the layers, output shapes, and the number of
parameters in each layer.
2.2.1 LSTM
LSTM is an advanced type of Recurrent Neural
Network (RNN) that has garnered significant
attention in various fields, including the realm of