# Enhancing Heart Disease Prediction with Federated Learning and Blockchain Integration
## 2 Background
### Federated Learning
#### 2.2.1 Horizontal Federated Learning  
Horizontal federated learning refers to a scenario where participants belong to the same business sector or domain but serve different user groups. This approach is suitable when there is a high overlap in the features collected by different participants but little overlap in the users they serve. For instance, hospitals located in different regions may offer similar services (and thus collect similar features) but cater to different patients (resulting in different samples) [PERSON] et al. (2019).  
The horizontal federated learning process follows these key steps:  
Step 1: Each participant computes the model gradients locally using their data. These gradients are masked using encryption techniques such as homomorphic encryption, differential privacy, or secret sharing. The masked gradients (encrypted data) are then sent to the aggregation server.  
Step 2: The server performs secure aggregation, often using a weighted average based on homomorphic encryption.  
Step 3: The aggregated results are returned to each participant.  
Step 4: Each participant decrypts the aggregated gradients and updates their local model parameters accordingly.  
Incorporating differential privacy into the federated learning framework ensures that participants' data remains secure throughout this process. Differential privacy is achieved by adding controlled noise to the gradients shared between participants and the central server. This noise prevents the leakage of sensitive information from any individual participant's dataset, even if adversaries have significant auxiliary knowledge.  
The parameter \(\epsilon\), known as the privacy budget, governs the trade-off between privacy and accuracy. Smaller \(\epsilon\) values provide stronger privacy guarantees by introducing more noise, which can slightly reduce model accuracy. Conversely, larger \(\epsilon\) values reduce the noise, leading to better accuracy but weaker privacy protections. We implemented differential privacy within the federated averaging (FedAvg) algorithm. Each participant adds noise to their local model updates before sending them to the central server for aggregation. Although differential privacy introduces some computational trade-offs, the model's overall performance remains robust, with privacy protections upheld throughout training.  
In traditional machine learning, data are typically centralized in a data center for model training and prediction. However, horizontal federated learning distributes the data and computations across different machines. As shown in Figure 1, each participant downloads the model from the central server, trains it locally with their data, and sends the updated model parameters back to the server. The server then aggregates these updates and distributes the refined model to all participants. This decentralized approach ensures that raw data are never shared, maintaining privacy while allowing for collaborative model training. Moreover, each machine operates independently in this setup, making predictions based on its locally updated model [17].  
However, federated learning can be implemented through various approaches, such as FedAvg, aggregating updates using a weighted average [1], and FedProx, which addresses non-IID data challenges. Additionally, asynchronous federated learning allows for model updates without waiting for all participants, improving communication efficiency. Advanced techniques like personalized federated learning further adapt models to participants' unique data characteristics, enhancing overall performance.