OPTIMASI NILAI K PADA KNN DENGAN INTEGRASI SIMULATED ANNEALING DAN HILL CLIMBING UNTUK PREDIKSI HARGA RUMAH - Rudy Cahyadi; Ariesta Damayanti (Rabit : Jurnal Teknologi dan Sistem Informasi Univrab, 2025)
The K-Nearest Neighbors (KNN) algorithm is a widely adopted method for classification and regression due to its straightforward implementation. However, KNN’s performance is heavily influenced by the choice of the parameter k (the number of nearest neighbors), where a non-optimal k value may lead to overfitting or underfitting. To address this challenge, this study proposes an optimization approach for the k parameter using two local search algorithms: Simulated Annealing (SA) and Hill Climbing (HC). The dataset utilized is the Real Estate Dataset from Kaggle, which contains housing characteristics, with the prediction target being MEDV (Median Value of Owner-Occupied Homes). This research compares the performance of standard KNN, KNN optimized with SA, and KNN optimized with HC. Model evaluation is conducted using the Root Mean Square Error (RMSE) metric. Experimental results demonstrate that both SA and HC significantly enhance prediction accuracy compared to standard KNN. SA excels in exploring the solution space and avoiding local optima, while HC offers faster convergence. The findings reveal that KNN with the optimal k achieves an RMSE of 3.3159 with k=2. The integration of both methods demonstrates potential for determining a more optimal and stable k value across various regression datasets.