Predicting Diabetes Status Using the Random Forest Algorithm Based on the PIMA Dataset
Keywords:
PIMA Indians Diabetes Database, machine learning, classification model, ROC-AUC, risk assessmentAbstract
Background: Diabetes mellitus is a chronic metabolic disorder with an increasing global prevalence. Early detection and risk assessment are essential for preventing disease-related complications. In recent years, machine learning methods have been increasingly investigated for predicting disease status using medical data and supporting clinical decision-making. Aim: This study aimed to develop a predictive model for diabetes status using the Random Forest classification algorithm based on the PIMA Indians Diabetes Database and to evaluate its classification performance. Materials and Methods: The study used the PIMA dataset, comprising 768 observations, eight predictor variables, and one target variable. Zero values in selected measurements that were physiologically implausible were treated as missing values and imputed using the median. The dataset was split into training and test sets at an 80:20 ratio. Hyperparameters of the Random Forest model were optimized using 10-fold cross-validation on the training data. Model performance was evaluated using Accuracy, Sensitivity, Specificity, Balanced Accuracy, Cohen’s Kappa, and the area under the receiver operating characteristic curve (ROC-AUC). Variable importance was also assessed. All statistical analyses and machine learning procedures were performed in the R programming environment. Results: Cross-validation identified mtry=4 as the optimal configuration, achieving an Accuracy of 78.05% and a Cohen’s Kappa of 0.5062. On the test set, the model achieved an Accuracy of 72.55%, Sensitivity of 58.49%, Specificity of 80.00%, Balanced Accuracy of 69.25%, and Cohen’s Kappa of 0.3883. The area under the ROC curve (AUC) was 0.7802, indicating that the model could distinguish between individuals with and without diabetes better than random classification. Variable importance analysis identified blood glucose level as the most influential predictor, followed by body mass index (BMI), age, and number of pregnancies. Conclusion: The Random Forest algorithm demonstrated the potential to predict diabetes status using the PIMA dataset; however, its sensitivity on the test set was relatively low. Therefore, the model should be considered a potential tool for preliminary risk assessment and supporting early detection rather than a replacement for clinical diagnosis. Further research is needed to improve sensitivity, compare the model with other machine learning algorithms, and validate its performance using larger and more diverse datasets.In the MNUMS Digital Library
View this article in the digital library →
Author research profiles: Л.Ажнай, Ц.Жавзмаа, У.Нямдаваа, Э.Энх-Үрэл, Л.Пүрэвдолгор
Downloads
Published
2026-10-30
Issue
Section
Original Articles
License
Articles in this journal are published under the Creative Commons Attribution 4.0 International License (CC BY 4.0). Anyone may copy, distribute and adapt the work, provided the authors and the source are properly credited. Copyright remains with the authors.
