# Enhancing Heart Disease Prediction with Federated Learning and Blockchain Integration
## 3 Model Construction and Training Setup  
This section outlines the construction of the model architecture, the choice of hyperparameters, the training procedure, and the evaluation metrics used in our federated learning setup. The model's construction involves selecting appropriate hyperparameters and configuring them to work within the federated learning setup. The key parameters introduced in this paper are further elaborated below to allow for accurate reconstruction and verification. * **Learning Rate (\(\eta\))**: The learning rate used in our model is set to 1 \(\times\) 10\({}^{-3}\). This parameter controls how much the model needs to change in response to the error each time the weights are updated. It is crucial to balance convergence speed and stability, with values typically ranging between 1 \(\times\) 10\({}^{-4}\) and 1 \(\times\) 10\({}^{-1}\) depending on the data. * **Batch Size (\(M\))**: The mini-batch size is set to 512, denoted as \(M\). This setup allows each client to process the dataset in smaller batches for local training before sending updates to the server. * **Client Selection Fraction (\(\rho\))**: The fraction of clients participating in each communication round is set to 1. This parameter, \(\rho\), controls the portion of clients that perform computation in each round, and a value of 1 represents full participation in the federated learning process. * **Training Steps (\(S\))**: Each client performs \(S\) training steps locally, where \(S=100\). This step controls how much computation each client performs before sending updates to the central server. We utilize the TabNet architecture because it handles tabular data effectively while leveraging attention-based mechanisms for feature selection. Table 1 overviews the key parameters used during training. The TabNet architecture was selected for its ability to balance interpretability and performance when dealing with tabular data. Its attention-based feature selection mechanism is particularly useful in distributed environments like federated learning, where transparency and efficiency are key. The TabNet model outputs a probability score between 0 and 1, representing the likelihood of heart disease. Scores \(\geq\) 0.5 indicate a higher risk (positive), while those \(<\) 0.5 indicate lower risk (negative). This probabilistic output offers more nuanced predictions compared to binary classification. **Hyperparameters**: These settings control the learning process. In this case, we set the learning rate to \(1\times 10^{-3}\), which balances efficient convergence with stability. A batch size of 512 ensures that a sufficiently large subset of data is used during each training iteration, enhancing the model's ability to generalize while keeping memory requirements reasonable. **Loss Function**: We used the Binary Cross Entropy (BCE) loss function, which is well suited for binary classification tasks, such as predicting whether a patient is at risk of heart disease. BCE calculates the difference between the predicted probabilities and the actual binary class labels (0 or 1), penalizing incorrect predictions more heavily the further they are from the true label. The formula for BCE is as follows:  
\[\text{BCE}=-\frac{1}{N}\sum_{i=1}^{N}[y_{i}\log(p_{i})+(1-y_{i})\log(1-p_{i})] \tag{5}\]  
where \(y_{i}\) is the true label, \(p_{i}\) is the predicted probability for each sample \(i\), and \(N\) is the total number of samples. **Optimizer**: The Adam optimizer was selected for its ability to adapt the learning rate during training, making it well-suited for large and noisy datasets. Adam combines the advantages of RMSprop and momentum-based methods, leading to faster convergence without requiring extensive hyperparameter tuning. **Training Procedure**: Several strategies were employed to ensure robust training. Random shuffling of the training data helps prevent the model from learning patterns specific to the order of the data, enhancing generalization.