An Empirical Study Based on Machine Learning and LSTM in Stock Prediction

Authors

  • Zhongyu Wang

DOI:

https://doi.org/10.61173/yhe54f71

Keywords:

LSTM, stock prediction, Machine Learning

Abstract

This research aims to make a comprehensive comparative analysis between traditional machine learning methods and Long Short-Term Memory networks (LSTMs) towards stock return predictions. By using the full Kaggle market data set (the Stock Price Prediction Challenge), we managed to generate an integrated forecasting pipeline for stock prediction. In this data set, we used 45 stocks and three major indexes to engineer extensive features and a strong model validation. After considering all factors, Gradient Boosting, outperforming both traditional methods and LSTM, achieves the greatest training performance: Mean Squared Error (MSE) of 0.000135, R2 of 0.027195, and mean absolute percentage error (MAPE) of 155.85%. Contrary to the initial assumption, all models exhibited severe overfitting. A significant performance drop on the validation set suggests a major challenge in practical prediction use. The findings indicate that while the models do not provide practically useful, accurate return predictions based solely on price information, they do provide strong comparison benchmarks and methodological suggestions in future studies involving other data and stronger regularisation approaches.

References

[1] Bollerslev T. Generalized autoregressive conditional heteroskedasticity. Journal of Econometrics, 1986, 31(3): 307– 327.

[2] Breiman L. Random forests. Machine Learning, 2001, 45(1): 5–32.

[3] Friedman J H. Greedy function approximation: A gradient boosting machine. Annals of Statistics, 2001, 29(5): 1189–1232.

[4] Hochreiter S, Schmidhuber J. Long short-term memory. Neural Computation, 1997, 9(8): 1735–1780.

[5] Fischer T, Krauss C. Deep learning with long short-term memory networks for financial market predictions. European Journal of Operational Research, 2018, 270(2): 654–669.

[6] Qiu J, Wang B, Zhou C. Forecasting stock prices with long-short term memory neural network based on attention mechanism. PLOS ONE, 2016, 15(1): e0227222.

[7] Manaenkov N. Stock Price Prediction Challenge. Kaggle, 2025. Kaggle. https://kaggle.com/competitions/stock-priceprediction-challenge

Downloads

Published

2025-12-19