# Random Forest-Based Stability Prediction Modeling of Closed Wall for Goaf
## 5 Results and Discussion
### Hyperparameter Optimization Results  
Figure 5 shows the impact curves of various parameters on the model's accuracy. The curves in the figure were obtained by fixing the x-axis parameter and then calculating the average prediction accuracy of all other parameter combinations. From the figure, it can be seen that the prediction accuracy of n_estimators = 250 is significantly higher than other values. The relatively optimal parameter combination is as follows: n_estimators = 250, max_depth = 4, min_samples_leaf = 4, and min_samples_split = 10, which is consistent with the hyperparameter optimization results.  
Since averaging cannot determine the optimality of the selected parameters, we further analyzed the parameters. Taking n_estimators = 250, we analyzed the prediction accuracy of different parameters for max_depth, min_samples_leaf, and min_samples_split. The resulting box plot is shown in Figure 6. It can be seen that the parameters obtained by hyperparameter optimization are indeed superior to the other parameter combinations. The best combination of parameters for the RF algorithm is shown in Table 3, with the accuracy being the average accuracy of ten-fold cross-validation. Compared to the parameter combination of n_estimators = 200, max_depth = 0, min_samples_leaf = 4, and min_samples_split = 10, the prediction accuracy of the learning curve and the test curve for this parameter increased from 94.6% to 95.9%.  
Figure 5: Accuracy curves for each super hyperparameter. This figure consists of four subplots, each illustrating the impact of varying one hyperparameter of a random forest model on the model’s average accuracy. The four hyperparameters are as follows: the number of trees in the forest (n_estimators); the maximum depth of the tree (max_depth); the minimum number of samples required to be at a leaf node (min_samples_leaf); the minimum number of samples required to split an internal node (min_samples_split). In each subplot, the horizontal axis represents the value of the hyperparameter, and the vertical axis represents the corresponding average accuracy. The blue line in the graph connects the accuracy points corresponding to different hyperparameter values, forming an accuracy curve to observe the impact of hyperparameter changes on the model performance.  
Figure 6: Box plots of each hyperparameter versus the model accuracy. This figure consists of three box plots, each illustrating the impact of different values of three random forest model hyperparameters on the distribution of the model’s average accuracy. The three hyperparameters are as follows: maximum depth of the tree (max_depth); the minimum number of samples required to be at a leaf node (min_samples_leaf); the minimum number of samples required to split an internal node (min_samples_split). In each box plot, the horizontal axis represents the value of the hyperparameter, and the vertical axis represents the corresponding average accuracy. The box represents the middle 50% of the accuracy values in the dataset (i.e., the interquartile range), the horizontal line within the box represents the median, the whiskers represent the maximum and minimum values of the data (excluding outliers), and the circles represent outliers.  
After grid search hyperparameter optimization, the RF model exhibited significantly improved prediction performance. This method effectively selects the optimal parameters that enhance the accuracy of the model. As a result of this hyperparameter optimization, the RF algorithm achieves more precise predictions, demonstrating its efficacy in refining model performance.