(RNN) emerged as a viable choice, albeit still
grappling with the issue of vanishing gradients. To
address this challenge, researchers introduced Long
Short-Term Memory (LSTM) networks, tailored
specifically for processing extended sequences
(Hochreiter and Schmidhuber 1997). A Long Short-
Term Memory Network (LSTM) model was
employed for predicting the trend of the Chinese
Shanghai and Shenzhen stock markets and was
successfully carried out by Chen et al (Chen et al 2015,
Li et al 2017 & Cho et al 2014). introduced additional
metrics, including variables related to investor
sentiment, when applying an LSTM model to predict
the performance of the CSI 1300 index. The results
show that the prediction accuracy of the model is
improved, which provides a new idea to improve the
traditional performance of LSTM.
To enhance the modeling and forecasting
capabilities of time series data and address time series
problems more effectively, the GRU model was
introduced and designed (Tesla Stock Data 2023).
Built upon the foundation of LSTM, GRU streamlines
the architecture, resulting in a reduction in parameters
and improved computational efficiency. The extensive
adoption of this model serves as evidence of its
outstanding performance.
The central objective of this paper revolves around
constructing an accurate and efficient model to predict
Tesla's stock price using GRU. To elaborate further,
first, historical stock price data are collected and
processed. Second, the GRU model is constructed and
trained on selected datasets, multiple evaluation
metrics are introduced in this study to improve the
model performance. Finally, the trained model is
subjected to stock market prediction and comparative
analysis by the researchers. The experimental results
clearly show that the model exhibits significant
performance advantages in stock price trend
prediction. This improvement is attributed to the GRU
model's ability to efficiently capture complex
correlations in time-series data, which improves the
accuracy and robustness of stock price forecasting.
This research is relevant and is expected to provide
more accurate stock price prediction tools to help
investors make informed decisions and reduce risks,
thereby stabilizing the financial market.
2 METHODOLOGY
2.1 Dataset Description and
Preprocessing
The Tesla stock market dataset (Tesla Stock Data
2023) from Kaggle contains 8813 data points with 7
variables (excluding the first ordinal feature). The
dataset consists of three parts. The first is a variable
named trading date: 1823 days of historical data from
20160 to 2021 are used. In the upcoming part,
attention will be focused on datasets containing stock
price details, encompassing Min, High, Opening, and
Closing prices, with all data consistently recorded on
the same day. The third stage involves two key
indicators in the stock market: the adjusted closing
price, which is usually used for the stock price after
taking into account factors such as dividends, stock
splits, and so on, and the day's trading volume, which
is the total turnover of the stock during the day.
Segmentation of the dataset is required to ensure
that having a separate dataset adequately evaluates
model performance when training and validating the
model. Specifically, to be more precise, the initial
dataset undergoes a division into two parts,
approximately 60% of the data is designated for
training purposes, leaving about 40% for testing. It is
worth noting that since each feature may have an
impact on the classification, there is no need to remove
any irrelevant data, which allows the model to learn
and make predictions taking all information into
account. Column names are renamed for ease of
subsequent code writing and reading: they are
uniformly changed to lowercase letters and column
names. The date field is normalized and converted to
date format and is Checked to delete the missing
values. This information is useful for data quality
assessment and data preprocessing.
2.2 Proposed Approach
This study aims to construct a stable, reliable, and
efficient forecasting model with the help of the GRU
model, which can be used to assist investors and
financial practitioners to better understand and
accurately predict stock market price movements.
Following the process in Fig. 1, first, historical stock
market price data are collected and preprocessed.
Second, the GRU model is constructed and the model
is trained using the training dataset. To streamline the
model architecture and mitigate the risk of overfitting,
the initial optimization approach is to restrict the
model's depth. Limiting the depth improves the
generalization ability. Or, using regularization