# Spatial Prediction of Soil Contaminants Using a Hybrid Random Forest-Ordinary Kriging Model
## 3 Results
### RF Fitting and Optimal Interpolation  
As described in Section 2, the log-transformed heavy metal concentrations were predicted using the RF model. In this process, a grid of configurable options and parameters was defined, and the optimal selections were identified using GridSearchCV and applied iteratively until the RMSE was minimized. The optimization results revealed that, for the RF model, the bootstrap option indicating the application of boosting was set to True. The number of estimators used was 100, representing the number of decision trees. The maximum depth of the tree was 10 m, which was denoted by the maximum depth. The minimum number of samples required to split an internal decision tree node is 2, denoted by the min samples split. Finally, the minimum number of samples required at a leaf node of the decision tree was determined to be 1, denoted by min sample leaves. Figure 4a compares the actual collected data (\(x\)-axis) with the values predicted by the RF model using the auxiliary data (\(y\)-axis). The R\({}^{2}\) for the RF predictions of the sampling data was calculated as 0.885. Figure 4b shows the results of the feature importance analysis for the seven auxiliary data factors. This analysis does not necessarily indicate how the features directly influence the dependent variable (heavy metal concentration). However, it is suitable for demonstrating the relative impact of each feature on the dependent variable. Figure 3: Heavy metal concentration data. (**a**) Histogram of raw data, (**b**) histogram of the log-transformed data, and (**c**) Q–Q plot of log-transformed data. \begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Min** & **Max** & **Median** & **Mean** & **Skewness** & **Standard** \\  & & & & **Deviation** \\ \hline
18 & 374 & 104.50 & 138.55 & 0.64 & 104.97 \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Descriptive statistics of the heavy metal concentration data (unit: mg/kg). The prediction of the soil heavy metal concentrations in the entire study area using auxiliary data is shown in Figure 5a. The distribution in the light green areas exhibited a specific pattern that was identified as similar to the flow direction (Figure 5b) in the collected data. The number of sampling points in Figure 5b indicates the order of sampling. This similarity was observed when considering the soil contamination data and distribution of heavy metal concentrations discharged from the abandoned mine. In a study conducted in the same area by [PERSON] et al. [27], OK was used to estimate the spatial patterns of potential toxic elements. They concluded that the distribution of heavy metal contamination exhibited weak secondary invariance, indicating no specific trend in the spread of contaminants. However, to represent these results, the authors considered the hydrological characteristics specific to the area, such as surface runoff and the direction of water flow on the slopes. Figure 4: Comparison of actual values and RF model-based prediction. (**a**) Coefficient of determination. (**b**) RF feature importance analysis. The calculated RMSE and R\({}^{2}\) values for heavy metal contamination predicted by the trained RF model were 66.214 mg/kg and 0.867, respectively. Figure 6 shows a comparison between the actual and predicted values, revealing that the model tended to overestimate the lower ranges of sampling data values but generally underestimated as the range increased. This suggests that, similar to interpolation methods, machine learning techniques tend to predict within the range of the training data. Consequently, the predictions are typically higher than the actual minimum data values and lower than the maximum values. Consequently, machine learning models have an inherent limitation in extrapolating beyond the range of data on which they have been trained. Figure 5: Results of the optimal RF model-based prediction. (**a**) Heavy metal concentration in the study area using auxiliary data. (**b**) Flow direction map of the study area [27].