Using Decision Tree Regression and Related Companies’ Stock Data to Predict Microsoft Stock Returns

Authors

  • Zachary Tong Wheeler High School

DOI:

https://doi.org/10.47611/jsrhs.v13i1.6070

Keywords:

Machine Learning, Stock Prediction, Decision Tree Regression, Microsoft, Stock Returns

Abstract

Using AI machine learning (ML) models to predict stocks is a topic that has already been studied by the stock market research community. However, two ML methods have not been analyzed in the current literature regarding stock prediction: the decision tree regression analysis and the related company training data approach. Thus, this study will utilize both of these unfamiliar stock prediction methods to predict Microsoft’s stock returns. To begin with, the company data of Microsoft's biggest partners and competitors were imported from YahooFinance; this data was then used to form all the features for the stock prediction model (mean, standard deviation, price gaps, etc.). Next, the machine learning model was created using Python's Decision Tree Regressor method; the model was trained using data before 10/1/2001 and tested using data after 10/1/2001. Through repeatedly testing this model, hyperparameter tuning was performed to determine the model's best features and max depth for predicting Microsoft’s stock returns. In the end, the final prediction model reached a percentage accuracy (percentage of times correctly predicting stock return's direction) of 56.68%, and the plot (net returns using model vs. historical net returns) showed that model use resulted in more consistent and significantly higher net Microsoft stock returns. Therefore, this study demonstrated that both the Decision Tree Regressor and the related company training data approach are successful machine learning methods in predicting Microsoft's stock returns. However, further research is required to extend this study's results to other companies and/or different stock metrics.

Downloads

Download data is not yet available.

References or Bibliography

Abe, M., & Nakayama, H. (2018). Deep learning for forecasting stock returns in the cross-section. Advances in Knowledge Discovery and Data Mining, 273-284. https://doi.org/10.1007/978-3-319-93034-3_22

AnkanDas22. (2023, January 11). Python | decision tree regression using sklearn. Geeks for Geeks. https://www.geeksforgeeks.org/python-decision-tree-regression-using-sklearn/#

Asness, C. S., Porter, R. B., & Stevens, R. L. (2000). Predicting stock returns using industry-relative firm characteristics. SSRN Electronic Journal. https://doi.org/10.2139/ssrn.213872

Balvers, R. J., Cosimano, T. F., & McDonald, B. (1990). Predicting stock returns in an efficient market. The Journal of Finance, 45(4), 1109-1128. https://doi.org/10.1111/j.1540-6261.1990.tb02429.x

Biswas, M., Shome, A., Islam, M. A., Nova, A. J., & Ahmed, S. (n.d.). Predicting stock market price: A logical strategy using deep learning. Institute of Electrical and Electronics Engineers. https://doi.org/10.1109/iscaie51753.2021.9431817

Carta, S., Corriga, A., Ferreira, A., Podda, A. S., & Recupero, D. R. (2020). A multi-layer and multi-ensemble stock trader using deep learning and deep reinforcement learning. Applied Intelligence, 51(2), 889-905. https://doi.org/10.1007/s10489-020-01839-5

Harper, D. R. (2022, July 22). Forces that move stock prices (T. Brock & K. R. Schmitt, Ed.). Investopedia. https://www.investopedia.com/articles/basics/04/100804.asp#:~:text=Company%20stocks%20tend%20to%20track%20with%20the%20market,individual%20performance%E2%80%94determines%20a%20majority%20of%20a%20stock%27s%20movement.

Investor Express. (2023, September 26). Microsoft: 5 reasons why the stock is a strong buy. https://seekingalpha.com/article/4637510-microsoft-5-reasons-why-the-stock-is-a-strong-buy

Karim, R., Alam, K., & Hossain, R. (2021, August 10). Stock market analysis using linear regression and decision tree regression [Paper presentation]. 2021 1st International Conference on Emerging Smart Technologies and Applications, Lebanese International University, Sana'a, Yemen. https://ieeexplore.ieee.org/abstract/document/9515762

Khan, W., Ghazanfar, M. A., Azam, M. A., Karami, A., Alyoubi, K. H., & Alfakeeh, A. S. (2020). Stock market prediction using machine learning classifiers and social media news. Journal of Ambient Intelligence and Humanized Computing, 13(7), 3433-3456. https://doi.org/10.1007/s12652-020-01839-w

Khan, W., Malik, U., Ghazanfar, M. A., Azam, M. A., Alyoubi, K. H., & Alfakeeh, A. S. (2019). Predicting stock market trends using machine learning algorithms via public sentiment and political situation analysis. Soft Computing, 24(15), 11019-11043. https://doi.org/10.1007/s00500-019-04347-y

Koukaras, P., Nousi, C., & Tjortjis, C. (2022). Stock market prediction using microblogging sentiment analysis and machine learning. Telecom, 3(2), 358-378. https://doi.org/10.3390/telecom3020019

Kumar, L., Pandey, A., Srivastava, S., & Darbari, M. (2011). A hybrid machine learning system for stock market forecasting. Journal of International Technology and Information Management, 20(1). https://doi.org/10.58729/1941-6679.1099

Piepenbreier, N. (2022, June 3). How to add titles to matplotlib: Title, subtitle, axis titles. Datagy. Retrieved October 7, 2023, from https://datagy.io/matplotlib-title/

Sheth, D., & Shah, M. (2023). Predicting stock market using machine learning: Best and accurate way to know future stock prices. International Journal of System Assurance Engineering and Management, 14(1), 1-18. https://doi.org/10.1007/s13198-022-01811-1

Umer, M., Awais, M., & Muzammul, M. (2019). Stock market prediction using machine learning(ml)algorithms. ADCAIJ: Advances in Distributed Computing and Artificial Intelligence Journal, 8(4), 97-116. https://doi.org/10.14201/adcaij20198497116

Vu, T. T., Chang, S., Ha, Q. T., & Collier, N. (2012, December). An experiment in integrating sentiment features for tech stock prediction in twitter. In Proceedings of the workshop on information extraction and entity analytics on social media data (pp. 23-38). https://aclanthology.org/W12-5503.pdf

Published

02-28-2024

How to Cite

Tong, Z. (2024). Using Decision Tree Regression and Related Companies’ Stock Data to Predict Microsoft Stock Returns. Journal of Student Research, 13(1). https://doi.org/10.47611/jsrhs.v13i1.6070

Issue

Section

HS Research Articles