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

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

Institutions

Publication Details

Journal
International Journal of Electronics and Communications Systems
Published
2025-06-28
DOI
https://doi.org/10.24042/ijecs.v5i1.28467
Primary Topic
Geochemistry and Geologic Mapping
Type
article
Field-Weighted Citation Impact
0.00
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

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

International Journal of Electronics and Communications Systems
Geochemistry and Geologic Mapping
article

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

article en

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

International Journal of Electronics and Communications SystemsVol. 5(1)
Binus University (ID), State University of Medan (ID)
Openalex Percentile: Top 40%
Geochemistry and Geologic Mapping
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.