Regression and Classification Approaches to Microsoft Stock Forecasting with Machine Learning

Authors

  • Shuofeng Song Author

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.

Downloads

Published

2025-12-19

Issue

Section

Articles