KNN-Based Handwritten Digit Classification with Accuracy Analysis and Visualization - Maulana, Muhammad Rizky; Nugroho, Adiv Prasetyo; Adinata, Ferdyan Candra; Haidar, Nova Briyan; Setiawan, Arif (LPPM Universitas Sains dan Teknologi Komputer, 2025)
The rapid advancement of information technology has had a significant impact in various fields, particularly in pattern recognition and image processing. One of the ongoing challenges is accurately recognizing handwritten digits, which plays a crucial role in document digitization, automated form reading, and other intelligent systems. This study aims to implement and evaluate the K-Nearest Neighbors (KNN) algorithm, a simple yet effective classification technique, in recognizing handwritten digit images. The data used comes from the public dataset load_digits from Scikit-learn, which contains 1,797 grayscale images of handwritten digits sized 8x8 pixels. Each image is represented as a 64-dimensional feature vector. The dataset is split into training and testing data with an 80:20 ratio, and the model is trained using KNN with k=3. The experimental results show a classification accuracy of 96.94%, with minimal prediction errors that typically occur in digits with similar visual shapes, such as 5 and 9. This study demonstrates that KNN, despite its simplicity, can provide high accuracy in handwritten digit recognition when supported by proper preprocessing and parameter selection. The implications of this research highlight the potential for developing intelligent applications in education, data entry automation, and identity verification.