Comparison of K-means and DBSCAN Web- Based Food in Clustering Based on Nutritional Content - Gina Purnama Insany; Anggun Fergina; Muhammad Ilham Juardi (bit-Tech, 2025)
Food is the main energy source for the human body; however, poor dietary habits can lead to health risks such as obesity and cardiovascular diseases. Understanding the nutritional composition of food is essential to support healthier dietary decisions. Clustering food based on nutritional content can support personalized diet planning and assist healthcare professionals in recommending healthier food choices. This study applies clustering techniques to group foods based on their nutritional content specifically carbohydrate, calorie, protein, and fat levels using K-Means and DBSCAN algorithms. These unsupervised learning methods are suitable for analyzing numerical data without predefined categories. A key challenge in clustering is determining the optimal number of clusters; thus, evaluation methods such as the Elbow Method, Davies-Bouldin Index (DBI), and Silhouette Score were utilized. The K-Means algorithm achieved a Silhouette Score of 0.578 and a DBI of 0.661, indicating reasonably good clustering, though cluster separation was not optimal. In contrast, DBSCAN outperformed K-Means with a Silhouette Score of 0.626 and a DBI of 0.328, suggesting more compact and well-defined clusters. This indicates that DBSCAN formed more distinct and separated clusters, which is essential for effective grouping of foods based on nutritional similarity. The clustering results were deployed via an interactive web application using Streamlit an open-source Python framework enabling rapid development of lightweight web interfaces. This platform allows users to interactively explore clustering patterns through visualizations and tables, providing an intuitive tool to understand food groupings based on nutritional profiles