Klasifikasi Jenis Obat Berdasarkan Gejala yang Dimiliki Pasien Menggunakan Metode K-Nearest Neighbors (KNN)

  • Ngakan Putu Bagus Ananta Wijaya Universitas Udayana
  • Ida Ayu Gde Suwiprabayanti Putra Universitas Udayana

Abstract

This research applies the K-Nearest Neighbors (KNN) algorithm to classify medicine types based on patient symptoms using a dataset from Kaggle with 200 rows and 6 columns. After preprocessing steps such as handling missing values, encoding categorical variables, and splitting data into training and testing sets, exploratory data analysis (EDA) was performed to understand the dataset's structure. The KNN model was evaluated with k values of 1, 2, and 3, finding the optimal k to be 3, achieving an accuracy of 77.50% with average precision of 0.76, recall of 0.69, and f1-score of 0.66. Lower accuracy was observed for k=2 (65.00%) and k=1 (67.50%), indicating that k=3 is the most effective for this dataset. These results suggest that while KNN is a viable method for classifying medicine types based on symptoms, larger datasets are recommended for improved accuracy.


Keywords: K-Nearest Neighbors (KNN), classify, medicine, exploratory data analysis (EDA), preprocessing

Published
2024-05-01
How to Cite
ANANTA WIJAYA, Ngakan Putu Bagus; PUTRA, Ida Ayu Gde Suwiprabayanti. Klasifikasi Jenis Obat Berdasarkan Gejala yang Dimiliki Pasien Menggunakan Metode K-Nearest Neighbors (KNN). Jurnal Nasional Teknologi Informasi dan Aplikasnya, [S.l.], v. 2, n. 3, p. 617-624, may 2024. ISSN 3032-1948. Available at: <https://ojs.unud.ac.id/index.php/jnatia/article/view/115995>. Date accessed: 05 nov. 2024. doi: https://doi.org/10.24843/JNATIA.2024.v02.i03.p21.

Most read articles by the same author(s)

Obs.: This plugin requires at least one statistics/report plugin to be enabled. If your statistics plugins provide more than one metric then please also select a main metric on the admin's site settings page and/or on the journal manager's settings pages.