Implementation of the K-Nearest Neighbor Algorithm for Classifying Immigration Residence Permit Applicants at the Class I Special Immigration Office TPI Soekarno-Hatta - Azizah, Nur; Henderi, Henderi; Raja, Berisno Hendro Pardamean Manik (Universitas Raharja, 2025)
This study aims to apply the K-Nearest Neighbor (KNN) algorithm in classifying immigration residence permit applicants at the Class I Special Immigration Office TPI Soekarno-Hatta, focusing on the algorithm's effectiveness and accuracy in categorizing residence permit applicants based on the types of residence permits: Visit Stay Permit (ITK), Limited Stay Permit (ITAS), and Permanent Stay Permit (ITAP). This study employs a quantitative, experiment-based approach utilizing a dataset of 17,212 residence permit applicant records consisting of 11 key attributes, such as nationality, visa type, residence permit type, gender, and age group.The research process began with data preprocessing stages, including data cleaning, normalization, and dataset splitting into training and testing sets with 80:20 and 70:30 partitioning scenarios. The KNN algorithm was implemented using a parameter of k=5k = 5k=5, chosen based on experimentation to achieve optimal performance. The model's performance evaluation was conducted using accuracy, precision, and recall metrics derived from a confusion matrix. The findings reveal that the KNN algorithm successfully classifies data with the highest accuracy of 96.95% in the 80:20 dataset partition scenario and 96.84% in the 70:30 scenario. The Visit Stay Permit (ITK) class demonstrated the best performance with a precision of 97.46% and a recall of 99.97%, whereas the Permanent Stay Permit (ITAP) class showed the lowest performance with a recall of 59.79%, indicating challenges in recognizing patterns for this class. This study also identifies the advantages of the KNN algorithm, including its simplicity of implementation, flexibility in handling multiclass data, and effectiveness for low-dimensional datasets. However, the algorithm has limitations, such as sensitivity to imbalanced data distributions and high computational time for large datasets.