Comparative Analysis of K-Nearest Neighbors Algorithm and Random Forest Regressor for House Price Prediction in Bandung City
DOI:
https://doi.org/10.30871/jaic.v10i1.10718Keywords:
KNN Regressor, Random Forest Regressor, House Price Prediction, Machine Learning, Real Estate Valution, BandungAbstract
The rapid population growth and continuous urban expansion in Bandung have contributed to volatile and escalating housing prices, creating significant challenges for market transparency and affordability. This study aims to develop and evaluate machine-learning models to predict house prices in the Bandung region using a publicly available dataset consisting of 7,609 property records. Following the CRISP-DM methodology, the research includes data exploration, preprocessing (outlier handling using IQR, one-hot encoding, and feature standardization), model training, and performance evaluation. Two regression models K-Nearest Neighbors (KNN) Regressor and Random Forest (RF) Regressor—were compared through systematic hyperparameter tuning using Grid Search and Random Search techniques. The experimental results show that the Random Forest Regressor achieves the best performance with an R² score of 0.7838 and a mean absolute error (MAE) of approximately Rp 399.7 million, outperforming the optimized KNN model. Feature importance analysis also indicates that land area, building area, and location are the most influential predictors of property prices. The findings highlight the effectiveness of ensemble methods in handling complex real-estate data and demonstrate the potential of machine-learning-based predictive tools to support buyers, sellers, and policymakers in making informed and data-driven decisions in the Bandung housing market.
Downloads
References
[1] E. S. Lestari and I. Astuti, “Penerapan Random Forest Regression Untuk Memprediksi Harga Jual Rumah Dan Cosine Similarity Untuk Rekomendasi Rumah Pada Provinsi Jawa Barat,” J. Ilm. FIFO, vol. 14, no. 2, p. 131, 2022, doi: 10.22441/fifo.2022.v14i2.003.
[2] Savitri, N. F., and Nasrudin, N. (2023, November). Peramalan indeks harga properti residensial di kota Bandung tahun 2023. Jurnal Kebijakan Pembangunan Daerah, 7(2), 140–157.
[3] L. Somantri, "Land Price Mapping in the Northern Suburbs of Bandung City West Java Province Indonesia," Forum Geografi, vol. 34, no. 1, pp. 26-40, Jul. 2020, doi: 10.23917/forgeo.v34i1.10412
[4] R. Khoirudin and M. L. A. Kurniawan, "A time-varying of property residential price in Indonesia: a VAR approach," Jurnal Ekonomi & Studi Pembangunan, vol. 24, no. 1, Apr. 2023
[5] E. Fitri, “Analisis Perbandingan Metode Regresi Linier, Random Forest Regression dan Gradient Boosted Trees Regression Method untuk Prediksi Harga Rumah,” J. Appl. Comput. Sci. Technol., vol. 4, no. 1, pp. 58–64, 2023, doi: 10.52158/jacost.v4i1.491.
[6] F. Hidayah, S. J. Angesti, and Y. P. Widyastuti, “Prediksi Harga Rumah di Boston Menggunakan Metode Linear Regression, SVR, Decision Tree dan Random Forest Regression,” pp. 1–9, 2024.
[7] N. Nuris, “Analisis Prediksi Harga Rumah Pada Machine Learning Metode Regresi Linear,” Explore, vol. 14, no. 2, pp. 108–112, 2024, doi: 10.35200/ex.v14i2.123.
[8] V. Ariyani, P. Putri, A. B. Prasetijo, and D. Eridani, “Perbandingan Kinerja Algoritme Naïve Bayes Dan K-Nearest Neighbor (Knn) Untuk Prediksi Harga Rumah,” J. Ilm. Tek. Elektro, vol. 24, no. 2, pp. 162–171, 2022, [Online]. Available: https://ejournal.undip.ac.id/index.php/transmisi
[9] D. Nyoman, M. Cahyani, N. Putu, and K. Indah, “Comparison Of Decision Tree, Linear Regression, and Random Forest Regressor Models for Predicting House Prices Desak Nyoman Mulya Cahyani a1,” J. Ilm. Merpati, vol. 12, no. 1, pp. 62–71, 2024.
[10] Nadia Putri Ariyanti, Agung Triayudi, and Ratih Titi Komala Sari, “Analysis of K-NN Algorithm and Linear Regression to Predict House Prices in Jabodetabek,” SaNa J. Blockchain, NFTs Metaverse Technol., vol. 2, no. 1, pp. 65–71, 2024, doi: 10.58905/sana.v2i1.265.
[11] D. E. Aniobi, C. O. Ochuba, and S. B. Nguideen, “House Price Prediction: Comparative Analysis of Regression-Based Machine Learning Algorithms,” Int. J. Res. Appl. Sci. Eng. Technol., vol. 11, no. 10, pp. 1550–1557, 2023, doi: 10.22214/ijraset.2023.56232.
[12] P. R. Sihombing, D. A. Sunarjo, Y. Paulus, and A. C. Yuda, “Jurnal Ekonomi dan Statistik Indonesia,” vol. 2, no. 3, pp. 307–315, 2022, doi: 10.11594/jesi.02.03.07.
[13] S. M. Faradisa, T. D. Nugrahadi, Muliadi, I. Budiman, and D. Kartini, “Implementasi IQR-SMOTE Untuk Mengatasi Ketidakseimbangan Kelas Pada Klasifikasi Diabetes menggunakan K-Nearest Neighbors,” vol. 15, pp. 48–60, 2021.
[14] S. T. Rizaldi and M. Mustakim, “Perbandingan Teknik Pembagian Data untuk Klasifikasi Sarana Akses Air pada Algoritma K- Nearest Neighbor dan Naïve Bayes Classifier,” Semin. Nas. Teknol. Informasi, Komun. dan Ind. 12, pp. 130–137, 2020.
[15] D. S. Seruni, M. T. Furqon, and R. C. Wihandika, “Sistem Prediksi Pertumbuhan Jumlah Penduduk Kota Malang menggunakan Metode K-Nearest Neighbor Regression,” Sist. Prediksi Pertumbuhan Jumlah Pendud. Kota Malang menggunakan Metod. K-Nearest Neighbor Regres., vol. 4, no. 4, pp. 1075–1082, 2020.
[16] Warjiyono, A. Nur Rais, I. Alfarobi, S. Wira Hadi, and W. Kurniawan, “Analisa Prediksi Harga Jual Rumah Menggunakan Algoritma Random Forest Machine Learning,” JURSISTEKNI (Jurnal Sist. Inf. dan Teknol. Informasi), vol. 6, no. 2, pp. 416–423, 2024.
[17] N. N. Sari, T. T. Anisah, and R. Fitriani, “Implementasi Machine Learning untuk Prediksi Harga Laptop Menggunakan Algoritma Regresi Linear Berganda Machine Learning Implementation for Laptop Price Prediction Using Multiple Linear Regression Algorithm,” vol. 14, pp. 162–177, 2024.
Downloads
Published
How to Cite
Issue
Section
License
Copyright (c) 2026 Dimas Yudhistira Ananda, Ferian Fauzi Abdulloh

This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
Authors who publish with this journal agree to the following terms:
- Authors retain copyright and grant the journal right of first publication with the work simultaneously licensed under a Creative Commons Attribution License (Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) ) that allows others to share the work with an acknowledgement of the work's authorship and initial publication in this journal.
- Authors are able to enter into separate, additional contractual arrangements for the non-exclusive distribution of the journal's published version of the work (e.g., post it to an institutional repository or publish it in a book), with an acknowledgement of its initial publication in this journal.
- Authors are permitted and encouraged to post their work online (e.g., in institutional repositories or on their website) prior to and during the submission process, as it can lead to productive exchanges, as well as earlier and greater citation of published work (See The Effect of Open Access).








