## 4 Research Methodology
### The Proposed Fuzzy KNN (TFKNN) Based on Uncertainty
9 DOUNTIL (\(x\) assigned membership in all classes)
10 Compute \(u_{A}(x)=\frac{\sum_{i=1}^{k}u_{i}\left(1/\left\|x-X_{i}\right\|^{2/(m-1)} \right)}{\sum_{i=1}^{k}\left(1/\left\|x-X_{i}\right\|^{2/(m-1)}\right)}\)
11\(\omega_{1}=\max\left(0,\frac{1}{1-e^{u_{A}(x)}}\right)\)
12 Compute \(u_{B}(x)=\frac{1/\left\|x-Z_{i}\right\|^{2/(m-1)}}{\sum_{i=1}^{k}\left(1/ \left\|x-Z_{i}\right\|^{2/(m-1)}\right)}\)
13\(\omega_{2}=\max\left(0,\frac{1}{1-e^{u_{B}(x)}}\right)\)
14 Compute \(u_{i}(x)=(\omega_{1}u_{A}(x)+\omega_{2}\mu_{B}(x))\)
15 Increment \(i\)
16 ENDDOUNTIL
17 Classify \(y\): set \(l\ max_{i\leq j\leq n}\{u_{i}(x)\}\)
18 END
```  
**Algorithm 2** Fine-Tuning Fuzzy KNN based on Uncertainty (TFKNN). We have calculated the time and space complexity of the different classification algorithms in terms of Big-O. Even though fuzzy KNN has the worst value(s) at the complexity levels, it is the best in practice in terms of evaluation metrics. In turn, to achieve higher accuracy, precision, recall, and f-measure, we have to pay the cost in terms of complexity. The fuzzy KNN computes the uncertainty membership function for each instance before classification relative to the complete number of instances, which yields a square computation relation. This relation is very important to determine the relative class of the current instance versus other algorithms that classify it without inspecting the uncertainty value of the instance for each category. We think it is acceptable to be in the second level of complexity compared to improvements in the classification metrics at the healthcare system, where decisions are critical and have a direct impact on human care. Hence, the uncertainty and membership function helps improve predictions about human lives and health decisions to be more reliable, accurate, and concise. Additionally, as a plan to overcome this challenge(s), there is scheduled work to re-arrange the membership function of TFKNN to be referenced pre-computed once as a lookup map, as shown in Table 5.  
Because the proposed TFKNN based on uncertainty membership function has hyperparameters, it is subject to performance leakage due to their value(s). In turn, the proposed TFKNN is tuned by a grid search to identify the best values of the hyperparameters for deriving the optimal performance in terms of classification metrics for PIDD. The fine-tuning process includes searching for optimal values of other regular classifiers such as KNN, NB, and DT to benchmark and empirically analyse the classifiers' performance in response to the fine-tuning. Figure 6 represents the fine-tuning and proposed workflow of the proposed algorithm, TFKNN, Fuzzy KNN, KNN, NB, and DT for classifying diabetes in pregnant women. The major objective of the fine-tuning procedure is to improve the classification metrics like accuracy, recall, and AUC. In the workflow, the input dataset is evaluated using the cross-hold validation method; this is described below in detail as a hybrid mix of cross-fold and hold-out validation methods. The validation method supports the avoidance of overfitting problems and estimates the hyperparameters to derive the best accuracy rate. During the preprocessing phase, a correlation matrix is calculated to investigate the relationship between the features, as well as the relationship between the input features and the class label. The membership values for each sample are calculated using Equations (7)-(9), as all the neighbors closest to the class are distinguished based on their closeness to it. For each instance (x), a Euclidean distance is estimated for each category in the classification space, and the appropriate membership value(s) is assigned using a suitable membership formula. The process is iterative and repetitive until unclassified instance(s) are assigned to a class.