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.
Copyrights © 2025