## 4 K-Anonymity-Based SHFL
### Secure Hierarchical Distributed Architecture
#### 4.1.2 K-Anonymity-Based Regrouping of Anonymous Clusters of SHFL
**The density of object \(x\)** in the client space \(ZT\) is defined as follows, where \(k\) denotes the density and \(x\) denotes the object: \[DenK(x,ZT)=\frac{1}{DistKN(x,ZT)}.\] (21)
4. **The Local Reachability Density** (LRD) of the device is the opposite of the average RD of K-NN based on the device \(x\). The following equation calculates the LRD: \[LRD_{k}(x,ZT)=\frac{|N_{k}(x)|}{\sum_{y\in N_{k}(x)Reachdist_{k}(x,y)}}.\] (22)
5. **Local Outlier Factor** (LOF) characterizes \(x\) as an outlier, which is calculated by the following equation: \[LOF_{k}(x)=\frac{\sum_{y\in N_{k}(x)}\frac{LRD_{k}(y,ZT)}{LRD_{k}(x,ZT)}}{|N_ {k}(x)|}.\] (23)

Figure 2: Privacy preserving K-Anonymity architecture integrated with SHFL. **Centrifugal degree of the anonymous group** is the average distance between the anchor and other points in the anonymous group. If the anonymous group \(C\) uses \(m\) as its anchor, the centrifugal degree \((Cd)\) of \(m\) can be calculated as follows:

\[Cd(c)=\frac{\sum_{xc}distance(x,z)}{|N_{k}(x)|}. \tag{24}\]

In the proposed SHFL, a cluster loop is constructed, and the dataset is divided equally among all \(U_{j}\) nodes and \(V_{i}\) member nodes of the anchors. The anchor nodes represent the LCs with local models, and the member nodes are \(V_{i}\) with intra-local models. The datasets were initialized over all nodes for training and testing. The anchor nodes react according to the queries of the member nodes, aggregate the updates, and forward them to the cloud server after achieving the required degree of anonymity. The clustering process continues for newly arrived nodes over the network, along with their anonymity handling. In addition, the anchor nodes utilize the above-mentioned parameters to check the node's location, neighbor distance, and k-neighbor density to determine the LOF and centrifugal degree. The initial anonymous group dataset \(V_{i}\) and completion of the initial partition of the anonymous group follow the traversal of all these parameters. Anonymous groups can be modified at runtime to remove the outliers to enhance the query service quality. Additionally, the anonymous groups beneath the \(U_{j}\) anchors are ranked in the reverse order according to the centrifugal degree. The cluster radius and dynamic locations of the nodes also play crucial roles in adjusting the group anonymity. This anonymous group adjustment is executed periodically after the anonymity process of the anonymous server and LBS servers. ## 5 Experiments

**Model Definition**: In the experiment, we performed the image classification tasks over distributed federated settings. We selected the full-size MNIST [35] and CIFAR-10 [36] benchmark datasets to investigate the proposed SHFL and validate the usability of the smart devices in the IoT. In addition, we utilized the COVID-19 [37] dataset to develop a healthcare application of SHFL. We performed extensive simulation experiments by varying the computation rate of LCs and ILCs. To evaluate the performance of SHFL in real-time healthcare applications, we altered different parameters to analyze the performance comprehensively. We constructed a CNN client model for all three datasets by creating \(5\times 5\) convolutional layers. The model divides the dataset into equal-sized shards according to the number of LCs and ILCs. Table 2 lists the benchmark hyperparameters. **System Configuration**: Our simulation experiments were conducted on a CPU i9-9980 HK @ 2.40 GHz with 32 GB RAM. The SHFL framework was designed using Python in TensorFlow. **Data Distribution**: In all our experiments, we used the pathological \(non-iid\) distribution of data, where each LC can only receive images corresponding to eight labels; thus, each LC receives minimum 300 samples. The data were divided into distinct clusters using the \(non-iid\) distribution, and each cluster was evenly split across numerous LCs and ILCs.