## 3 Model Building and Algorithm Design
### Prediction Algorithm Design
\[\text{Accuracy}=\frac{\text{TP}+\text{TN}}{\text{TP}+\text{FP}+\text{TN}+ \text{FN}} \tag{19}\]

\[\text{Precision}=\frac{\text{TP}}{\text{TP}+\text{FP}} \tag{20}\]

\[\text{Recall}=\frac{\text{TP}}{\text{TP}+\text{FN}} \tag{21}\]

\[\text{F1-score}=\frac{2\times\text{Precision}\times\text{Recall}}{\text{ Precision}+\text{Recall}} \tag{22}\]

In these formulas, TP indicates the number of times a danger is present and predicted, FN represents the number of times there is danger but it is not predicted, TN indicates the number of times a danger is not present and is not predicted, and FP represents the number of times there is no danger but danger is predicted. The meaning of accuracy is that the number of correct predictions of mine pressure hazard accounts for the total number of validation samples, which can be understood as the overall accuracy of the prediction model. The meaning of the precision is that the number of correct predictions of mine pressure as dangerous accounts for the number predicted to be dangerous, which can be understood as the percentage of correct predictions of danger in the data. The meaning of the recall is that the number of predictions of danger in the mine pressure accounts for the actual number of dangerous instances, which can be understood as the percentage of the actual dangerous data that are correctly predicted. F1-score is an index used to comprehensively assess the performance of the classification model on the presence and absence of mine pressure hazard, and it is the harmonic average of the accuracy rate and the recall rate. It combines the performance of both to measure whether the mine pressure hazard prediction model can maintain a good balance between the accuracy and recall rates. If the F1-score of the model is high, the prediction performance of the model is good. A low accuracy indicates that there are many pieces of non-dangerous data predicted to be dangerous, requiring mine managers to waste resources to find the problems, or even stopping mining operations, resulting in the disruption of normal production. Low recall indicates that there are many pieces of dangerous data not correctly predicted, and safety problems may occur, causing equipment damage and casualties, affecting safe and efficient production. A low F1-score indicates that the prediction performance of the established mine pressure hazard prediction model is weak, and its ability to predict mine pressure hazard is low. ### Model Validation

The sample data of mine pressure in Table 1 are used as the fitted data of the solution model, the Adagrad optimization algorithm is used to iteratively solve the logistic regression prediction model established above, and the weight of each evaluation index is obtained so as to determine the importance of each index. In logistic regression, evaluation indicators and results are mapped. A large absolute value of the coefficient of an evaluation index indicates that this feature has great influence on the classification result. In the evaluation index system of this paper, the absolute value of the index coefficient corresponds to the importance of the index. A large absolute value of the coefficient of this evaluation index is large, indicating that the index has a high degree of importance in regression prediction and has a great impact on the classification result of whether there is danger in mine pressure. The calculated results are shown in Table 2.

The quantitative expression between the mine pressure hazard and each indicator is obtained as shown in Formula (23).