Proceedings of the 2025 3rd International Conference on Image, Algorithms, and Artificial Intelligence (ICIAAI 2025)

Research on Stock Price Prediction Based on Random Forest & XGBoost

Authors
Zhengxuan Qian1, *
1Nottingham University Business School China, University of Nottingham, Ningbo, China
*Corresponding author. Email: biyzq11@nottingham.edu.cn
Corresponding Author
Zhengxuan Qian
Available Online 31 August 2025.
DOI
10.2991/978-94-6463-823-3_63How to use a DOI?
Keywords
Random Forest; XGBoost; Grid Search; Random Search
Abstract

This research focuses on stock price prediction using Random Forest and XGBoost, with the dataset of Microsoft (2020 - 2025) from Yahoo Finance. Given the complexity of accurately predicting stock price fluctuations, this study first aims to compare the performance of the two models in both regression and classification prediction without hyperparameter optimization. After that, the Grid Search and Random Search methods are applied to optimize the hyperparameters of the two models in regression prediction. MSE, RMSE, and MAE are selected for regression evaluation as they can measure the prediction errors, while AUC is used for classification to evaluate the model’s ability to distinguish different classes. After training and testing the models, the results show that, in regression prediction, Random Forest outperforms XGBoost both before and after optimization. However, there is no significant difference between the two in classification prediction. It is found that XGBoost is more sensitive to hyperparameter optimization, as its performance improved to a greater extent. The research indicates that choosing proper machine - learning models with reasonably optimized hyperparameters has certain potential in predicting stock prices and could provide a reference for investor’s decision - making.

Copyright
© 2025 The Author(s)
Open Access
Open Access This chapter is licensed under the terms of the Creative Commons Attribution-NonCommercial 4.0 International License (http://creativecommons.org/licenses/by-nc/4.0/), which permits any noncommercial use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license and indicate if changes were made.

Download article (PDF)

Volume Title
Proceedings of the 2025 3rd International Conference on Image, Algorithms, and Artificial Intelligence (ICIAAI 2025)
Series
Advances in Computer Science Research
Publication Date
31 August 2025
ISBN
978-94-6463-823-3
ISSN
2352-538X
DOI
10.2991/978-94-6463-823-3_63How to use a DOI?
Copyright
© 2025 The Author(s)
Open Access
Open Access This chapter is licensed under the terms of the Creative Commons Attribution-NonCommercial 4.0 International License (http://creativecommons.org/licenses/by-nc/4.0/), which permits any noncommercial use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license and indicate if changes were made.

Cite this article

TY  - CONF
AU  - Zhengxuan Qian
PY  - 2025
DA  - 2025/08/31
TI  - Research on Stock Price Prediction Based on Random Forest & XGBoost
BT  - Proceedings of the 2025 3rd International Conference on Image, Algorithms, and Artificial Intelligence (ICIAAI 2025)
PB  - Atlantis Press
SP  - 634
EP  - 642
SN  - 2352-538X
UR  - https://doi.org/10.2991/978-94-6463-823-3_63
DO  - 10.2991/978-94-6463-823-3_63
ID  - Qian2025
ER  -