Regression and Classification Approaches to Microsoft Stock Forecasting with Machine Learning

Authors

  • Shuofeng Song

DOI:

https://doi.org/10.61173/tw4evb20

Keywords:

Stock Price Prediction, Machine Learning, Regression Models, Ensemble Learning, Microsoft Stock

Abstract

This study discusses the application of machine learning algorithms for the prediction of Microsoft stock prices using historical data for five years. Preprocess of the data was done by treating missing values, creating lag features, and normalizing the data for better model performance. To the price of close and momentum, various models were trained, including Linear Regression, Decision Tree, Random Forest, Support Vector Regression, and Gradient Boosting Regressor. Based on the experimental results, Linear Regression achieved the best performance in closing price prediction, recording a Coefficient of Determination (R²) of 0.91, Mean Squared Error (MSE) of 45.77, Mean Absolute Error (MAE) of 4.64, and Mean Absolute Percentage Error (MAPE) of 0.01. For momentum prediction, Linear Regression again outperformed other models, achieving R² = 0.51, MSE = 21.25, MAE = 2.79, and MAPE = 2.05. And other models showed much weaker explanatory power. When predicting the Relative Strength Index (RSI) classification, Gradient Boosting delivered the best overall performance, achieving Accuracy = 1.00, F1 score = 1.00, Cross-Validation (CV) mean accuracy = 0.998, and CV standard deviation (CV std) = 0.02. Although other models such as Linear Regression, Logistic Regression, Support Vector Classifier, and Random Forest achieved strong results, none matched the superior performance of Gradient Boosting.

References

[1] Albert W, Juan F, Raheem A, et al. Forecasting of stock prices using machine learning models. IEEE Systems Conference, 2023, 20(15): 1–7.

[2] Albert W, Steven W, Emilio S, et al. Short-term stock price forecasting using exogenous variables and machine learning algorithms. 3rd International Conference on Intelligent Cybernetics Technology & Applications (ICICyTA), 2023, 56(19): 260–265.

[3] Wen Q Y, You W, Zhang S F, Chang E C, et al. Stock price analysis and forecasting based on machine learning. Conference on Computer Science and Communication Technology, 2022, 29(12): 1250660–1250668.

[4] Archit A V, Paresh J T. A survey of machine learning techniques used on Indian stock market. IOP Conference Series: Materials Science and Engineering, 2021, 36(10): 236–239.

[5] Gaur S, Bhardwaj R, Bansal V, et al. Stock market prediction using machine learning. International Journal of Scientific Research in Computer Science Engineering and Information Technology, 2019.

[6] Huang Y, Capretz L F, Ho D. Machine learning for stock prediction based on fundamental analysis. IEEE Symposium Series on Computational Intelligence, 2021: 1–10.

[7] Kompella S, Chilukuri K C. Stock market prediction using machine learning methods. International Journal of Computer Engineering & Technology, 2019.

[8] Obthong M, Tantisantiwong N, Jeamwatthanachai W, et al. A survey on machine learning for stock price prediction: algorithms and techniques. International Conference on Finance, Economics, Management and IT Business, 2020: 63–71.

[9] Zhang P, Yang J Y, Zhu H, et al. Failure in stock price prediction: a comparison between the curve-shape-feature and non-curve-shape-feature modes of existing machine learning algorithms. International Journal of Computers Communications & Control, 2021, 16.

[10] Wei Z, Chen Y, Gao M, et al. Stock prediction methods based on ensemble learning. Academic Journal of Business & Management, 2021.

[11] Fatima S. Microsoft stock price data (last 5 years). Published 2023-07-19. Accessed 2025-09-16.

Downloads

Published

2025-12-19