## 5 Simulation
### Experimental Setup
#### 5.1.2 Dataset and Preprocessing  
The Human Activity Recognition Using Smartphones (HAR) dataset [47] is utilized in this study to evaluate the performance of the proposed framework. The HAR dataset comprises data collected from 30 participants performing six distinct activities: walking, walking upstairs, walking downstairs, sitting, standing, and laying. These data were captured using embedded accelerometers and gyroscopes in smartphones placed on the participants' waists. The dataset includes a total of 10,299 instances, each represented by 561 features derived from time- and frequency-domain variables.  
To simulate real-world IoT scenarios, each IoT device in our experiments is assigned data from a single participant. This configuration introduces non-IID characteristics across clients, as each participant's data reflects their individual activity patterns. While all participants contribute data for all six activities, the proportion of each activity varies across clients, leading to heterogeneity in label distributions. This evaluation method effectively captures the heterogeneity inherent in real-world IoT environments, where devices often produce data with distinct characteristics shaped by factors such as user behavior, sensor placement, and environmental conditions, leading to varying label distributions across clients. To ensure transparency, we have analyzed the dataset's heterogeneity in detail. To quantify the heterogeneity of the dataset, we analyzed the label distributions across clients using several metrics. The entropy of each client's label distribution ranges from 1.747 to1.790, indicating a relatively high level of diversity within individual client data. To measure the differences in label distributions between clients, we calculated the Jensen-Shannon Divergence (JS Divergence) and Earth Mover's Distance (EMD) between all pairs of clients. The average JS Divergence is 0.0548 (ranging from 0.0128 to 0.1636), and the average EMD is 0.2103 (ranging from 0.0239 to 0.7634). These values suggest a moderate level of heterogeneity in label distributions across clients. The heterogeneity of the HAR dataset was analyzed using entropy, Jensen-Shannon Divergence, and Earth Mover's Distance. As described above, the entropy ranges from 1.747 to 1.790, the average JS Divergence is 0.0548, and the average EMD is 0.2103. These analyses demonstrate that the dataset exhibits a moderate level of heterogeneity in label distributions, making it representative of real-world IoT scenarios with naturally varying data distributions.  
It is important to note that the primary objective of our framework is to enhance privacy and efficiency in federated learning rather than directly improving model accuracy. Therefore, the evaluation focuses on the framework's ability to maintain performance across heterogeneous clients rather than addressing issues such as extreme class imbalance, which are beyond the scope of this study. The HAR dataset allows us to showcase the framework's ability to handle heterogeneous data distributions while maintaining its core objectives. Specifically, the proposed hierarchical aggregation and lightweight encryption mechanisms are designed to maintain privacy and reduce communication overhead while accommodating the diverse data patterns inherent in IoT networks.  
This experimental design ensures that our framework is evaluated in both small-scale and large-scale settings, capturing the scalability challenges and data diversity present in real-world deployments. By assigning a single user's data to each IoT device, we simulate realistic scenarios that reflect the heterogeneity of user-generated data, therefore providing a comprehensive assessment of the framework's performance under varying conditions.