3.2 Stock Evaluation and Prediction
It can be seen from (Figure 5) that the average error
of the test data is $228.87 and the average error of the
data predicted by the trained model is $52.24. This
means that the error generated by the trained model
has been greatly optimized. In addition, it can be seen
that the accuracy rate of predicting stock price
increases is 47.95% and the accuracy rate of
predicting stock price decreases is 38.27%.
Figure 5. The diagram of the prediction result
(Photo/Picture credit: Original).
4 DISCUSSION
It is not difficult to see that the overall accuracy of the
LSTM model is higher than the linear regression
model. This is evident from the accuracy provided in
predicting stock price increases and decreases. The
ability of LSTM models to capture nonlinear patterns
and dependencies in data likely contributes to their
accuracy. The RMSE of the LSTM model is 13.9676,
which falls in the range of 10 < RMSE < 20,
indicating that its performance is moderate. RMSE
measures the average error between predicted and
observed values. Lower RMSE means better model
performance. While the RMSE of the LSTM model
shows that it can provide useful predictions, the
modest performance indicates that there is still room
for improvement. This may involve fine-tuning
model hyperparameters, adjusting the network
architecture, or adding more features. The accuracy
of the linear regression model in predicting stock
price increases and decreases is 47.95% and 38.27%
respectively. These accuracy rates are lower relative
to the LSTM model. Linear regression models
assume a linear relationship between input features
and target variables, which may not fully capture the
complexity in stock price movements. In summary,
although the LSTM neural network model is better
than the linear regression model in accuracy, there are
opportunities for improvement and perfection in both
methods. Choosing a model may depend on the
specific requirements of the task, such as the trade-off
between interpretability and predictive accuracy, and
the computational resources available for training and
deployment.
5 CONCLUSION
Based on the comparison of machine learning models
for two different types of tasks, linear regression
model and LSTM neural network using Tesla stock,
this article concludes that each has some advantages
and disadvantages. In general, linear regression is
suitable for simple linear. For relational problems, the
model is simple and easy to understand, while LSTM
is suitable for processing complex nonlinear time
series data and has stronger modeling capabilities.
The choice of model to choose should be determined
by the nature of the specific problem and the type of
data. Using linear regression and LSTM for
predicting stock market trends involves the analysis
of historical stock data. Linear regression, although
straightforward, may not capture the complex
patterns inherent in stock data. LSTM, a type of
recurrent neural network, is better suited for time-
series data like stock prices, as it can remember and
leverage long-term dependencies. However, there are
still some research limitations like market volatility
(both models may struggle in the face of
unpredictable market behavior), data quality (the
accuracy of predictions heavily relies on the quality
and completeness of the historical data used),
overfitting (especially with LSTM, there is a risk of
overfitting to historical data, which can reduce its
effectiveness in forecasting future trends).
For future research directions, there are hybrid
models (investigating the combination of linear
regression with LSTM or other machine learning
techniques to create more robust prediction models),
feature engineering (experimenting with various
input features, such as economic indicators or social
media sentiments, to enhance the prediction
accuracy.), real-time analysis (Incorporating real-
time data streams for more current and relevant
predictions), algorithmic improvements
(continuously refining and adapting algorithms to
better suit changing market conditions).