# Hierarchical Federated Learning for Edge-Aided Unmanned Aerial Vehicle Networks
## 3 Hierarchical FL Algorithm
Table 2 lists the performance of the proposed hierarchical FL algorithm in terms of the average test accuracy and the percentage of UAVs reaching the target accuracy levels, for both scenarios by varying the hyperparameters \(C\), \(k_{1}\), and \(k_{2}\). In Scenario I, almost all results with different values of \(C\) converge to more than 98% average accuracy across the UAVs. However, there is an insignificant difference in accuracy with higher values of \(C\), but the percentage of UAVs with more than 98% test accuracy increases noticeably, in which moving from \(C=0.1\) to \(C=0.6\) results in approximately 10% difference. The increase in the number of iterations also leads to a significant improvement in terms of the percentage of UAVs reaching the target accuracy in both scenarios for all values of \(C\). Based on these results, there is a little advantage in increasing the number of participating UAVs if the other hyperparameters are tuned carefully. In addition, the high fraction of UAVs leads to significantly more communication and computational overheads, which might be an issue in practical resource-constrained edge-aided networks. \begin{table}
\begin{tabular}{c c c c c c c} \hline \hline  & \multicolumn{2}{c}{**Scenario I**} & \multicolumn{2}{c}{**Scenario II**} & \multicolumn{2}{c}{**Scenario III**} \\ \hline  & **Accuracy** & **\% UAVs** & **Accuracy** & **\% UAVs** & **Accuracy** & **\% UAVs** \\ \hline Proposed & 98.3\% & 66\% & 80.8\% & 65\% & 78.51\% & 55\% \\ FedAvg & 62\% & 6\% & 69.7\% & 7.2\% & 62.3\% & 3.4\% \\ HierFAVG & 84.3\% & 26\% & 77.5\% & 55.6\% & 74.1\% & 45.3\% \\ HFEL & 85.7\% & 28\% & 77.7\% & 57.8\% & 73.8\% & 43.2\% \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Performance comparisons of average test accuracy and the percentage of UAVs reaching the target accuracy of 98% for Scenario I and 80% for Scenario II after 50 global aggregations. \begin{table}
\begin{tabular}{c c c c c c c} \hline \hline  & \multicolumn{4}{c}{**Scenario I**} & \multicolumn{2}{c}{**Scenario II**} \\ \hline \(C\) & \(k_{1}\) & \(k_{2}\) & **Accuracy** & **\% UAVs** & **Accuracy** & **\% UAVs** \\ \hline  & 1 & 1 & 98.1 & 46 & 74.4 & 48.8 \\  & 5 & 1 & 98.2 & 54 & 76.6 & 57.8 \\
0.1 & 5 & 5 & 98.4 & 60 & 80.1 & 64.4 \\  & 10 & 5 & 98.7 & 62 & 79.1 & 60 \\  & 30 & 10 & 98.6 & 62 & 76.9 & 56.1 \\ \hline  & 1 & 1 & 97.8 & 42 & 77.2 & 54.4 \\  & 5 & 1 & 97.9 & 44 & 78.7 & 58.3 \\
0.2 & 5 & 5 & 98.6 & 60 & 80.8 & 64.4 \\  & 10 & 5 & 98.6 & 68 & 80.5 & 62.2 \\  & 30 & 10 & 98.3 & 56 & 77.7 & 59.4 \\ \hline  & 1 & 1 & 98 & 40 & 77.6 & 54.4 \\  & 5 & 1 & 98.4 & 56 & 79.4 & 59.4 \\
0.4 & 5 & 5 & 98.7 & 72 & 80.7 & 65.5 \\  & 10 & 5 & 98.7 & 68 & 80.4 & 61.7 \\  & 30 & 10 & 98.6 & 62 & 77.7 & 56.7 \\ \hline  & 1 & 1 & 98.2 & 54 & 78.5 & 58.8 \\  & 5 & 1 & 98.7 & 62 & 79.02 & 60.5 \\
0.6 & 5 & 5 & 98.8 & 64 & 81.5 & 68.3 \\  & 10 & 5 & 98.7 & 64 & 80.9 & 65.5 \\  & 30 & 10 & 98.9 & 72 & 79.01 & 61.1 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Performance of the hierarchical FL with different choices of hyperparameters \(C\), \(k_{1}\), and \(k_{2}\) for Scenarios I and II after 50 global aggregations. To further analyze the generalization of the proposed algorithm, we perform an additional set of experiments in NLP (natural language processing) tasks, using Shakespeare and Sent140 datasets from the LEAF [30] benchmarks suite. We sample the users in non-i.i.d. fashion, where each speaking role and tweeter user represents the individual user in FL settings. For the Shakespeare dataset, we consider the model with the embedding layer that maps the input into 8 dimensions and LSTM of 2 layers with 256 units followed by a fully connected layer for prediction. We use the input the sequence with 80 characters, learning rate of 1.0 and 549 users with the participation rate \(C\) of 0.1. For the Sent140 dataset, we construct a similar model with 2 layer LSTM with 100 units following pretrained 300D GloVe embeddings [31] that takes a sequence with 25 characters as an input.