# Random Forest-Based Stability Prediction Modeling of Closed Wall for Goaf
## 5 Results and Discussion  
### Evaluation Metrics Description  
In machine learning, model evaluation is essential and occurs at two levels. First, during the model training process, the training set is used to evaluate the model with different parameters, aiming at optimizing these parameters. Second, once the model is built, it is evaluated using the test set to verify the final performance. This two-tiered approach ensures both effective training and the reliable assessment of the model's predictive capabilities.  
To gain a comprehensive understanding of the performance of the classification model, test sets are often utilized to analyze the detailed predictions through confusion matrices. These matrices display the number of true positives, false positives, true negatives, and false negatives, which helps to deeply analyze the model's performance in each category and make more targeted adjustments. In binary classification problems, the two categories are classified as positive or negative. In multi-class scenarios, the definitions of positive and negative are relative: any category can be treated as positive, while the remaining categories are considered negative.  
\begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Algorithms** & **n\_Estimators** & **max\_Depth** & **min\_Samples\_Leaf** & **min\_Samples\_Split** \\ \hline \multirow{4}{*}{RF} & 200 & 2 & 4 & 10 \\  & 250 & 4 & 6 & 20 \\  & 300 & 6 & 8 & 30 \\  & 500 & 10 & 10 & 40 \\ \hline \hline \end{tabular}
\end{table}
Table 2: Hyperparameters of the grid search RF algorithm.  
All of the results appearing in the model can be categorized into the following four types: (1) true positive (TP) occurs when the true value is positive and the predicted value is also positive; (2) false negative (FN) arises when the true value is positive but the predicted value is negative, representing a Type I error; (3) false positive (FP) occurs when the true value is negative while the predicted value is positive, which is known as a Type II error; and (4) true negative (TN) is when both the true and predicted values are negative.  
These four cases can be organized into a table, resulting in what is known as a confusion matrix. While the confusion matrix effectively counts the number of positives and negatives, it can be challenging to evaluate the strengths and weaknesses of the model solely based on case counts, especially with large datasets. Therefore, additional key performance indicators are introduced to provide a more comprehensive assessment.  
Precision indicates the proportion of positive predictions made by the model that are actually correct. It measures the probability that a predicted positive outcome is accurate, calculated as the number of true positives (TPs) divided by the sum of true positives and false positives (TPs + FPs).  
Recall, also known as sensitivity, measures the proportion of actual positive cases that the model correctly identifies. It is calculated as the number of true positives (TPs) divided by the sum of true positives and false negatives (TPs + FNs). A higher recall indicates that the model is effective at capturing more positive samples, thus reflecting its ability to minimize missed positive cases.  
F1-score is the harmonic mean of precision and recall, providing a single metric that balances both aspects of the model performance. It ranges from zero to one, where a higher F1-score indicates a better overall classification quality.  
The accuracy, precision, recall, and F1-score are indicated below as follows:  
\[\text{Accuracy}=(\text{TP}+\text{TN})/(\text{TP}+\text{FP}+\text{TN}+ \text{FN}) \tag{6}\]  
\[\text{Precision}=\text{TP}/(\text{TP}+\text{FP}) \tag{7}\]  
\[\text{Recall}=\text{TP}/(\text{TP}+\text{FN}) \tag{8}\]  
\[\text{F1}=\text{2}\times\text{Precision}\times\text{Recall}/(\text{Precision}+ \text{Recall}) \tag{9}\]