# Identification of Complicated Lithology with Machine Learning
## 3 Data Selection and Practical Application
### Model Construction
#### 3.4.1 XGBoost Prediction of Felsic Content  
Initially, we selected 20% of the predictive factors for training. After achieving the best training results, we input the predictive factors of the test set into the trained model to obtain the predicted results. The evaluation metrics of the predicted results are shown in Table 2:  
As shown in Table 2, when trained with 20% of the sample data, the MAE of the XGBoost model is 0.19, the MSE is 0.023, the RMSE is 0.15, and the R\({}^{2}\) is 0.36. These indicators reflect the initial predictive ability of the model. Among them, an R\({}^{2}\) of 0.36 indicates that the model can explain approximately 36% of the feldspar content, which is at a medium predictive level. An MAE value of 0.19 indicates that the average absolute error between the predicted value and the actual value is approximately 0.19, which still has considerable room for improvement in the prediction of feldspar content. The prediction results are shown in Figure 10.  
\begin{table}
\begin{tabular}{c c c c c} \hline \hline  & **MAE** & **MSE** & **RMSE** & **R\({}^{2}\)** \\ \hline XGBoost & 0.19 & 0.023 & 0.15 & 0.36 \\ \hline \hline \end{tabular}
\end{table}
Table 2: XGBoost model of 20% of the training samples from Well Lu 1 predicting the felsic quality evaluation index.  
Figure 10: Effect diagram of 20%-training-sample XGBoost prediction of felsic content in Well Lu 1.  
As shown in Figure 10, the fluctuations of the values predicted by the XGBoost model are generally similar to those of the actual values, although there are significant differences between the predicted and actual values at some peaks and troughs. Subsequently, 80% of the predictive factors were selected for training. After achieving the best training results, the predictive factors of the test set were input into the trained model to obtain the predicted results. The evaluation metrics of the predicted results are shown in Table 3:  
When the proportion of training samples increased to 80% (Table 3), the performance of the XGBoost model was significantly improved: the MAE decreased to 0.12, the MSE slightly dropped to 0.022, and the R\({}^{2}\) increased to 0.42. This significant improvement indicates that the XGBoost algorithm is relatively sensitive to the training sample size, and increasing the training data can effectively improve its prediction accuracy. It is particularly worth noting that the significant decline in MAE means a reduction in the average absolute gap between the predicted values and the actual values, which is crucial for the precise classification of lithological types, as in this study; the feldspar content is a key indicator for differentiating different lithologies (such as tuff, dolomitic tuff, tuff dolomite, and dolomite). The prediction results are shown in Figure 11.  
As shown in Figure 11, the fluctuations of the predicted values are generally similar to those of the actual values. Compared to Figure 10, the number of significant differences between the predicted and actual values at the peaks and troughs has decreased.