# Occupational Risk Prediction for Miners Based on Stacking Health Data Fusion
## 3 Introduction to Methods and Data Processing
### Model Evaluation
Classification predictions are made on the test data, and the results are stored. The model's accuracy is calculated by comparing the predicted outcomes with the true labels, counting the number of correct predictions, as illustrated in Figure 6.  
Figure 5: Stacking model fusion principle. Single Models  
Logistic regression can be employed as a model for analyzing health threats to miner operators in health risk assessments. The dataset used in this analysis includes vital signs, environmental factors, and a target variable indicating the presence or absence of a health threat. The logistic regression model is applied to predict the probability of a health threat. The model is used for assessing health risks to miner operators:  
\[p(y=1\mid x)=\frac{1}{1+e-(\beta_{0}+\beta_{1}x_{1}+\beta_{2}x_{2}+\cdots+\beta _{n}x_{n})} \tag{9}\]  
where \(p(y=1\mid x)\) is the probability of occurrence of a health threat given feature \(x\); \(\beta_{n}\) represents the model parameters, which are fitted using the training dataset; \(x_{n}\) represents the input features, such as vital sign data and environmental factors. The model uses the train_test_split function to divide the dataset \(X_{\text{data}}\) and the associated labels \(Y\) into a training set and a test set. It then uses a logistic regression model to make classification predictions. The logistic regression algorithm is employed as the second model for hazard assessment of underground miners, helping predict their risk levels. The model is constructed using data on personnel's life characteristics and underground environmental factors as inputs. Using Scikit-learn, an instance of the logistic regression model is created and trained on the training dataset. Prediction accuracy is computed by comparing the predicted labels with the true labels. For each correct prediction, the count is incremented by 1. The final accuracy is obtained by dividing the count by the total number of instances in the test set, as shown in Figure 7.  
This study selects four evaluation models--KNN [31], random forest [32], XGBoost [33], and logistic regression [34]--as candidate base models (PyCharm Community Edition 2014.1.4). By comparing AUC, ROC, and accuracy metrics, algorithms with relatively higher accuracy were chosen as the base models, as shown in Table 3. Accuracy, ROC curve, and AUC were used to evaluate the model, as shown in Figure 8. The AUC represents the area under the ROC curve and is commonly used to assess model performance. A higher AUC indicates better model performance. Figure 4:0 Random forest algorithm-based threat assessment model. Figure 4:1 Comparison of ROC curves for different algorithms. \begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Assessment Model** & **KNN** & **XGboost** & **Random Forest** & **Logistic Regression** \\ \hline Accuracy & 0.77 & 0.73 & 0.78 & 0.79 \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Evaluation accuracy of different algorithms. Figure 7: Threat assessment model based on logistic regression algorithm. The ideal ROC curve is closer to the upper left corner. If the curve is near this corner, the model has a high True Positive Rate (TPR) and a low False Positive Rate (FPR), indicating strong classification performance. Based on the analysis of prediction accuracy and ROC curves in Table 1 and Figure 2, it is evident that the random forest and logistic regression models significantly outperform the others, indicating higher reliability. Consequently, logistic regression and random forest are selected as the final models in this study. To train the Stacking meta-model, two base models, logistic regression and random forest, are first defined. The prediction results from these models are then used as input features to train the Stacking meta-model, with logistic regression serving as the meta-model. \(x_{i}\) denotes the feature vector of the first \(i\) sample and \(y_{i}\) denotes the label of the first \(i\) sample.