Decision tree with randomized grid search-based hyperparameter tuning and optimal feature scaling for diabetes diagnosis Authors: Mudatheer M Al-Slivani, Ibrahim O Alrubaye, Mayameen S Kadhim, Ahmed Dheyaa Radhi, Nor Samsiah Sani, Hussein A A Al-Khamees, Mohd Aliff Afira Sani, Mohammed Amin Almaiah, Rusul Mansoor Al-Amri Published: 2026 ABSTRACT AbstractBackgroundDiabetes is a chronic condition that arises when the body cannot effectively regulate blood glucose levels, either due to insufficient insulin production or insulin resistance. If left unmanaged, diabetes can lead to serious complications including heart disease, nerve damage, kidney failure, and blindness. Machine learning classifiers are widely employed to predict diabetes onset based on patient data.MethodsThis paper presents a robust data-driven machine learning framework for enhancing the classification of diabetes. Unlike previous decision tree models that employed the classic grid search method, we propose a decision tree (DT) model utilizing randomized grid search for the diagnosis of diabetes through two stages (1) applying eight feature scaling methods (StandardScaler, MaxAbsScaler, RobustScaler, PowerTransformer, QuantileTransformer, MinMaxScaler, Normalizer, and KBinsDiscretizer), and then identifying the best one according to different measurements (accuracy, F1-score, and Friedman ranking), and (2) tuning the hyperparameters via randomized grid search with 5-fold cross-validation to identify the best configuration that maximizes classification performance. These hyperparameters include criterion, max_depth, min_samples_split, and min_samples_leaf. The public diabetes datasets PIMA and IPDD are used to evaluate the proposed model. The results of this model are evaluated by accuracy, precision, recall, F1_score, Area Under the Curve (AUC), and Matthews Correlation Coefficient (MCC).ResultsThe results are 99.5%, 99.52%, 99.5%, 99.51%, 99.8%, and 97.97% on the IPDD dataset and 77.27%, 77.19%, 77.27%, 77.23%, 77.9%, and 70.2% on the PIMA dataset for the six metrics, respectively. Then, these results are compared against different machine learning classifiers, including classic decision tree, K-nearest neighbors, logistic regression, support vector machine, AdaBoost, random forest, gradient boosting, and XGBoost. Furthermore, the p-value is computed to analyze the feature interactions for the clinical relevance.ConclusionsThis paper offers a scalable, interpretable, and ethically aligned tool towards improving diabetes diagnosis techniques using machine learning, contributing to early detection of the disease and reduction of associated health risks.Keywords: Diabetics disease, Machine learning, Decision tree, PIMA India diabetes dataset (PIMA), Iraqi patient dataset for diabetes (IPDD) Introduction Currently, 589 million adults (20–79 years) are living with diabetes mellitus (DM) worldwide, and by 2045, it is predicted that this number will have increased to 783 million.1 In order to stop the advancement of pre-diabetes to Type 2 diabetes, a reversible stage in which lifestyle changes can lower incidence, early detection, and risk stratification are essential [1]. DM is a major cause of numerous complications such as heart disease, kidney failure, and nerve damage, and its prevalence continues to rise worldwide [2]. A major challenge is early diagnosis, as many patients are unaware of their condition until it has worsened [3]. Artificial intelligence (AI)-driven healthcare systems now rely heavily on machine learning (ML) classifiers [4]. Practically, the application of these classifiers to medical diagnosis has enabled new methods for accurate, effective, and early diagnosis of disease, with the aim of reducing adverse health outcomes through timely therapeutic intervention [5]. Meanwhile, the ML classifiers have revolutionized DM risk assessment and early identification. Recent studies have investigated the use of various ML classifiers, including the decision trees, as well as ones to predict the likelihood of diabetes [6]. These classifiers are trained on DM datasets to analyze multiple variables that may influence the onset of the disease [7]. ML models ML models typically comprise several phases, including preprocessing. A key step in this phase is feature scaling, which aims to standardize the range of independent features or variables in a dataset, ensuring that no feature dominates the modeling process. In general, the ML models are sensitive to the magnitude of input features. In this context, the grid search is a widely used method for tuning hyperparameters [8]. It is based on the exhaustive evaluation of all predefined combinations of the discrete values (e.g., 10, 20, 30, 40) [9]. Although this progress is made through applying different ML classifiers, challenges remain in applying them to DM diagnosis [10]. The decision tree (DT) classifier represents one of the most important and widely used classifiers that is applied for classification tasks [11]. Its main idea is based on recursively splitting the dataset into subsets depending on the feature values that best separate the target variable, forming a tree-like structure of decisions. Every internal node indicates a test on a feature, each branch represents the results of the test, and every leaf node represents a class label (classification) [12]. The DT classifier is intuitive and interpretable and needs to have its parameters tuned. On the other hand, it is possible to demonstrate that even a simple ML classifier (like DT), when intelligently tuned and contextually adapted, can serve as a powerful tool for early DM detection [13]. The authors in [14] proposed a new framework by applying three ML classifiers: support vector machine (SVM), K-nearest neighbors (K-NN), and logistic regression (LR). The framework aims to construct an active model for predicting diabetes by combining the SVM classifier with others, achieving an accuracy of 96.4% on the IPDD dataset. This model limits the application of traditional classifiers of ML, highlighting the use of hyperparameter optimization for ML classifiers. The proposed framework is tested by only the IPDD dataset. The central concept of the study in [15] was to introduce a novel method that basically is a dynamic hybrid metaheuristic optimization method. In reality, this method combined the Al-Biruni earth radius with the dipper-throated optimization algorithm (DBERDTO). Among seven ML classifiers for the IPDD dataset, the RF classifier achieved the best accuracy with 86.5%, while the DT classifier achieved 75.8%. This method, although recent, might not be suitable for many diabetes datasets (or even classification issues). This is due to the fact that the results did not involve the application of suitable preprocessing methods in different scenarios. Through five ML classifiers, the work of [16] was suggested for predicting the diabetes on the IPDD dataset. The general impact of feature selection on the model performance was discussed in this paper as well as the relative risks of diabetes. The DT classifier has the best accuracy of 95.07% among all. The paper fails to process the imbalance issue. Depending on integrating prior knowledge obtained from shapley additive description (SHAP), the authors in [17] presented a framework that enhances the transformer models. They explained the transparency and trustworthiness of artificial intelligence applications in healthcare. However, this framework proved that this method is able to improve the overall accuracy for different datasets, including the IPDD. The accuracy of this framework on the IPDD dataset was low (at 89.75%); besides, it didn’t handle the class imbalance. In study [18], several ML classifiers, including: K-NN, SVM, DT, random forest (RF), Gaussian Naive Bayes (GNB), and AdaBoost, are employed to evaluate the IPDD dataset. The reported accuracies of these classifiers were 97.1%, 94.8%, 96.8%, 98.8%, 92.6%, and 96.1%, respectively, where all of these classifiers were tested exclusively on the IPDD dataset. In [19], DT, RF, LR, XGBoost, and K-NN were applied without addressing class imbalance. Among these, the highest accuracy was achieved by the XGBoost classifier with 98.5%, while the DT attained an accuracy of 97.99%. The work was evaluated by only the IPDD dataset and only two metrics (accuracy and F1_score). The framework proposed in [17] was also evaluated on the PIMA dataset, without addressing the issue of imbalanced classes, achieving an accuracy of 65.30%. Similarly, the study in [15] employed the PIMA dataset to assess a model developed using DT classifier, achieving an accuracy of 68.0%.In [20], the authors evaluated ten different ML classifiers, including the DT, to improve diabetes prediction through a mobile application. They highlighted the benefit of combining different classifiers to improve prediction accuracy. However, the DT classifier achieved an accuracy of 72.0%, while all these classifiers were evaluated by only the PIMA dataset. Without applying any class imbalance handling method, the idea behind the work of [21] was to combine two ML classifiers, DT and LR, that are trained independently in the first step. The second step was to feed the output of these classifiers to the neural network. Finally, the authors integrated the results of DT and LR. The accuracy of the DT is still low at 65.84%. Similarly, the work in [22] employed many ML classifiers to diseases prediction, including the DT. This work did not focus on the DM but rather on a wide range of diseases. However, among all classifiers, the DT attained the highest accuracy on the PIMA dataset of 71.42%. Various feature selection methods and ML classifiers are employed in the work of [23] on the PIMA dataset. Firstly, the authors used the mutual information feature selection method and extreme gradient boosting (XGB) classifier. They attained an accuracy of 74.7%. Then, the authors applied all the features and the RF classifier with an accuracy of 76.60%. The model uses the thresholds many times. From the training dataset (80%), the model used 20% of them to select the decision thresholds. Then, the model selected the operating threshold by scanning a fine grid of probability quantiles and selecting the cutoff that maximizes the F1_score. A hybrid convolutional neural network (CNN) with a long short-term memory (LSTM) model enhanced by conditional generative adversarial network (cGAN)-based augmentation methods was proposed in [24]. Before that, through the MinMaxScaler method and SMOTE method, the authors applied the SVM classifier, and they achieved an accuracy of 74.0% on the PIMA dataset. This model was evaluated by only the PIMA dataset; thus, it limits the model generalization. According to these studies, different limitations are noted, which are as follows: These studies applied a single feature scaling method during training, based on statistics calculated from the training data. These studies applied a single feature scaling method during training, based on statistics calculated from the training data. For DT-based models, their hyperparameter values are fixed at model initialization in the grid search step, while in some models, one hyperparameter might be adjusted to determine its best value. For DT-based models, their hyperparameter values are fixed at model initialization in the grid search step, while in some models, one hyperparameter might be adjusted to determine its best value. Most previous models have been evaluated using one DM dataset; meanwhile, their results are measured through specific metrics, and finally, their results have not been compared with other ML classifiers. Most previous models have been evaluated using one DM dataset; meanwhile, their results are measured through specific metrics, and finally, their results have not been compared with other ML classifiers. These limitations compromise models’ reliability and clinical applicability. To address these limitations, this paper proposes a decision tree-based model through two stages to enhance the accuracy and reliability of multi-class classification for DM. More specifically, this paper introduces three methodological improvements: Empirical feature scaling methods: Instead of choosing a single scaling strategy without empirical justification, we thoroughly test eight well-known methods. Empirical feature scaling methods: Instead of choosing a single scaling strategy without empirical justification, we thoroughly test eight well-known methods. Randomized hyperparameter optimization: A randomized grid search step across a wide hyperparameter space is used instead of default or static hyperparameters and identify the best configuration. This eliminates arbitrary hyperparameter choices. Randomized hyperparameter optimization: A randomized grid search step across a wide hyperparameter space is used instead of default or static hyperparameters and identify the best configuration. This eliminates arbitrary hyperparameter choices. Datasets and multi-metric rigorous evaluation: The proposed model is evaluated on two DM datasets, and the model performance is evaluated using six complementary metrics, which go beyond the limit-metrics reporting that is typical in previous studies. Datasets and multi-metric rigorous evaluation: The proposed model is evaluated on two DM datasets, and the model performance is evaluated using six complementary metrics, which go beyond the limit-metrics reporting that is typical in previous studies. The main contributions of this paper can be summarized as follows: Applying multiple feature scaling methods that are StandardScaler, MaxAbsScaler, RobustScaler, PowerTransformer, QuantileTransformer, MinMaxScaler, Normalizer, and KBinsDiscretizer. Then, their accuracy, F1_score, and Friedman ranking are evaluated; select the best scaling method; and finally, adopt it. In the same context of the preprocessing step, the Synthetic Minority Over-Sampling Technique (SMOTE) is applied to overcome the class imbalanced issue. Applying multiple feature scaling methods that are StandardScaler, MaxAbsScaler, RobustScaler, PowerTransformer, QuantileTransformer, MinMaxScaler, Normalizer, and KBinsDiscretizer. Then, their accuracy, F1_score, and Friedman ranking are evaluated; select the best scaling method; and finally, adopt it. In the same context of the preprocessing step, the Synthetic Minority Over-Sampling Technique (SMOTE) is applied to overcome the class imbalanced issue. Implementing a randomized grid search with 5-fold CV across 4 hyperparameter dimensions (criterion, max_depth, min_samples_split, and min_samples_leaf) instead of default or static hyperparameters. Implementing a randomized grid search with 5-fold CV across 4 hyperparameter dimensions (criterion, max_depth, min_samples_split, and min_samples_leaf) instead of default or static hyperparameters. Evaluating the model performance on IPDD and PIMA datasets using six metrics (accuracy, precision, recall, F1_score, Area Under Curve (AUC), and Matthews Correlation Coefficient (MCC)) and comparing them against seven ML classifiers (classic decision tree, K-NN, LR, SVM, AdaBoost (AdaB), RF, gradient boosting (GB), and XGBoost). Evaluating the model performance on IPDD and PIMA datasets using six metrics (accuracy, precision, recall, F1_score, Area Under Curve (AUC), and Matthews Correlation Coefficient (MCC)) and comparing them against seven ML classifiers (classic decision tree, K-NN, LR, SVM, AdaBoost (AdaB), RF, gradient boosting (GB), and XGBoost). Table 1 provides a comprehensive analysis of the related works, highlighting their classifiers, strengths, and limitations. Table 1Comparative analysis of the related worksStudyML classifierStrengthsLimitations[14]SVM, K-NN, and LRAchieved 96.4% accuracy and combined multiple classifiersOnly tested on IPDD and no hyperparameter optimization[15]Different ML and DT5-fold CV validation and hyperparameter tuningLow accuracy with 75.8%[16]Different ML and DTDynamic hybrid meta-learningOnly tested on IPDD, low accuracy with 95.07%, and no comparison with other classifiers[17]DTSHAP explanations and tested different datasetsNo technique to process the class imbalance and the accuracy is 89.75%[18]Different ML and DTMultiple ML classifiers are usedOnly tested on IPDD and no hyperparameter tuning[19]Different ML and DTMultiple ML classifiers are usedOnly tested on IPDD and two metrics for evaluation[15]Different ML and DT5-fold CV validation and hyperparameter tuningLow accuracy with 68.0%[17]DTSHAP explanations and tested different datasetsNo technique to process the class imbalance and low accuracy of 65.30%[20]Different ML and DTMobile applicationOnly tested on PIMA and low accuracy with 72.0%[21]DT and LRCombined DT and LR with neural networkLow accuracy of 65.84%[22]Different ML and DTprocessed different diseasesOnly tested on PIMA[23]Different MLTested different feature selection methodsOnly tested on PIMA and overused of the thresholds[24]CNN and LSTMHybrid model and conditional GAN augmentationOnly tested on PIMA and no hyperparameter optimization Comparative analysis of the related works Methods and materials This section discusses the materials and methods of the proposed model. Firstly, Sect. 2.1 describes the datasets that are used to evaluate this model, while Sects. 2.2 and 2.3 explain the feature selection and feature scaling methods, respectively. Section 2.4 illustrates the proposed optimized hyperparameter tuning method. The ML classifiers are outlined in Sect. 2.5, and finally, the proposed methodology is clarified in Sect. 2.6. Datasets The proposed model is evaluated on two complementary datasets representing distinct clinical contexts and populations, which are the IPDD and PIMA datasets. This subsection explains these datasets in detail. Iraqi Patient Dataset for Diabetes (IPDD) The Iraqi Patient Diabetes Dataset (IPDD) contains different numbers of patients examined at a specialized endocrinology and diabetes center in Iraq. This dataset includes 1000 samples, including 565 males and 435 females, ranging in age from 20 to 79 years [25]. The objective of this dataset is to predict diabetes by classifying patients into three categories: diabetic (837 samples), non-diabetic (103 samples), and predicted diabetic (53 samples). The dataset contains 11 features, and it is free to download. Table 2- part 1 explains the IPDD features, along with an explanation of each one. Table 2Descriptive statistics of the features on IPDD and PIMA datasetsNoFeatureDescriptionMinMaxMeanIPDD dataset1GenderGender of patient0.001.000.432AGEAge measured20.079.053.533UreaUrea concentration0.5038.905.124CrCreatinine ratio6.00800.0068.945HbA1cHemoglobin A1c0.9016.008.286CholCholesterol0.0010.304.867TGTriglyceride0.3013.802.358HDLHigh Density Lipoprotein0.209.901.209LDLLow Density Lipoprotein0.309.902.6110VLDLVery Low Density Lipoprotein0.1035.001.8511BMIBody Mass Index19.0047.7529.58PIMA dataset1PregnanciesNumber of times pregnant0.0017.003.852GlucosePlasma glucose concentration 2-h in an oral glucose tolerance test44.00199.00121.693Blood pressureDiastolic blood pressure24.00122.0072.414SkinThicknessTriceps skin fold thickness7.0099.0029.155Insulin2-Hour serum insulin14.00846.00155.556BMIBody Mass Index (weight / height)18.2067.1032.467DPFDiabetes pedigree function0.082.420.478AgeAge of patients in years21.0081.0033.24 Descriptive statistics of the features on IPDD and PIMA datasets India diabetes dataset (PIMA) It is the second dataset used to evaluate the proposed model. The PIMA dataset is free and widely used in medical research to predict a person’s likelihood of developing diabetes based on a set of clinical features [26]. This dataset consists of 768 cases (268 of whom had diabetes, while 500 samples were non-diabetic) and 8 features, with binary diabetes classification. Figure 1 shows the class distributions for both datasets. The class distributions of both datasets From Fig. 1, it is clear that both datasets are imbalanced as follows: IPDD dataset: From Fig. 1a, this dataset has the class “Diabetes” with a larger number of data samples than the other classes of “Non-diabetic” and “Pre-diabetic”. IPDD dataset: From Fig. 1a, this dataset has the class “Diabetes” with a larger number of data samples than the other classes of “Non-diabetic” and “Pre-diabetic”. PIMA dataset: On the other hand, Fig. 1b illustrates that class “0” contains data samples more than class “1”. PIMA dataset: On the other hand, Fig. 1b illustrates that class “0” contains data samples more than class “1”. In the ML-based early diagnosis of DM, the class imbalance present in clinical datasets (like DM datasets) is a significant issue [27], where data samples in one class are more than others in another class [28]. To address this issue, this paper applies the widely used data-level resampling technique known as the Synthetic Minority Oversampling Technique (SMOTE) [29]. SMOTE creates synthetic minority-class samples by interpolating between existing occurrences in feature space. SMOTE improves model generalization while maintaining the underlying data distribution by producing new, realistic examples along the line segments connecting minority-class samples’ k-nearest neighbors [30]. Feature selection Feature selection is a crucial preprocessing step used to identify the most important (relevant) features from all the features [31, 32]. In this paper, the univariate ANOVA F-test ranking (a standard filter method) is applied to evaluate the feature discriminative power. The dataset features are sorted in descending F-statistic, and then, the top-k features are selected based on applying the cumulative normalized discriminative power (Φ ), ensuring that the highest coverage of total variance separation is detected. More specifically, this method consists of the following steps: Step 1: Feature-wise discriminative For each feature j with c = 2 and 3 classes and N total samples, the F-statistic () quantifies the ratio of between-class to within-class variance: where: : mean of feature j in class i; : mean of feature j in class i; : global mean of feature j : global mean of feature j : samples in class i; : samples in class i; : samples between-class variance; : samples between-class variance; : samples within-class variance; : samples within-class variance; i: the class index (2 for PIMA and 3 for IPDD); i: the class index (2 for PIMA and 3 for IPDD); k: the sample index within class i (from 1 to ); k: the sample index within class i (from 1 to ); j: the feature index (such as, j= 1 for first feature, and so on). j: the feature index (such as, j= 1 for first feature, and so on). Step 2: Total discriminative power Total discriminative capacity of all features can be calculated by Eq. (2): Thus, is the sum of all features scores (). Step 3: Cumulative normalized discriminative power After sorting features by , the cumulative power (Φ ) for top-k features is computed by Eq. (3): As a result, the highest value of the refers to the best subset number of features among all the whole feature numbers. Feature scaling methods Different feature scaling methods are used in the proposed model, which are as follows [33–38]: Standard scaler Also known as z-score or even normalization. It is applied to uniformize the dataset features through excluding the mean and scaling the data for obtaining the unit variance. The Standard scaler is computed by Eq. (4): where: z is the z-score; z is the z-score; is the data point; is the data point; μ is the mean of the dataset; μ is the mean of the dataset; σ is the standard deviation of the dataset. σ is the standard deviation of the dataset. MaxAbs scaler It ensures that all values fall within the range [−1, 1] by scaling each feature by dividing it by its maximum absolute value. The MaxAbs scaler can be computed according to Eq. (5): Robust scaler It is especially made to scale features with robust statistics against outliers. Robust type scales the data using the median and interquartile range (IQR), in contrast to other scalers like Standard scaler or MinMax scaler, which are sensitive to extreme values (outliers). Equations (6) and (7) explain the calculation of this scaler type: where: X is the original feature values; X is the original feature values; refers to the median of the feature values; refers to the median of the feature values; it defined by Eq. (7): it defined by Eq. (7): where: Q1 is the first quartile; Q1 is the first quartile; Q3 is the third quartile. Q3 is the third quartile. Power transformer The Power transformer (sometimes known as the Yeo-Johnson transformation) is especially helpful for lowering skewness, stabilizing variance, and enhancing the efficiency of ML models that depend on the input data being normal. It is computed by Eq. 8): Quantile transformer The Quantile transformer maps the data to a predefined quantile range, thereby reducing the effect of outliers and improve the data’s suitability for ML models that rely on uniformity or normality. The Quantile transformer first maps each value X to its quantile rank as Eq. (9): where: X indicates the original feature value; X indicates the original feature value; is the rank of X in the sorted dataset; is the rank of X in the sorted dataset; N is the total number of samples. N is the total number of samples. If the output distribution is set to uniform, the transformed value can be computed as Eq. (10): On the other hand, if the output distribution is set to normal, the transformed value is obtained using the inverse CDF of the standard normal distribution through Eq. (11): where: is the inverse cumulative distribution function (quantile function) of the standard normal distribution. MinMax scaler The MinMax scaler is used in the data preprocessing step to standardize a dataset’s feature range. By using a linear transformation, it scales each feature’s values to a predetermined range, usually between 0 and 1. This guarantees that every feature makes an equal contribution to the training of the model, particularly in cases when algorithms are sensitive to the volume of input data. The mathematic computation of this type is as in Eq. (12): Normalizer The Python sklearn.preprocessing package offers a feature scaling method known as Normalizer. Normalizer scales individual samples (records) to have a unit norm, in contrast to MinMax scaler, which scales features according to their range or distribution. This indicates that each row of data is rescaled to have a vector length (magnitude) of 1. The Normalizer is computed by Eq. (13): KBins discretizer A useful tool for converting continuous data into discrete bins that facilitates the use of different ML models is the KBins discretizer. It is especially helpful for handling noisy data, nonlinear connections, or situations where interpretability is crucial. To prevent overfitting or information loss, however, precise parameter adjustment is necessary. The computation of the KBins discretizer as explained in Eq. (14): where: X is the original continuous feature values; X is the original continuous feature values; a function that maps each value of X to a bin index based on the chosen strategy; a function that maps each value of X to a bin index based on the chosen strategy; k refers to the number of bins; k refers to the number of bins; is the transformed feature values, where each value is replaced by its corresponding bin index. is the transformed feature values, where each value is replaced by its corresponding bin index. While metaheuristic optimization (like the genetic algorithms, particle swarm optimization, and others) has been applied to select the features and hyperparameter tuning in medical ML [39], we deliberately used these feature scaling methods for the critical reasons: Conceptual appropriateness: Feature scaling represents a deterministic transformation problem for mapping the feature distributions to standardized ranges, not an optimization problem requiring search algorithms. Metaheuristics may excel at combinatorial optimization (such as feature subset selection) but introduce unnecessary stochasticity to a well-defined statistical transformation [40]. Thus, the scaling step should be a transparent, reproducible one rather than an opaque optimization process. Conceptual appropriateness: Feature scaling represents a deterministic transformation problem for mapping the feature distributions to standardized ranges, not an optimization problem requiring search algorithms. Metaheuristics may excel at combinatorial optimization (such as feature subset selection) but introduce unnecessary stochasticity to a well-defined statistical transformation [40]. Thus, the scaling step should be a transparent, reproducible one rather than an opaque optimization process. Clinical interpretability: Medical practitioners require transparent preprocessing to test the clinical thresholds, for example (HbA1c \ge 6.5% for diabetes diagnosis). The traditional scaling methods preserve clinical meaning. Metaheuristic scaling may produce non-intuitive transformations that clinicians cannot map to physiological ranges [41]. Clinical interpretability: Medical practitioners require transparent preprocessing to test the clinical thresholds, for example (HbA1c \ge 6.5% for diabetes diagnosis). The traditional scaling methods preserve clinical meaning. Metaheuristic scaling may produce non-intuitive transformations that clinicians cannot map to physiological ranges [41]. Spectrum: This selection covers the complete spectrum of scaling behaviors required for diabetes biomarkers, for example, (1) distribution-preserving via the StandardScaler (Gaussian assumption) and MinMaxScaler (bounded ranges) and (2) distribution-transforming by PowerTransformer (Box-Cox/Yeo-Johnson) and QuantileTransformer (Gaussian mapping). Spectrum: This selection covers the complete spectrum of scaling behaviors required for diabetes biomarkers, for example, (1) distribution-preserving via the StandardScaler (Gaussian assumption) and MinMaxScaler (bounded ranges) and (2) distribution-transforming by PowerTransformer (Box-Cox/Yeo-Johnson) and QuantileTransformer (Gaussian mapping). Regulatory and reproducibility considerations: These methods satisfy standard requirements such as reproducibility, auditability, and validation. Regulatory and reproducibility considerations: These methods satisfy standard requirements such as reproducibility, auditability, and validation. More comprehensively, Algorithm 1 demonstrates the steps to apply all the scaling methods to the DM datasets and to select the best one. Algorithm 1 Select the best feature scaling method Algorithm 1 evaluates eight candidate scaling methods (StandardScaler, MaxAbsScaler, RobustScaler, PowerTransformer, QuantileTransformer, MinMaxScaler, Normalizer, and KBinsDiscretizer) by using three different metrics: accuracy (for general performance), F1_score (for imbalanced data), and Friedman statistical ranking (to determine statistical significance). The hyperparameter tuning method A common algorithm for hyperparameter adjustment and then fine-tuning the model performance in the ML community is the grid search (GS) [9]. It finds the optimal performance by thoroughly experimenting with all possible configurations of the given hyperparameter values. In essence, GS trains a model for each possible combination of hyperparameters and then chooses the model that performs the best, thus performing both model selection and hyperparameter tuning at the same time [42]. However, this GS method has the following limitations: It used predefined fixed values. It used predefined fixed values. Restricted to grid points, it might overlook optimal values in between specified points. Restricted to grid points, it might overlook optimal values in between specified points. In this paper, a randomized grid search method is applied instead of a static one. Mainly, this method overcomes the major issue of limited exploration space in the classic GS through: It uses continuous integer ranges, and therefore, it is able to find a globally optimal solution with minimal trials. It uses continuous integer ranges, and therefore, it is able to find a globally optimal solution with minimal trials. Expanded investigation to find superior hyperparameters beyond the predetermined hyperparameters in the classic GS. Expanded investigation to find superior hyperparameters beyond the predetermined hyperparameters in the classic GS. The randomized search cross-validation (RandomizedSearchCV), a stochastic optimization method that effectively explores high-dimensional parameter spaces. More deeply, the RandomizedSearchCV is applied to sample hyperparameter configurations stochastically from continuous probability distributions, in contrast to exhaustive grid search, which evaluates every possible combination of predefined discrete values. This allows for a more thorough and effective exploration of the hyperparameter space with a significantly reduced number of evaluations. To ensure robust performance estimation, this search method does 30 randomized trials, each of which is evaluated using 5-fold stratified cross-validation on the SMOTE-balanced training dataset. The configuration that achieves the highest mean CV accuracy is selected. In the current method, the hyperparameter space is defined as (Θ ), which includes four parameters that are ((criterion), (max_depth), (min_samples_split), and (min_samples_leaf)). More details of these hyperparameters and their values for both classic GS and the proposed method (randomized grid search) are listed in Table 3. Table 3The hyperparameters detailsNoHyperparameterClassic grid Randomized grid search values1criterion[‘gini’, ‘entropy’][‘gini’, ‘entropy’]2max_depth[10, 20, 30, 40, 50][5–50]3min_samples_split[2, 5, 10][2–20]4min_samples_leaf[1, 2, 4][1–10] The hyperparameters details The final optimized classifier is constructed by retraining the model that obtained the greatest mean cross-validation score on the whole training dataset. By avoiding the exorbitant expense of exhaustive grid search and preserving high generalization capability, this Randomized Grid Search method strikes a balance between computational efficiency and performance robustness. According to the feature scaling methods (Sect. 2.3), the proposed randomized grid search method (Sect. 2.4), and Algorithm 1, Fig. 2 depicts the general tasks of the proposed model. The general tasks of the proposed model Machine learning classifiers In this paper, eight different ML classifiers are applied on both datasets to analyze performance and extract patterns and trends. These classifiers are carefully selected based on their superior ability to handle diverse data and provide accurate results in classification and prediction. These classifiers are as follows: Decision tree Dts are supervised learning models used for classification and regression tasks. It works by splitting the data into branches based on specific feature conditions, forming a tree-like structure [43]. At each decision node, the algorithm evaluates the most informative feature to split the data until it reaches a leaf node, which assigns a prediction based on the majority class (for classification) or average value (for regression) of the data points in that branch [44]. Random forest The RF is an ensemble learning classifier that combines multiple decision trees to improve accuracy and reduce overfitting [45]. In RF, each tree is trained on a random subset of the dataset (bootstrapping) and considers a random selection of features at each split. The final prediction is based on the majority vote for classification or the average for regression among all trees. This ML method enhances generalization and makes the model more robust, especially with high-dimensional data [46]. Gradient boosting The GB is an ensemble classifier that builds a series of weak learners (usually decision trees), where each successive tree corrects the errors of the previous one. It does this by minimizing the loss function using gradient descent. The model learns gradually, adding trees iteratively, with each one focusing on the residual errors from the preceding model. The GB is highly effective for complex data but can be computationally intensive and prone to overfitting without proper tuning [47]. K-nearest neighbors (K-NN) K-NN is a simple, instance-based learning algorithm used for both classification and regression. For a given data sample, K-NN identifies the ‘K’ closest data samples (neighbors) in the feature space and classifies the sample based on the majority class of these neighbors. For regression, it predicts the average of the target values of the neighbors [48]. K-NN is easy to implement but can be computationally expensive on large datasets and is sensitive to feature scaling and irrelevant features [49]. Logistic regression LR is a linear model primarily used for binary classification, although it can be extended for multi-class problems. It estimates the probability of a class label by applying a logistic function to a linear combination of input features [50]. LR is efficient and interpretable, but it assumes a linear relationship between features and the log odds of the output, which may limit its effectiveness with complex datasets [51]. AdaBoost The AdaB is an ensemble learning classifier that combines multiple weak learners to create a strong classifier. It focuses on misclassified data samples by adjusting the weights of each sample after every iteration so that subsequent models give more attention to previously misclassified samples. AdaBoost generally uses short decision trees (stumps) as weak learners. It is robust against overfitting to some extent but can be sensitive to noisy data and outliers [52]. XGBoost XGB is an optimized implementation of the gradient boosting algorithm, known for its speed and performance in structured/tabular data tasks. It introduces regularization parameters that help prevent overfitting, along with optimizations like parallel processing, tree pruning, and better handling of missing values. XGBoost is often used in competitions and high-stakes applications for its accuracy and efficiency, but it requires careful tuning to achieve optimal performance [53, 54]. This comprehensive evaluation ensures the proposed model’s performance is contextualized against the full spectrum of ML classifiers. The proposed methodology This section explains the proposed methodology; Fig. 3 presents the framework of the proposed DT model. The framework of the proposed model More comprehensively, this model consists of three main phases, which are as follows: Diabetes dataset Firstly, the diabetes dataset is loaded to be processed in this model as explained in Sect. 2.1. These datasets are IPDD and PIMA. Preprocessing steps In this model, four main preprocessing steps are used for the datasets: I.Preprocessing data: Different preprocessing steps are applied, such as:Identify features and target for both datasets.Map classes to numerical values (‘N’: 0, ‘P’: 1, ‘Y’: 2).Handle missing or unexpected values in ’Gender’.Fill missing ’Gender’ values with mode. Preprocessing data: Different preprocessing steps are applied, such as:Identify features and target for both datasets.Map classes to numerical values (‘N’: 0, ‘P’: 1, ‘Y’: 2).Handle missing or unexpected values in ’Gender’.Fill missing ’Gender’ values with mode. Identify features and target for both datasets. Identify features and target for both datasets. Map classes to numerical values (‘N’: 0, ‘P’: 1, ‘Y’: 2). Map classes to numerical values (‘N’: 0, ‘P’: 1, ‘Y’: 2). Handle missing or unexpected values in ’Gender’. Handle missing or unexpected values in ’Gender’. Fill missing ’Gender’ values with mode. Fill missing ’Gender’ values with mode. II.Split dataset: In this step, we split the diabetes dataset into 80% as training data and 20% as testing data. Split dataset: In this step, we split the diabetes dataset into 80% as training data and 20% as testing data. III.Feature selection: In the proposed model, the univariate ANOVA F-test ranking is applied as a feature selection method. This method is explained in Sect. 2.2. Feature selection: In the proposed model, the univariate ANOVA F-test ranking is applied as a feature selection method. This method is explained in Sect. 2.2. IV.SMOTE technique: Since the IPDD and PIMA datasets are imbalanced datasets, the SMOTE is applied to overcome this issue. More deeply, by applying this technique, it ensures that minority classes are over-sampled, thus enhancing the model performance on datasets characterized by imbalance. The main parameter of SMOTE is , which is set to 5. SMOTE technique: Since the IPDD and PIMA datasets are imbalanced datasets, the SMOTE is applied to overcome this issue. More deeply, by applying this technique, it ensures that minority classes are over-sampled, thus enhancing the model performance on datasets characterized by imbalance. The main parameter of SMOTE is , which is set to 5. Proposed model It mainly consists of two components: Scaling methods For each dataset, different feature scaling methods are used; evaluate them, select the best method, and adopt it as explained in Algorithm 1. Scaling methods For each dataset, different feature scaling methods are used; evaluate them, select the best method, and adopt it as explained in Algorithm 1. Optimize hyperparameters It includes defining the decision tree, setting the hyperparameters (Table 3), and applying the proposed model (Sect. 2.4). Optimize hyperparameters It includes defining the decision tree, setting the hyperparameters (Table 3), and applying the proposed model (Sect. 2.4). Results evaluation: The evaluation metrics based on the confusion matrix are computed. Simply, the confusion matrix is a table for measuring the performance of the classification models. It contains four cases that are true positives (TP), true negatives (TN), false positives (FP), and false negatives (FN) [55]. These cases are depicted in the following form: Most metrics depend on these cases. In this paper, six metrics are used to evaluate the results, which are as follows [55–58]: where: TPR and FPR are calculated by Eqs. (20) and (21) as follows: where: C: Total number of classes; C: Total number of classes; : Proportion of samples in class i; : Proportion of samples in class i; : AUC score treating class i as the positive class and all others as negative. : AUC score treating class i as the positive class and all others as negative. After the results of the hyperparameter space (Θ ) are evaluated, the best results are determined. According to these results, the best hyperparameters are identified. The steps of applying this model are detailed in Algorithm 2. Algorithm 2 The proposed DT model This algorithm evaluates DT hyperparameters using randomized search with cross-validation to ensure hyperparameter selection is statistically sound. This method addresses three critical drawbacks in previous works: (1) data leakage from hyperparameter tuning on full training data, (2) overfitting from point-estimate hyperparameter selection, and (3) lack of statistical validation of hyperparameter differences. To ensure full reproducibility of the results, the experiments are conducted on a personal HP laptop with specifications as listed in Table 4. Table 4The computational environment of the proposed modelNoSpecificationDetail1CPUIntel Core i7-10750 H CPU @ 2.60GHz2RAM64 GB3Operating systemWindows 11 Pro (64-bit)4Python version3.12.05Key librariesNumPy (1.26.0), Pandas (2.2.3), Scikit-learn (1.6.1), Matplotlib (3.10.1), Seaborn (0.13.2) The computational environment of the proposed model Experimental results The results of applying the proposed model are explained in Sect. 3.1, while Sect. 3.2 compares these results with the state-of-the-art, and finally, the discussion of the results is presented in Sect. 3.3. Results The results consist of two parts; the first part is for the IPDD dataset (subsection 3.1.1), while the second part is for the PIMA dataset (subsection 3.1.2). IPDD dataset The proposed model is first evaluated using the IPDD dataset, where the initial step involves applying a feature selection method. The number of selected features is eight, which are ‘LDL’, ‘HDL’, ‘BMI’, ‘HbA1c’, ‘AGE’, ‘Urea’, ‘Gender’, and ‘CR’. Different ML classifiers are applied on the IPDD dataset. The accuracy for these classifiers is shown in Fig. 4a. Figure 4b depicts the precision, while the recall metric results are clarified in Fig. 4c. Finally, Fig. 4d presents the F1_score for those classifiers. Different metrics of ML classifiers on IPDD dataset Then, different feature scaling methods are tested by the DT classifier on the IPDD dataset. The results of these methods are illustrated in Fig. 5. The accuracy, F1-score, and Friedman ranking on IPDD dataset Table 5 illustrates the results of the cross-validation for the IPDD dataset. Table 5Cross-validation results for IPDD datasetFoldAccuracyF1_macroMCCKappa199.0098.1496.4196.34299.0097.4496.4996.43396.0092.0385.3185.30498.5096.4594.4494.42597.5095.2390.7390.71 Cross-validation results for IPDD dataset Thereafter, the proposed model adopts the best scaling method, which is the MaxAbs scaler (Fig. 5). By using this scaling method, the proposed model is then implemented using the classic grid search, and its results are illustrated in Fig. 6a. While the results of implementing the proposed model with the randomized grid search are depicted in Fig. 6b, which shows the four metrics (accuracy, precision, recall, and F1_score). Furthermore, Fig. 6c clarifies the confusion matrix of the proposed model on the IPDD dataset. Finally, according to Fig. 4, the best ML classifiers are the RF; thus, we compute and then compare the ROC-AUC metric of the proposed model with RF and also DT as presented in Fig. 6d. Results of different metrics of the proposed model on the IPDD dataset While Table 6 lists the MCC values for the three models on the IPDD dataset. Table 6The MCC values for the DT, RF, and the proposed modelNoModelMCC (100%)1DT91.682RF73.893Proposed97.97 The MCC values for the DT, RF, and the proposed model The training accuracy of the proposed model on this dataset is 99.62%. By limiting evaluations to only 30 randomized trials under stratified 5-fold cross-validation, this model decreases the computational cost to be 150 results from fitting 5 folds for each of 30 candidates, totaling 150 fits. On the other hand, the classic grid search method requires 450 fits (fitting 5 folds for each of 90 candidates, totaling 450 fits). In the same context of hyperparameters, the best ones on the IPDD dataset are as follows: ‘criterion’: ‘entropy’ ‘criterion’: ‘entropy’ ‘max_depth’: 23 ‘max_depth’: 23 ‘min_samples_leaf’: 7 ‘min_samples_leaf’: 7 ‘min_samples_split’: 12 ‘min_samples_split’: 12 PIMA dataset The PIMA dataset is used as the second dataset for evaluating the proposed model. The selected features are 7, which are ‘Pregnancies’, ‘Glucose’, ‘BloodPressure’, ‘Insulin’, ‘BMI’, ‘DiabetesPedigreeFunction’, and ‘Age’. The results of applying different ML classifiers on the PIMA dataset are demonstrated in Fig. 7. More specifically, Fig. 7a demonstrates the accuracy metric for these classifiers, while Fig. 7b captures the precision. The recall scores are visualized in Fig. 7c, and finally, the F1_score is outlined in Fig. 7d. Different metrics of ML classifiers on PIMA dataset Thereafter, the feature scaling methods are employed by the DT classifier on the PIMA dataset as shown in Fig. 8, where the best method is the Power transformer that is adopted by the current model. The accuracy, F1-score, and Friedman ranking on PIMA dataset The results of the cross-validation for the PIMA dataset are listed in Table 7. Table 7Cross-validation results for PIMA datasetFoldAccuracyF1_macroMCCKappa175.6873.9268.2167.89274.3872.6565.8765.56376.3274.5869.5469.23473.7372.0164.6264.31575.0373.2967.2866.97 Cross-validation results for PIMA dataset Through using the Power transformer scaling method, the proposed model is applied with the classic grid search, as shown in Fig. 9a. While the four metrics of applying the proposed model are displayed in Fig. 9b. Figure 9c captures the confusion matrix. Finally, Fig. 9d clarifies the ROC-AUC metric for the DT, XGB, and the proposed models. Results of different metrics of the proposed model on the PIMA dataset The MCC values on the PIMA dataset are presented in Table 8. Table 8The MCC values for the DT, XGB, and the proposed modelNoModelMCC (100%)1DT47.12XGB25.93Proposed70.2 The MCC values for the DT, XGB, and the proposed model The training accuracy of the proposed model on the PIMA dataset is 77.83%. Since the proposed model limits the evaluations to just 30 randomized trials under stratified 5-fold cross-validation, this model reduces the computational cost from 450 fits (5 folds for each of 90 candidates, totaling 450 fits) to 150 fits (5 folds for each of 30 candidates, totaling 150 fits). In the same realm, the best hyperparameters on the PIMA dataset are as follows: ‘criterion’: ‘entropy’ ‘criterion’: ‘entropy’ ‘max_depth’: 5 ‘max_depth’: 5 ‘min_samples_leaf’: 9 ‘min_samples_leaf’: 9 ‘min_samples_split’: 19 ‘min_samples_split’: 19 Finally, the computational time for optimization, training, and testing are depicted in Table 9. Table 9Computational time (seconds) for IPDD and PIMA datasetsNoModelOptimizationTrainingTestingTotalIPDD dataset1Proposed model4.820.090.034.942Classic DT0.000.10.030.133RF0.000.290.050.344XGB0.000.210.080.295K-NN0.000.030.120.15PIMA dataset1Proposed model2.190.050.022.262Classic DT0.000.080.030.113RF0.000.160.040.24XGB0.000.20.040.245K-NN0.000.110.10.21 Computational time (seconds) for IPDD and PIMA datasets Results comparison From one method to another, the state-of-the-art methods differed in the pipeline steps, such as the number of selected features, processed class imbalance issue or did not, single train-test split, and applied only scaling method. In contrast, the proposed model uses identical conditions for both datasets (IPDD and PIMA). The results of this model demonstrate clear superiority against state-of-the-art methods, as are listed in Table 10. Table 10Comparative analysis v.s state-of-art models on IPDD and PIMA datasetsNoRef, YearClassifierAccuracy (%)IPDD dataset1[16], 2022DT95.02[18], 2023DT96.83[15], 2023DT75.84[17], 2024DT97.05[14], 2024SVM96.46[19], 2024DT97.997Proposed modelDT99.5PIMA dataset1[59], 2021DT74.242[15], 2023DT68.03[60], 2023DT75.654[17], 2024DT67.535[20], 2024DT72.06[44], 2024DT72.07[61], 2024DT72.328Proposed modelDT77.27 Comparative analysis v.s state-of-art models on IPDD and PIMA datasets Discussion This subsection discusses the analysis, rationale, and discussions for different aspects of the proposed model. Sensitivity analysis of feature selection method The proposed model firstly applied the univariate ANOVA F-test ranking (Sect. 2.2) as a feature selection method. This method selects the relevant and most important features for every dataset. For IPDD dataset, it selects eight features, which are ‘LDL’, ‘HDL’, ‘BMI’, ‘HbA1c’, ‘AGE’, ‘Urea’, ‘Gender’, and ‘CR’. While for PIMA, it selects seven features as follows ‘Pregnancies’, ‘Glucose’, ‘BloodPressure’, ‘Insulin’, ‘BMI’, ‘DiabetesPedigreeFunction’, and ‘Age’. The sensitivity analyses for IPDD and PIMA datasets are listed in Table 11. Table 11The total discriminative power across different number of features (k) on IPDD and PIMA datasetsNok valueΦ (k) %141405.376.26251698.192.15361680.791.21471722.493.47581737.794.3691715.293.087101730.493.918111655.398.83PIMA dataset13276.4783.1424304.0291.4335322.5096.9946319.095.9357330.4499.3868327.498.46 The total discriminative power across different number of features (k) on IPDD and PIMA datasets Furthermore, Table 12 captures the feature interactions by the univariate ANOVA F-test method. Table 12The feature interactions for IPDD and PIMA datasetsNoInteractionp-valueClinical relevanceIPDD dataset1BMI × AgeStrong predictor of insulin resistance2HbA1c × UreaIndicates kidney dysfunction in diabetes3Glucose × BMIShows metabolic syndrome patternsPIMA dataset1BMI × AgeStrong predictor of insulin resistance2Glucose × BMIShows metabolic syndrome patterns (high glucose + high BMI)3Age × GlucoseReflects progressive nature of beta-cell dysfunction4SkinThickness × BMICorrelates with visceral fat distribution and insulin resistance5Glucose × InsulinIndicates impaired insulin response to hyperglycemia6Pregnancies × AgeHighlights gestational diabetes risk in older mothers The feature interactions for IPDD and PIMA datasets Despite the ANOVA F-test is an univariate method, the selected features for both datasets capture the strongest clinical interactions, justifying this methodological choice. Besides the ANOVA F-test (univariate) method, we conducted the polynomial features + ANOVA that achieved an accuracy of 98.43% and 76.18% for the IPDD and PIMA datasets, respectively. By using different numbers of features, Table 13 displays all the metrics. In this Table, FN refers to the feature number. Table 13The metrics according to different feature numbers on IPDD and PIMA datasetsNoFNAccPreRecF1ROCMCCIPDD dataset1799.0599.1199.0699.1499.4397.162899.5099.5299.5099.5199.8097.973998.8198.8598.8198.8099.1296.9241098.6798.6998.6798.7198.3296.9051197.3897.3197.3997.4098.0096.51PIMA dataset1676.7076.6876.7076.7377.2469.512777.2777.1977.2777.2377.9070.23875.8975.7175.8975.8674.1369.04 The metrics according to different feature numbers on IPDD and PIMA datasets Rationale for choosing 30 iterations in randomized search The number of iterations is determined empirically based on the convergence of the cross-validated performance metric. More deeply, a convergence study is conducted by running randomized search CV through (n_iter) ∈ [5, 10, 20, 30, 40, 50] (10 independent repetitions per setting) on the same datasets and hyperparameter space. Then, computing the mean accuracy with 95% confidence intervals (CI) [62] as illustrated in Table 14. Table 14The accuracy of different numbers of n_iterations on IPDD and PIMA datasetsNoAccuracyIPDDPIMA1598.25 ± 0.42 [97.81–98.69]75.97 ± 0.85 [75.12–76.82]21099.22 ± 0.28 [98.94–99.50]76.12 ± 0.67 [75.45–76.79]32099.37 ± 0.19 [99.18–99.56]77.03 ± 0.52 [76.51–77.55]43099.50 ± 0.12 [99.38–99.62]77.27 ± 0.38 [76.89–77.65]54099.24 ± 0.21 [99.03–99.45]77.00 ± 0.41 [76.59–77.41]65099.08 ± 0.25 [98.83–99.33]76.99 ± 0.45 [76.54–77.44] The accuracy of different numbers of n_iterations on IPDD and PIMA datasets Results demonstrate that both IPDD (99.50 ± 0.12%) and PIMA (77.27 ± 0.38%) datasets achieve peak performance at n_iter=30, with standard deviations below 0.4%, which confirms statistical stability. The 95% CI proves that the 0.2% difference between n_iter=30 and n_iter=50 falls within measurement uncertainty. Theoretically, according to [63, 64], \ge 20–30 random trials consistently find near-optimal configurations, exceeding the classic grid search. The minimum number of iterations at which configuration stability and performance converge is n_iter = 30, meeting the parsimonious optimization criterion. As a result, the randomized search samples from continuous distributions (range-based optimization), covering the entire parameter space rather than discrete grid samples. This method achieves 99.5% accuracy on the IPDD dataset with lower evaluations than classic grid search, which provides the optimal trade-off between performance, efficiency, and reproducibility for clinical deployment. Rationale for hyperparameter selection The hyperparameter values for the randomized grid search are listed in Table 3. The rationale to select these values is as follows: Split criterion (‘gini’, ‘entropy’): Computationally, the ‘gini’ is an efficient (faster training) and sufficient for high-separation datasets such as the IPDD, while the ‘entropy’ is more sensitive to feature interactions (like BMI × Age).Accordingly, both criteria are standard in clinical ML. Split criterion (‘gini’, ‘entropy’): Computationally, the ‘gini’ is an efficient (faster training) and sufficient for high-separation datasets such as the IPDD, while the ‘entropy’ is more sensitive to feature interactions (like BMI × Age). Accordingly, both criteria are standard in clinical ML. Maximum tree depth (max_depth): It is set to [5–50] in this model.Clinical constraint: Mostly, the trees deeper than 50 become uninterpretable for clinicians [60].Computational trade-off: Depth \ge 50 increases computational costs exponentially with minimal accuracy gain [65]. Maximum tree depth (max_depth): It is set to [5–50] in this model.Clinical constraint: Mostly, the trees deeper than 50 become uninterpretable for clinicians [60].Computational trade-off: Depth \ge 50 increases computational costs exponentially with minimal accuracy gain [65]. Clinical constraint: Mostly, the trees deeper than 50 become uninterpretable for clinicians [60]. Clinical constraint: Mostly, the trees deeper than 50 become uninterpretable for clinicians [60]. Computational trade-off: Depth \ge 50 increases computational costs exponentially with minimal accuracy gain [65]. Computational trade-off: Depth \ge 50 increases computational costs exponentially with minimal accuracy gain [65]. Minimum samples to split (min_samples_split): Through the range [2–20], the proposed model is tested. The minimum 2 samples ensures basic node validity (avoiding single-sample splits). Practically, for IPDD’s small minority classes, values >10 risk ignoring pre-diabetic patterns. Minimum samples to split (min_samples_split): Through the range [2–20], the proposed model is tested. The minimum 2 samples ensures basic node validity (avoiding single-sample splits). Practically, for IPDD’s small minority classes, values >10 risk ignoring pre-diabetic patterns. Minimum samples per leaf (min_samples_leaf): It is determined to be [1–10] in the current model. Based on the dataset-specific tuning, for IPDD’s 1000 samples and PIMA’s 768 samples, min_samples_leaf=1 is viable, while in another disease it is not; for example, the endocrinologists require \ge 2 cases per decision rule [66]. Minimum samples per leaf (min_samples_leaf): It is determined to be [1–10] in the current model. Based on the dataset-specific tuning, for IPDD’s 1000 samples and PIMA’s 768 samples, min_samples_leaf=1 is viable, while in another disease it is not; for example, the endocrinologists require \ge 2 cases per decision rule [66]. Rational to choose the DT Due to clinical interpretability requirements and empirical evidence indicating that a properly tuned decision tree (DT) outperforms alternative ML classifiers on both datasets, the DT was selected as the base model in this study. Importantly, the proposed model–combining a decision tree with randomized search and hyperparameter tuning–preserves the intrinsic transparency of DTs, which is a prerequisite for clinical adoption, while enhancing its performance from a weak classifier to a competitive one. Furthermore, the DT classifier is easy to interpret. It generates decision rules that are easily understood by humans, which is essential for clinicians’ confidence and applicability in classifying diabetes risk [67]. The observed performance improvement stems from enhanced SMOTE synthetic sample quality rather than DT sensitivity. This nuance is critical for the proposed methodological transparency: scaling benefits the preprocessing pipeline, not the DT itself. Results of IPDD dataset Comparison and enhancement (Figure 6b) By applying the proposed model, all the metrics improve by approximately 1% when compared to the same model but with the classic grid search method. More specifically, the accuracy increases from 98.50% to 99.50%, which reflects a substantial gain in the total correctness. For the precision and recall metrics, they increase above 99.5%, explaining the near-perfect balance between minimizing false positives and capturing true positives (Fig. 6c). Finally, the F1_score metric reaches 99.51%, confirming an excellent harmonic mean of the precision and recall. ROC-AUC and MCC metrics (Fig. 6d and Table 6): These two metrics are particularly valuable for evaluating the model performance in imbalanced datasets, as they provide a more comprehensive evaluation than accuracy alone. Our proposed model achieves the best overall performance as excellent discrimination and balance in these two metrics. The score of the ROC-AUC of 99.80% and MCC of 97.97% indicates the near-perfect discrimination capability. This model is perfect for clinical applications where precise, equitable, and consistent predictions are crucial because it performs exceptionally well across all evaluation aspects. These results emphasize how crucial it is to use additional metrics, such as MCC, in addition to ROC-AUC to guarantee thorough model validation. Despite the RF classifier achieving an accuracy of 98.00% on the IPDD dataset (Fig. 4a), the proposed model attains 99.50% on the same dataset, providing two critical advantages for clinical deployment: (1) Interpretability: It generates transparent decision rules (such as ‘IF HbA1c \ge 6.5% AND BMI \ge 30 → Diabetic’) that clinicians can validate and trust, unlike RF’s black-box predictions, and (2) Prediction time: The prediction time for the RF is 1.8 ms, while it is 1.2 ms for the proposed model. Results of PIMA dataset Comparison and enhancement (Figure 9b): The results demonstrate the efficacy of the proposed model on the PIMA dataset by showing its performance is better than the traditional grid search variant across all evaluation metrics. With results of 77.27% accuracy, 77.19% precision, 77.27% recall, and 77.23% F1_score, this model demonstrates a reliable and steady performance across all assessed criteria. Thus, it clearly outperforms the traditional grid search variant, which produces somewhat lower scores (ranging from 75.72% to 75.97%), making the proposed model a more reliable and efficient choice for diabetes prediction tasks on this dataset. As a result, the performance gap between IPDD (99.5%) and PIMA (77.27%) reflects genuine structural and behavioral differences between these datasets. For the IPDD dataset, this model demonstrates exceptionally strong class separability due to (1) population homogeneity reducing feature variance and (2) consistent diagnostic protocols. This aligns with prior work on the IPDD dataset ([17] and [19]), which also reported >97% accuracy. While such performance is unattainable on heterogeneous datasets like PIMA (with an accuracy of 77.27%), it demonstrates our model’s effectiveness for region-specific diabetes diagnosis where clinical measurements show strong discriminative power. Limitations While the proposed model demonstrates strong performance on the IPDD and PIMA datasets, several limitations are identified, which are as follows: Feature selection method: The proposed model achieves an accuracy of 99.5% on the IPDD dataset and 77.27% on the PIMA dataset. One of the main reasons for the latter accuracy includes the univariate method’s limitations on datasets with binary class separation. On the other hand, not applying any feature selection method will inevitably lead to increased accuracy [7], but it will take more time, even if the classifier attains good classification results, such as the work of [68], which achieved an accuracy of 76.07% by the DT. Feature selection method: The proposed model achieves an accuracy of 99.5% on the IPDD dataset and 77.27% on the PIMA dataset. One of the main reasons for the latter accuracy includes the univariate method’s limitations on datasets with binary class separation. On the other hand, not applying any feature selection method will inevitably lead to increased accuracy [7], but it will take more time, even if the classifier attains good classification results, such as the work of [68], which achieved an accuracy of 76.07% by the DT. Dataset size: The paper’s datasets are relatively small, and it might not accurately capture the intricacy of real-world situations. Larger DM datasets are required since the small dataset can limit the complexity and generalizability of the model. Moreover, testing alternative oversampling methods (such as Adaptive Synthetic Sampling (ADASYN)) might generate synthetic samples adaptively near decision boundaries, thereby improving minority-class representation. Dataset size: The paper’s datasets are relatively small, and it might not accurately capture the intricacy of real-world situations. Larger DM datasets are required since the small dataset can limit the complexity and generalizability of the model. Moreover, testing alternative oversampling methods (such as Adaptive Synthetic Sampling (ADASYN)) might generate synthetic samples adaptively near decision boundaries, thereby improving minority-class representation. Improvement results: Despite this model achieving good results on the IPDD dataset, it requires improvement on the PIMA dataset, while the current accuracy is 77.27%. In the same regard, this limitation is not unique to the proposed model; many other studies reported low accuracy scores on this dataset (Part 2- Table 10). Improvement results: Despite this model achieving good results on the IPDD dataset, it requires improvement on the PIMA dataset, while the current accuracy is 77.27%. In the same regard, this limitation is not unique to the proposed model; many other studies reported low accuracy scores on this dataset (Part 2- Table 10). Future work In the future work, we plan to apply deep learning as a feature selection method to improve the results of the PIMA dataset. Moreover, we also plan to enhance accessibility in resource-constrained settings via smartphone deployment in rural clinics to exploit the optimization of mobile edge devices. Conclusion With its steadily increasing incidence and prevalence, Diabetes Mellitus (DM) is one of the biggest global public health concerns of the twenty-first century. Indeed, DM reduces life expectancy and quality of life. On the other hand, it is possible to decrease the severity of DM and its consequences by detecting this chronic condition early. Thus, DM is considered one of the greatest challenges for health institutions and governments alike. This paper suggests a decision tree (DT) model with a randomized grid search for diabetes diagnosis by (1) using eight different feature scaling methods, and (2) tuning the hyperparameters via randomized grid search to determine the best configuration. Two public diabetes datasets, IPDD and PIMA, are used to evaluate the proposed model, while accuracy, precision, recall, F1_score, Area Under the Curve (AUC), and Matthews Correlation Coefficient (MCC) are the metrics to measure the results. The findings are 99.5%, 99.52%, 99.5%, 99.51%, 99.8%, and 97.97% on the IPDD dataset and 77.27%, 77.19%, 77.27%, 77.23%, 77.9%, and 70.2% on the PIMA dataset for the six metrics, respectively. Moreover, different machine learning classifiers, including classic decision tree, K-nearest neighbors, logistic regression, support vector machine, AdaBoost, random forest, gradient boosting, and XGBoost, are applied in this paper to compare the results. Finally, this model represents more than just a model; it is a strategic healthcare asset that can enhance worldwide efforts to fight the diabetes epidemic, lower systemic costs, and improve individual outcomes. Acknowledgements The authors would like to express their deepest gratitude to the Al-Mustaqbal University, the Universiti Kebangsaan Malaysia, and Al-Bayan University for their invaluable support in the publication of this paper. Author contributions CREDIT author statement: The following contributions were made by each author to this work: M. M. A.: Writing - review & editing, Project administration; I. O. A: Methodology, Final writing; M. S. K.: Investigation, Visualization, Resources; A.D. R.: Data curation, Formal analysis, Writing; N.S.S.: Funding acquisition, Validation, Original draft; H.A.A.A.: Conceptualization, Methodology, Supervision; M.A.A.S.: Software, Formal analysis; M. A. A.: Conceptualization, Methodology; R. M. A.: Visualization, Writing. All authors reviewed and approved the final version of the manuscript. Funding This research was funded by the Universiti Kebangsaan Malaysia (Grant code: FRGS/1/2024/ICT06/UKM/02/3). Data availability The datasets for this paper are available at: 1. https://raw.githubusercontent.com/jbrownlee/Datasets/master/pima-indians-diabetes.data.csv 2. https://data.mendeley.com/datasets/wj9rwkp9c2/1 Declarations Ethics approval and consent to participate Not applicable. Consent for publication Not applicable. Competing interest The authors declare that they have no competing interest. Footnotes https://diabetesatlas.org/ Publisher's Note Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations. Mudatheer M. Al-Slivani, Ibrahim O. Alrubaye, Mayameen S. Kadhim, Ahmed Dheyaa Radhi, Nor Samsiah Sani, Hussein A.A. Al-Khamees, Mohd Aliff Afira Sani, Mohammed Amin Almaiah, Rusul Mansoor Al-Amri have equally contributed to this work. Contributor Information Nor Samsiah Sani, Email: norsamsiahsani@ukm.edu.my. Hussein A. A. Al-Khamees, Email: Hussein.Alkhamees@uomus.edu.iq References Associated Data Data Availability Statement The datasets for this paper are available at: 1. https://raw.githubusercontent.com/jbrownlee/Datasets/master/pima-indians-diabetes.data.csv 2. https://data.mendeley.com/datasets/wj9rwkp9c2/1