# Identification of Complicated Lithology with Machine Learning
## 3 Data Selection and Practical Application
### Model Evaluation  
To compare the predictive performance of different models, this paper introduces several evaluation metrics, including Mean Absolute Error (MAE), Mean Squared Error (MSE), Root Mean Squared Error (RMSE), and the Coefficient of Determination (R-squared). These metrics are used to assess and contrast the accuracy and effectiveness of each model.  
1. Mean Absolute Error (MAE): Also known as norm lossl_1, MAE is obtained by calculating the absolute difference between the predicted value and the actual value for each sample, summing these absolute differences, and then taking the average. The formula for MAE is shown in Equation (6).  
\[MAE(y,\hat{y})=\frac{1}{n_{samples}}\sum_{i=1}^{n_{samples}}|y_{i}-\hat{y}_{i}| \tag{6}\]  
\begin{table}
\begin{tabular}{c c c c} \hline
**Component** & **Eigenvalue** & **Percentage of Variance** & **Cumulative Percentage** \\ \hline
1 & 3.538 & 58.280 & 58.28 \\
2 & 1.422 & 23.420 & 81.70 \\
3 & 0.970 & 15.972 & 97.672 \\
4 & 0.080 & 1.323 & 98.995 \\
5 & 0.046 & 0.766 & 99.761 \\
6 & 0.014 & 0.239 & 100.00 \\ \hline \end{tabular}
\end{table}
Table 1: Total variance interpretation table.  
Figure 9: Feature importance.  
MAE is the simplest evaluation metric in regression problems, primarily used to assess the closeness between predicted values and actual values. Its value is negatively correlated with the effectiveness of the regression; a lower MAE indicates better regression performance.
2. Mean Squared Error (MSE): Also known as norm lossl_2, MSE is calculated by taking the difference between each predicted value and the actual value, squaring this difference, summing all the squared differences, and then taking the average. The formula for MSE is shown in Equation (7). \[MSE(y,\hat{y})=\frac{1}{n_{samples}}\sum_{i=1}^{n_{samples}}{(y_{i}-\hat{y}_{ i})}^{2}\] (7) MSE is calculated as the average of the squared differences between the predicted values and the actual values. Its value is negatively correlated with the effectiveness of the regression; a lower MSE indicates better regression performance.
3. Root Mean Squared Error (RMSE): RMSE is obtained by taking the square root of the Mean Squared Error (MSE). The formula for RMSE is shown in Equation (8). \[RMSE(y,\hat{y})=\sqrt{\frac{1}{n_{samples}}\sum_{i=1}^{n_{samples}}{(y_{i}-\hat{ y}_{i})}^{2}}\] (8) Similar to MSE, RMSE is negatively correlated with the effectiveness of the regression; a lower RMSE indicates better regression performance. RMSE addresses the issue of unit inconsistency between input and output that exists with MSE, but it still does not perform well in the presence of outliers.
4. Coefficient of Determination (R\({}^{2}\)): The coefficient of determination, also known as the R\({}^{2}\) score, reflects the proportion of the variance in the dependent variable that is predictable from the independent variables. As the goodness of fit of the regression model increases, the explanatory power of the independent variables over the dependent variable also increases, causing the actual observation points to cluster more closely around the regression line. The formula for R\({}^{2}\) is shown in Equation (9). \[R^{2}(y,\hat{y})=1-\frac{\sum_{i=1}^{n_{samples}}{(y_{i}-\hat{y}_{i})}^{2}}{ \sum_{i=1}^{n_{samples}}{(y_{i}-\overline{y}_{i})}^{2}}\] (9) In the formula \(\overline{y}_{i}=\frac{1}{n_{samples}}{\sum_{i=1}^{n_{samples}}{y_{i}}}\), the value of R\({}^{2}\) ranges from 0 to 1, where a value closer to 1 indicates the better predictive performance of the model, and a value closer to 0 indicates poorer performance. It is also possible for R\({}^{2}\) to be negative, which indicates that the model performs extremely poorly. As the number of input features increases, the R\({}^{2}\) value will gradually stabilize at a constant value, at which point, adding more input features will no longer have a significant impact on the model's prediction accuracy, neither improving nor reducing its performance.