Comparison of Hyperparameter Tuning Techniques on KNN Algorithm to find the Best K Value using Grid Search and Random Search Methods
K-Nearest Neighbors (KNN) is a widely used classification algorithm, but its performance heavily depends on the value of the K parameter. Hyperparameter tuning methods like grid search and random search are employed to find the optimal K value. However, it remains unclear which method is superior due to their differing characteristics. This study compares these methods by evaluating accuracy, memory usage, and computing time. Grid Search was found to be superior in accuracy, with an average difference of 0.5% in accuracy, 0.67% in precision, 0.83% in recall, and 0.33% in F1-score. Conversely, Random Search excels in memory usage and computing time, with a difference of 3.4 MiB in memory usage and eight seconds in computing time. This research aims to guide machine learning practitioners in selecting the appropriate hyperparameter tuning method for the KNN algorithm based on specific priorities and needs.
Authors
- Sri Yulianti (ORCID: https://orcid.org/0009-0004-9520-7430)
- Irfan Darmawan (ORCID: https://orcid.org/0000-0003-0286-6476)
- Akmal Taufiq
- Alam Rahmatulloh (ORCID: https://orcid.org/0000-0002-1948-7379)
- Randi Rizal (ORCID: https://orcid.org/0000-0002-4377-2137)
Institutions
- Siliwangi University (ID)
- Telkom University (ID)
Publication Details
- Published
- 2024-12-11
- DOI
- https://doi.org/10.1109/isriti64779.2024.10963519
- Citations
- 2
- Primary Topic
- Data Mining and Machine Learning Applications
- Type
- article
- Field-Weighted Citation Impact
- 1.56