Assessing Machine Learning's Accuracy in Stock Price Prediction


  • Aryan Bhatta Premier International School, Kathmandu, Nepal
  • Pranshu Poudyal Premier International School, Kathmandu, Nepal
  • Drishant Kumar Maharjan Premier International School, Kathmandu, Nepal
  • Aryaa Thapa Premier International School, Kathmandu, Nepal, Lancers International School, Gurgaon, India


Machine Learning, Stock Price Prediction, Linear Regression, Random Forest K Nearest Neighbor (KNN), Mean Squared Error (MSE), Financial Industry


This research examines how well machine learning models can predict the closing price of traded stocks. The financial industry has seen an increase, in the use of these models due to the availability of datasets and technological advancements. The study compares machine learning models such as Linear Regression, Random Forest and K Nearest Neighbor (KNN) to determine which ones are the accurate predictors and what factors contribute to their effectiveness. To gain insights into model performance a diverse dataset consisting of five stocks from sectors is used. Data analysis and modeling are conducted using Python programming language with libraries, like Pandas, NumPy, Matplotlib and Scikit learn. The performance evaluation metric utilized is Mean Squared Error (MSE). The research findings have the potential to assist investors and traders in making decisions while also contributing to the growth of the financial industry.


“2.1 Introduction to Linear Regression - Module 2: Fundamental Algorithms I,” Coursera.

P. Agarwal, “Machine Learning For Prognosis of Life Expectancy and Diseases,” VOLUME-8 ISSUE-10, AUGUST 2019, REGULAR ISSUE, vol. 8, no. 10, pp. 1765–1771, Aug. 2019, doi:

“Calculate Mean Squared Error using TensorFlow 2,”, Oct. 24, 2020. (accessed Mar. 13, 2023).

Y. Choudhary, “Linear Regression Implementation in Python,” Linear Regression Implementation in Python, Jun. 07, 2017. (accessed Mar. 14, 2023).

JavaTpoint, “K-Nearest Neighbor(KNN) Algorithm for Machine Learning - Javatpoint,”, 2021.

HKT Consultant, “Multiple Coefficient of Determination in Multiple Regression,” HKT Consultant, Aug. 31, 2021. (accessed Mar. 18, 2023).

I. Inada, “Comprehensive Guide on Root Mean Squared Error (RMSE),” Aug. 12, 2023. (accessed Mar. 18, 2023).

MLTut, “Multiple Linear Regression: Everything You Need to Know About,” MLTut, May 19, 2020. (accessed Mar. 16, 2023).

O. Altay, Performance of different KNN models in prediction english language readability. IEEE, 2022, pp. 1–5. doi:

Rishab Mamgai et al., “Stock prediction & recommendation system using KNN and linear regression,” Nucleation and Atmospheric Aerosols, Jan. 2022, doi:

R. Ruhal and E. Prashar, A Comparative Study Of Statistical Methods And Machine Learning Approaches For Stock Price Prediction. 2023. doi:

Yahoo Finance, “Yahoo Finance - Business Finance, Stock Market, Quotes, News,” Yahoo Finance, 2023.




How to Cite

Bhatta, A., Pranshu Poudyal, Drishant Kumar Maharjan, & Aryaa Thapa. (2023). Assessing Machine Learning’s Accuracy in Stock Price Prediction. International Journal of Computer (IJC), 49(1), 46–63. Retrieved from