International Journal of Electronics and Communications Systems
Vol. 5 No. 1 (2025): International Journal of Electronics and Communications System

Optimization of KNN Classification for ECG Data Analysis: Comparative Study of Model Performance Using the Hyperparameter Tuning and Cross-Validation

Jannah, Miftahul (Unknown)
Nababan, Adli Abdillah (Unknown)



Article Info

Publish Date
28 Jun 2025

Abstract

Abnormal heart rhythms such as arrhythmias can lead to severe complications, including stroke and cardiac arrest. Electrocardiography (ECG) is commonly used to monitor heart activity due to its non-invasive, affordable, and efficient nature. However, manual ECG interpretation can be time-consuming and error-prone, especially in high-demand clinical settings. This study aims to improve the performance of the K-Nearest Neighbors (KNN) algorithm for ECG signal classification by applying hyperparameter tuning and validating the results through cross-validation. ECG data were collected from participants under three physical activity conditions: sitting, walking, and running. The methodology included signal preprocessing, model development, hyperparameter tuning via Grid Search, and performance validation using K-fold cross-validation. The baseline KNN model achieved an accuracy of 78%. After optimization—by setting the number of neighbors to 16, using the Manhattan distance metric, and applying distance-based weighting—accuracy improved to 82%. Precision increased from 0.79 to 0.82, and the F1-score rose from 0.76 to 0.79. These results demonstrate the impact of systematic tuning on classification performance. An optimized KNN model offers a practical diagnostic aid for arrhythmia detection, particularly in settings with limited access to expert analysis. Its simplicity and low computational cost make it suitable for integration into portable diagnostic devices

Copyrights © 2025






Journal Info

Abbrev

IJECS

Publisher

Subject

Computer Science & IT Electrical & Electronics Engineering

Description

International Journal of Electronics and Communications System (IJECS) [e-ISSN: 2798-2610] is a medium communication for researchers, academicians, and practitioners from all over the world that covers issues such as the improvement about design and implementation of electronics devices, circuits, ...