# Enhancing Heart Disease Prediction with Federated Learning and Blockchain Integration
## 4 Results and Analysis
Combining data from multiple sources improves the model's generalization and robustness, which is essential for enhancing performance across different conditions. Figure 8: Training accuracy and loss on the aggregated dataset. Figure 7: Training accuracy and loss on the Cleveland dataset over multiple epochs. Figures 9 and 10 show testing results during the training process. From Figure 10, we observe that the model trained with 50 epochs initially performs significantly better than those trained with 10 and 20 epochs. However, as epsilon (\(\epsilon\)) increases, the accuracy of all models begins to converge, and by the time epsilon reaches 10, their performance levels off. This indicates that the privacy budget (\(\epsilon\)) plays a critical role in controlling the performance gains and, when relaxed, models trained with fewer epochs can perform similarly to those trained with more epochs. This trend suggests that, under looser privacy constraints, additional training does not necessarily yield performance benefits. In contrast, the results using the UCI dataset, shown in Figure 9, exhibit an unexpected pattern. The model trained with 10 iterations consistently outperforms those trained with 20 or 50 iterations, reaching the highest accuracy when epsilon (\(\epsilon\)) is less than 4. This abnormal result could be attributed to overfitting when more iterations are used, especially under stricter privacy constraints. The Cleveland dataset seems to benefit from early stopping, with fewer iterations preventing the model from overfitting, which may explain the better generalization performance with only 10 iterations. The differences observed in Figures 9 and 10 provide valuable insights into how training duration and the privacy budget impact model performance. These figures underscore the importance of balancing privacy constraints with model accuracy and tailoring training configurations to the specific characteristics of the dataset. The poorer performance of the TabNet model on the UCI Heart Disease dataset, with an R2 score of 0.4 (Figures 6 and 9), can be attributed to several factors. The UCI dataset is smaller and less diverse than the Cleveland dataset, limiting the model's ability to capture complex patterns. This, combined with fewer features, reduces its predictive power. The smaller sample size also makes the model prone to overfitting, especially with more epochs, resulting in high training accuracy but poor generalization on test data. Additionally, class imbalance and the model's sensitivity to hyperparameter tuning further contribute to weaker performance. These factors reflect the dataset's limitations rather than a fundamental flaw in the TabNet model. Future work could address these issues through data augmentation, class balancing, and hyperparameter optimization. Figure 11 shows the model's performance on the aggregated test data. The trend is similar to the Cleveland dataset, with the key difference being that the test accuracy increases gradually in the later stages of training. As epsilon (\(\epsilon\)) increases, the model's accuracy rises more smoothly on the aggregated data compared to the Cleveland data. This suggests a more consistent generalization performance when using aggregated datasets, likely due to the diversity of data sources. Given that accuracy ranges from 0 to 1 and epsilon ranges from 1 to 10, we designed a more balanced metric that considers the ratios of accuracy and epsilon and their respective magnitudes. Our approach utilizes a combination of exponential functions to evaluate performance under different privacy constraints. This figure supports the idea that combining data from multiple sources in an aggregated form enhances model stability and ensures better accuracy across varying epsilon values. The formula for the metric can be defined as follows:  
\[\text{Balanced Metrics}=w_{1}\cdot\exp(\text{accuracy})+w_{2}\cdot\exp(-\epsilon) \tag{8}\]  
_Balanced Metrics_ will be larger as _accuracy_ approaches 1 and \(\epsilon\) approaches 1.