# Explainable Ensemble Learning Model for Residual Strength Forecasting of Defective Pipelines
## 3 Case Study
### SHAP Analysis  
Although many machine learning models are designed for accurate prediction, it is equally important to understand why a model makes specific predictions and quantify the relationship between the model's predictions and input features. While the BO-XGBoost model demonstrates strong predictive performance on the dataset, its complex and highly nonlinear architecture results in a \"black-box\" effect. The lack of transparency limits its \begin{table}
\begin{tabular}{l c c c c c c} \hline
**Target Parameter** & **SVM** & **MLP** & **LightGBM** & **RF** & **GBRT** & **BO-XGBoost** \\ \hline Residual strength & & & & & & \\ forecasting & & & & & & \\ \hline \end{tabular}
\end{table} 
Table 4: The overfitting index (OFI) values. \begin{table}
\begin{tabular}{l c} \hline
**Testing Model** & **Data A** \\ \hline MLP & 0.824 \\ SVM & 0.835 \\ LightGBM & 0.860 \\ GBRT & 0.874 \\ RT & 0.896 \\ BO-XGBoost & 0.919 \\ \hline \end{tabular}
\end{table} 
Table 5: Comparison of the grey relational degree values. practical application and ability to guide production. Consequently, there is a growing demand for model interpretability. SHAP is utilized to analyze the influence of input variables on model outputs and explains the model's prediction as the sum of the Shapley values of each input feature [49]:  
\[g(x\prime)=\varphi_{0}+\sum_{M}^{j=1}\varphi_{j} \tag{8}\]  
where \(g(x\prime)\) is the model's value, \(\varphi_{0}\) is the constant that explains the model (i.e., the predicted mean of all training samples), and \(\varphi_{j}\) is the imputed value of each feature. The influence of different parameters on residual strength is quantified using SHAP absolute values, as illustrated in Figure 14. A higher SHAP absolute value indicates a more significant impact on the corrosion rate. The analysis reveals that the defect depth (\(d\)), the wall thickness of the pipeline (\(t\)), the yield strength of the pipeline (\(\sigma_{y}\)), the outer diameter of the pipeline (\(D\)), the defect length (\(L\)), the ultimate tensile strength (\(\sigma_{u}\)), and the defect width (\(w\)) affect the residual strength in descending order of significance. Figure 15 further depicts the relationship between the SHAP values of residual strength and the various contributing factors. As illustrated in Figure 15, a significant negative correlation is observed between \(d\) and the residual strength of the pipeline. The depth of the defect is prone to inducing stress concentration effects, which directly compromise the pipeline's residual strength. Specifically, as the defect depth increases, the residual strength decreases markedly. This phenomenon becomes particularly critical when the defect depth approaches or exceeds a certain proportion of the pipeline wall thickness, posing a substantial threat to pipeline integrity and safety. Secondly, both \(t\) and \(\sigma_{y}\) exhibit positive correlations with residual strength. Specifically, the \(t\) of the pipeline has a direct relationship with its residual strength; generally, the greater the wall thickness, the higher the residual strength tends to be. For pipelines, \(\sigma_{y}\) represents the maximum stress the material can withstand without fracture. Exceeding this threshold results in the permanent deformation of the pipeline. Both \(D\) and \(L\) exhibit a negative correlation with residual strength. The relationship between \(D\) and residual strength is a complex engineering issue that requires the consideration of factors such as the pipeline's actual operating environment, material properties, and damage conditions. Generally, defects such as cracks or corrosion are present in the pipeline. In that case, larger external diameters may result in a larger defect area, significantly reducing residual strength. The impact of defects on pipelines with larger external diameters may be more severe, particularly under high-pressure or high-stress conditions.