Indonesia Explainable machine learning for diabetes classification and web-based implementation

Nunik Destria Arianti, Carti Irawan, Neny RosmawarniNon-Scopus2 Juni 2026Afiliasi: ID

Abstrak

Various machine learning (ML) models can support early diabetes risk assessment and classification. Unfortunately, the important variables in these ML-enabled models are rarely expressed and reported. Therefore, the objective of this study was to develop an explainable ML-based diabetes classification model using a comprehensive approach that combines feature engineering, hyperparameter tuning, and rigorous cross-validation. Four tree-based ML models, including logistic regression (LR), linear discriminant analysis (LDA), k-nearest neighbors (kNN), and random forest (RF), were evaluated using 2768 data points and 8 predictors (number of pregnancies, glucose content, blood pressure (mmHg), skin thickness (mm), insulin (u/ml), body mass index (BMI), diabetes pedigree function (DPF), and age). The kNN algorithm demonstrated the best performance across precision, recall, F1-score, and accuracy in both training and testing. This algorithm was selected for further development within a web application built with the Python Flask framework and is accessible online. The results show that the ML-based discrimination model can be implemented in smart web applications. SHapley Additive Explanations (SHAP) analysis identified glucose content, insulin (u/ml), and age as the most influential predictors, whereas DPF variables were not predictors of diabetes classification outcomes in an optimized kNN model. These findings suggest that kNN can serve as an efficient tool for classifying diabetes, offering an alternative to faster experimental procedures.

Identifier

Scroll to Top