# Open-Pit Bench Blasting Fragmentation Prediction Based on Stacking Integrated Strategy
## 4 Results and Discussion  
### Model Construction and Prediction Results  
To construct the prediction model, this study followed three steps: determining evaluation indexes, selecting the best-performing single model (random forest, SVM, or XGBoost) as the base learner, and training the meta-learner to predict the average fragment size (\(X_{50}\)) of the blasted rock. This study used Python 3.9 as the programming language, Pycharm 2023.3.6 as the program's running software, and the packages in the configured environment, including Pandas, Numpy, and Scikit-learn. As mentioned earlier, after constructing the models, their parameters were selected and tuned to improve the prediction of the three single learners. Specifically, the parameters for the random forest model were set to random_state = 1 and n_estimators = 50; the parameters of the SVM model were set to kernel = poly, degree = 5, and C = 1; and the parameter of the XGBoost model was set to learning_rate = 1.9. Some of the prediction results of the three models are presented in Table 2.  
Figure 6: Stacking integrated model prediction flowchart. By drawing predictive regression diagrams, the predicted values of the four models are compared with the actual values, facilitating a clearer judgment of the models' prediction performance. To compare the prediction accuracy of each model in the training and the testing sets, the results for each set were plotted in the same regression plot, as shown in Figure 7. In these plots, the vertical axis represents the predicted values, and the horizontal axis represents the true values. Diagonal dashed lines are added to each regression plot to indicate a perfect fit. When the predicted value is larger than the true value, the point is located above the diagonal; when the predicted value is smaller, the point is below the diagonal. As the predicted values converge closer to the true values, their distance to the diagonal decreases until they appear on the line when they are equal. The more target points located on the diagonal, the better the predictive performance of the model. The results in Figure 7 show that the XGBoost model has the best prediction accuracy in the training set, where the predicted values are essentially the same as the true values, and only a few sample points fall outside the perfect fit diagonal. The prediction accuracy of the random forest model is slightly weaker, but most of the sample points are distributed near the diagonal. The model is more accurate in predicting samples with an \(X_{50}\) range of 0-0.6. The SVR model's predictions have a larger bias, and the sample points are very dispersed, making the model less accurate. However, excellent model performance in the training set does not represent the overall performance of the model. In the testing set, the predictions of all three models show certain deviations, and the prediction accuracy for the minimum and maximum sample points is lower than for those with intermediate values. Among them, the prediction bias of the XGBoost model in the testing set is more pronounced, and its prediction accuracy is much worse than in the training set, indicating that the model is overfitting. Overall, the random forest and XGBoost models provide better predictions, while the SVR algorithm provides poorer predictions. Thus, random forest and XGBoost were chosen as the base learners for the integrated model. The parameters of the random forest and XGBoost models were continuously adjusted during the model construction process, and the final parameters were random_state = 27, n_estimators = 76 for the random forest model; random_state = 42, learning_rate = 0.5 for the XGBoost model.