# Heart Failure Prediction Based on Bootstrap Sampling and Weighted Fusion LightGBM Model
## 3 Mathematical Model
### Model Fusion Scheme  
This model constructs a new fusion system, which seamlessly integrates bootstrap sampling and weighting ideas into LightGBM model to improve the efficiency of heart disease prediction. According to the training set, multiple bootstrap sampling is carried out under different parameter configurations, and several LightGBM submodels with differentiated data perspectives are constructed. These sub-models thoroughly explore data characteristics during their training process. Then, using a strict evaluation index system, they precisely measure each sub-model's performance under different data distributions. Finally, reasonable fusion weights are allocated to them. The purpose of this paper is to overcome the inherent limitations of traditional single-model methods and simple comprehensive models. It is committed to enhancing the model's ability to understand and predict heart disease data and, at the same time, strengthening its generalization and stability. Through these efforts, this paper aims at developing an optimized fusion model, which can achieve excellent performance in heart disease prediction tasks in practical application scenarios. The specific scheme is as follows:  
1. Synthesis of forecast results based on bootstrap sampling and voting  
In the cross-validation stage, for each parameter combination, bootstrap sampling is carried out many times. After each bootstrap sampling, a small training set and a verification set are further divided to train the LightGBM model, and a plurality of prediction results are obtained by forecasting on the corresponding verification set. Then, the prediction results of these bootstrap sampling are synthesized by voting. In this way, the comprehensive prediction results under each parameter combination in cross-validation are obtained, and the corresponding evaluation indicators such as the accuracy, accuracy, recall, and F1 value are calculated.
2. Model fusion based on evaluation index weight  
Calculate the weight based on the F1 value, accuracy, and recall rate of each parameter combination. The specific calculation method is to set the weight coefficient of different evaluation indexes, and then, calculate the weight according to the average evaluation index value of this parameter combination in cross-validation. Finally, according to this weight, the weight of each model's prediction results on the test set is set.
3. Weighted average fusion to obtain the prediction result  
When predicting the test set, for each parameter combination, the LightGBM model is trained again according to the previous process and the prediction results are obtained on the test set. At the same time, the prediction results of all different parameter combinations are weighted and averaged according to their corresponding weights, and the final fusion prediction results are obtained. Finally, the fusion prediction results are converted into binary classification results, which are converted according to the threshold value of 0.5, and various evaluation indexes of the fused model, such as the accuracy, precision, recall, and F1 value, are calculated to evaluate the performance of the fused model.