## 6 Federated Learning for Early Health Prediction
### Federated Learning Methodology  
Figure 6 shows the training process of a federated learning model for early health prediction. The methodology of federated learning with edge devices involves the following steps:1. **Data Distribution**: The training data are distributed across multiple edge devices. Each device holds its own local data, which may be collected from different sources or users. 2. **Local Model Training**: A local model is trained using its own local data on each edge device. The training process can be performed using various machine learning algorithms and techniques. 3. **Model Aggregation**: After the local model training, the updated models from each edge device are sent to a central server or aggregator. The aggregator collects the models and performs model aggregation techniques, such as averaging or weighted averaging, to create a global model. 4. **Model Update**: The global model is then sent back to the edge devices, where it replaces the local models. This updated global model incorporates the knowledge learned from all the edge devices' local models. 5. **Iterative Process**: The above steps are repeated iteratively, allowing the edge devices to continuously improve the global model by training on their local data. This iterative process helps capture the data diversity across different edge devices and improve the overall model performance. Figure 6: Model training in a federated learning scenario for early health prediction. Collaborative training on edge devices is a core aspect of federated learning in this context. Researchers develop federated learning techniques specifically tailored for edge devices to enable collaborative model training. Secure aggregation methods are employed to combine model updates contributed by edge devices. Federated learning aggregation methods play a critical role in combining local model updates from different edge devices, resulting in a global model that encompasses the collective knowledge. Let \(N\) be the number of edge devices (1 to \(N\)) participating in the federated learning process. Each edge device \(i\) has a local model \(w_{i}\) that it trains on its own local dataset. After training, the local model \(w_{i}\) is updated and must be merged with the models of the other edge devices to form the global model \(W\). The selection of an aggregation approach depends on certain assumptions, constraints, and properties of the federated learning context. Different techniques may be more suitable for different implementations, and new aggregation methods are continuously being sought to increase the effectiveness and efficiency of federated learning systems. _Averaging_ is the most widely used aggregation method in federated learning. In this approach, consensus is reached on the global model by averaging the local model updates. Each update is treated equally in this approach without considering specific weighting factors. The averaging approach can be represented mathematically as follows:  
\[W=\frac{1}{N}\sum_{i=1}^{N}w_{i}\]  
Here:  
* \(\sum\) indicates the summation of local models across all edge devices. * \(\frac{1}{N}\) is the normalization factor to ensure that the aggregation results in an averaged global model. In this approach, local models are averaged to create a global model representing the collective learning of all edge devices. The initial phase of the training procedure involves using the global model as the basic framework, which is then iterated until a state of convergence is reached. Algorithm 1 below depicts how averaging can be used in federated learning with edge devices. _Weighted averaging_ extends the basic averaging method by assigning different weights to each local model update. These weights can be determined based on factors such as the reliability of the edge device, the amount of local data, or the performance of the local model. Consequently, devices with better performance or more representative data significantly affect the global model.