3.3 Comparative Results
To assess the effectiveness of the models, we
compare the performance of the linear regression
model and the random forest model in predicting the
closing price of Google Inc. We use three different
evaluation metrics to measure the final minimisation
error of the predicted price. Table 4 shows the results
of the comparative analysis obtained using the linear
regression model and the random forest model.
Table 4: Comparative analysis of the model evaluation.
Linear Regression Random Forest
RMSE 2.346 2.771
MSE 5.505 7.676
MAE 1.716 2.142
The result shows that the RMSE of Linear
Regression is 2.346 and the RMSE of Random Forest
is 2.771. The MSE of Linear Regression is 5.505 and
the MSE of Random Forest is 7.676. The MAE of
Linear Regression is 1.716 and the MAE of Random
Forest is 2.142. Based on the evaluation metrics, it
can be observed that the Linear Regression model
shows better prediction results for stock prices
compared to the Random Forest model. This is
because the values of evaluation metrics for Linear
Regression are all lower than those of Random Forest.
3.4 Discussion
Although it is difficult to predict the closing price of
a stock, it is possible to increase the precision of the
forecast and improve the forecasting efficiency with
the aid of machine learning. In order to predict the
closing price of Google's stock, this study took the
closing price of Google's stock in the previous seven
days as the independent variable and finally obtained
that the closing price of Google's stock will have a
stable and continuous upward trend. By comparing
with the real trend of the closing price of Google's
stock, it can be found that the two algorithmic models
used in this study predicted the results very close to
the real stock trend. The efficiency and high accuracy
of the two algorithmic models demonstrate that both
the linear regression model and the random forest
model are efficient deep learning models that can be
used to predict stock prices.
The linear regression model has a better
performance than the random forest model in the
comparison based on the three evaluation metrics of
RMSE, MSE and MAE, which may be due to several
factors. Firstly, the dataset of this experiment is small
and the linear regression model is likely to converge
more quickly and get better results, since it is not
necessary to build a lot of decision trees; Secondly,
the random forest model is an integrated learning
method, but it also brings an increase in computation.
Therefore, it is better to use linear regression model
when the computational power is limited; in addition
to that, if there is a certain linear relationship between
the characteristics of the data and the target variables,
linear regression usually provides more concise and
easy-to-interpret results. Although the results of this
study do not show that the linear regression model is
a more efficient deep learning model than the random
forest model, but we can know that the linear
regression model may be a better choice in the above
cases.
4 CONCLUSION
Although predicting stock prices is not an easy task,
machine learning techniques have facilitated the field
of stock price prediction nowadays. The aim of this
paper is to test the effectiveness of machine learning
algorithmic models in predicting stocks, while
comparing the efficiency of two different machine
learning algorithmic models.
First of all, this study uses the stock price
information of Google Inc. in the past five years
provided by Kaggle website, and predicts the closing
price of Google Inc. stock using linear regression
model and random forest model respectively, and the
consequences show that both machine learning
algorithmic models have good prediction results,
which are very close to the real results.
In addition to this, this study also compared the
efficiency of the two machine algorithm models using
three evaluation metrics, and the results revealed that
the linear regression model outperformed the random
forest model in certain circumstances, specifically.
For future work, more machine learning
algorithms can also be included at the same time for
comparison in addition to the two methods mentioned
above. It is believed that deeper learning of machine
learning algorithmic models can lead to better results
in the future in the field of stock prediction.
REFERENCES
M. Vijh, D. Chandola, V. A. Tikkiwal, A. Kumar, Procedia
comp. sci., 167, 599-606 (2020)
X. Su, X. Yan, C. L. Tsai, Wiley Interdisciplinary Reviews:
Comp. Stat., 4(3), 275-294 (2012)