# Joint Resource Allocation and Learning Optimization for UAV-Assisted Federated Learning
## 2 System Model and Problem Formulation  
As shown in Figure 1, we consider an FL wireless network that consists of UAV \(m\) and \(N\) users, denoted as a set by \(\mathcal{N}=\{1,2\ldots N\}\). The users of the UAV service range are represented by set \(\mathcal{N}_{m}\), with \(N_{m}\) users. As the central party of FL, the UAV first initializes a global model, and then sends it to users within its service range. After receiving the model, the users update it according to the local dataset, and upload the updated model to the UAV, which then aggregates the local model weighted.  
Each user \(n\) has a dataset \(\mathcal{D}_{n}\), with \(D_{n}\) data samples. For dataset \(\mathcal{D}_{n}=\{\mathbf{x}_{nk},y_{nk}\}_{k=1}^{D_{n}}\), \(\mathbf{x}_{nk}\in\mathbb{R}^{d}\) is an \(k\)-th input data of user \(n\) and \(y_{nk}\) is its corresponding label. According to the local dataset \(\mathcal{D}_{n}\), the user \(n\) updates the FL model, and the loss function of user \(n\) is  
\[f_{n}(\mathbf{w})=\frac{1}{D_{n}}\underset{k\in\mathcal{D}_{n}}{\sum}f( \mathbf{w},\mathbf{x}_{nk},y_{nk}),\forall n\in\mathcal{N}_{m} \tag{1}\]  
where \(\mathbf{w}\) denotes the neural network model parameters; and the loss function \(f(\mathbf{w},\mathbf{x}_{nk},y_{nk})\) measures neural network model parameters \(\mathbf{w}\) on user \(n\)\(k\)-th sample models differ degree.  
\begin{table}
\begin{tabular}{c c c c} \hline \hline
**Symbol** & **Definitions** & **Symbol** & **Definitions** \\ \hline \(\mathbf{x}_{nk}\) & \(k\)-th input data of user \(n\) & \(\epsilon_{0}\) & global accuracy \\ \hline \(\mathbf{w}\) & neural network model parameters & \(N_{0}\) & noise power spectral density \\ \hline \(s\) & neural network model \(\mathbf{w}\) size & \(p^{\max}\) & maximum transmission power \\ \hline \(h_{r}\)\(\theta\) & UAV altitude, UAV angle & \(f^{\max}\) & maximum calculated frequency \\ \hline \(\mathbf{q}_{m}=\{x_{m},y_{m}\}\) & UAV \(m\) horizontal placement & \(T\) & the completion time of FL \\ \hline \(\mathbf{q}_{n}=\{x_{n},y_{n}\}\) & user \(n\) placement & \(B\) & total bandwidth \\ \hline \(r\) & coverage radius of the UAV & \(\rho\) & weight coefficient \\ \hline \(l_{l}\), \(l_{g}\) & local training rounds, global rounds & \(L\), \(\gamma\), \(\xi\) & parameter associated with the loss function \\ \hline \hline \end{tabular}
\end{table}
Table 1: _Cont._  
Figure 1: System model.  
Meanwhile, for different FL tasks, the neural network defines a different loss function; usually mean square error or cross entropy is used as the loss function.  
After user \(n\) completes the model training and updates according to the local dataset, it is uploaded to the UAV. The UAV \(m\) aggregates the collected local model, and its aggregate model and loss function are  
\[\mathbf{w}=\sum\limits_{i\in\mathcal{N}_{m}}^{|\mathcal{N}_{m}|}\frac{D_{i}}{D _{m}}\mathbf{w}_{i} \tag{2}\]  
\[F(\mathbf{w})=\sum\limits_{i\in\mathcal{N}_{m}}^{|\mathcal{N}_{m}|}\frac{D_{i} }{D_{m}}f_{i}(\mathbf{w}) \tag{3}\]  
where \(D_{m}=\sum\limits_{i\in\mathcal{N}_{m}}^{|\mathcal{N}_{m}|}D_{i}\) represents the total data amount of users participating in FL within the service range of the UAV \(m\).  
The goal of FL is to constantly repeat the user local model update and to transmit it to the UAV for aggregation to minimize \(F(\mathbf{w})\), and finally obtain \(\mathbf{w}\) that satisfies the demand. That is  
\[\underset{\mathbf{w}}{\min}F(\mathbf{w})=\underset{\mathbf{w}}{\min}\sum \limits_{i\in\mathcal{N}_{m}}^{|\mathcal{N}_{m}|}\frac{D_{i}}{D_{m}}f_{i}( \mathbf{w}) \tag{4}\]  
In order to solve (4), the DANE algorithm was used to solve the problem. The specific process details have been shown in [10], so we will not elaborate too much here.