Perbandingan Kinerja Model Pembelajaran Mesin Random Forest dan K-Nearest Neighbor (KNN) untuk Prediksi Risiko Kredit pada Layanan Pinjaman Online
Main Article Content
Abstract
This study aims to compare the performance of two popular machine learning algorithms, Random Forest and K-Nearest Neighbor (KNN), in predicting creditworthiness in online lending systems. The research uses the publicly available Loan Approval Prediction Dataset from Kaggle, which contains borrower profiles such as employment status, number of dependents, annual income, loan amount, loan term, and credit score. Data preprocessing included cleaning, handling missing values, outlier removal, and transformation through normalization and encoding. The dataset was divided into 80% training data and 20% testing data. Random Forest was configured with 100 decision trees and unlimited depth, while KNN used an optimal k value of 5 determined by grid search. Model performance was evaluated using accuracy, precision, recall, and F1-score. The results showed that Random Forest outperformed KNN with consistently higher values (97%) across all metrics, demonstrating strong stability and superior pattern recognition capabilities. KNN, with an accuracy of 89%, still showed good performance and can be considered a lightweight alternative for simpler applications.
Downloads
Article Details

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
References
A. Abdullah, “Analisis Pengetahuan Pinjaman Online Pada Masyarakat Surakarta,” JESI (Jurnal Ekonomi Syariah Indonesia), vol. 11, no. 2, pp. 108–114, 2021, doi: 10.21927/jesi.2021.11(2).108-114.
U. Makhazhanova, S. Kerimkhulle, A. Mukhanova, A. Bayegizova, Z. Aitkozha, A. Mukhiyadin, B. Tassuov, A. Saliyeva, R. Taberkhan, and G. Azieva, “The evaluation of creditworthiness of trade and enterprises of service using the method based on fuzzy logic,” Applied Sciences, vol. 12, no. 22, p. 11515, 2022, doi: 10.3390/app122211515.
M. A. Faheem, “AI-Driven Risk Assessment Models: Revolutionizing Credit Scoring and Default Prediction,” Iconic Research and Engineering Journals, vol. 5, no. 3, pp. 177–186, 2021. [Online]. Available: https://www.irejournals.com/formatedpaper/1702907.pdf
A. Ampountolas, T. Nyarko Nde, P. Date, and C. Constantinescu, “A machine learning approach for micro-credit scoring,” Risks, vol. 9, no. 3, p. 50, 2021, doi: 10.3390/risks9030050.
A. Kumar, S. Sharma, and M. Mahdavi, “Machine learning (ML) technologies for digital credit scoring in rural finance: A literature review,” Risks, vol. 9, no. 11, p. 192, 2021, doi: 10.3390/risks9110192.
V. Chang, Q. A. Xu, S. H. Akinloye, V. Benson, and K. Hall, “Prediction of bank credit worthiness through credit risk analysis: An explainable machine learning study,” Annals of Operations Research, advance online publication, 2024, doi: 10.1007/s10479-024-06134-x.
E. V. Orlova, “Methodology and Models for Individuals’ Creditworthiness Management Using Digital Footprint Data and Machine Learning Methods,” Mathematics, vol. 9, no. 15, p. 1820, 2021, doi: 10.3390/math9151820.
D. Fusvita, A. Asnawati, dan F. H. Utami, “Penerapan algoritma KNN (K nearest neighbour) dalam klasifikasi data pinjaman anggota koperasi,” J. Ilm. Binary STMIK Bina Nusantara Jaya, vol. 3, no. 1, pp. 1–5, Apr. 2021, doi: 10.52303/jb.v3i1.32.
S. Shi, R. Tse, W. Luo, S. D’Addona, and G. Pau, “Machine learning-driven credit risk: a systemic review,” Neural Computing and Applications, vol. 34, pp. 14327–14339, 2022, doi: 10.1007/s00521-022-07472-2.
D. Mhlanga, “Financial Inclusion in Emerging Economies: The Application of Machine Learning and Artificial Intelligence in Credit Risk Assessment,” International Journal of Financial Studies, vol. 9, no. 3, 2021, doi: 10.3390/ijfs9030039.
B. Prasojo dan E. Haryatmi, “Analisa Prediksi Kelayakan Pemberian Kredit Pinjaman dengan Metode Random Forest”, TEKNOSI, vol. 7, no. 2, hlm. 79–89, 2021, doi: 10.25077/TEKNOSI.v7i2.2021.79-89.
A. Y. Vandika and R. Pannyiwi, “Application of KNN Algorithm for Credit Risk Analysis in Savings and Loan Cooperatives,” JICT, vol. 15, no. 2, pp. 55–61, 2024, doi: 10.35335/jict.v15i2.174. [Online]. Available: https://www.ejournal.marqchainstitute.or.id/index.php/JICT/article/view/174
S. G. Wardhani and A. Kurniawati, “Implementation of K-Nearest Neighbor Algorithm for Creditworthiness Analysis Using Methods Cross-Industry Standard Process for Data Mining (CRISP-DM),” Int. Res. J. Adv. Eng. Sci., vol. 10, no. 1, pp. 152–157, 2025. [Online]. Available: https://irjaes.com/wp-content/uploads/2025/02/IRJAES-V10N1P420Y25.pdf
H. Dong, R. Liu, and A. W. Tham, “Accuracy Comparison between Five Machine Learning Algorithms for Financial Risk Evaluation,” Journal of Risk and Financial Management, vol. 17, no. 2, 2024, doi: 10.3390/jrfm17020050.
M. R. Machado and S. Karray, "Assessing credit risk of commercial customers using hybrid machine learning algorithms," Expert Systems with Applications, vol. 200, p. 116889, 2022, doi: 10.1016/j.eswa.2022.116889.