Comparative Analysis of Traditional Machine Learning Models (SVM, KNN, and Linear Regression) for KSE 100 Stock Price Forecasting - Febriansyah, Aldin; Ervin Yohannes (Universitas Negeri Surabaya, 2025)
Abstract—The erratic volatility of stock prices presents a significant challenge for analysts and investors when making informed investment decisions. Although the Efficient Market Hypothesis suggests that price prediction is theoretically impossible, numerous studies indicate that predictive models can yield high-quality results. This research compares the effectiveness of three traditional machine learning algorithms—Support Vector Machine (SVM), K-Nearest Neighbors (KNN), and Linear Regression (LR)—in forecasting the daily stock prices of the KSE 100 Index from the Pakistan Stock Exchange (PSX). The study utilized 3,221 daily closing prices recorded between February 22, 2008, and February 23, 2021. The models were implemented in Python and optimized through hyperparameter tuning using GridSearchCV. To ensure robust evaluation, five distinct data-splitting techniques were employed: a chronological split of 2020 and proportional splits of 80:20, 75:25, and 70:30. Performance was measured using MSE, RMSE, MAE, MAPE, and Accuracy metrics. The findings reveal that Linear Regression (LR) consistently delivered the best and most stable performance across all testing schemes. LR achieved its highest accuracy of 97.9% and lowest error (MSE 0.000404) in the 70:30 split, while maintaining a 97.3% accuracy in the 2020 test data. In contrast, KNN was the most sensitive model, with accuracy dropping to 92.2% in the 30% test scheme. These results underscore that LR is the most accurate and dependable option for stock price time-series prediction among these traditional models, proving that simpler models can remain highly competitive. Keywords— Stock Price Forecasting, Machine Learning, Linear Regression (LR), Support Vector Machine (SVM), K-Nearest Neighbors (KNN).