Iranian Journal of Soil and Water Research

Iranian Journal of Soil and Water Research

Comparative Assessment of Selected Machine Learning Algorithms for Soil Organic Carbon Prediction and Mapping (Case Study: East of Khuzestan Province)

Document Type : Research Paper

Authors
1 Department of Soil Science, Faculty of Agriculture, Shahid Chamran University of Ahvaz, Khuzestan, Iran.
2 Department of Soil Science, Faculty of Agriculture, Shahid Chamran University of ,Ahvaz, Khuzestan, Iran
3 School of Environmental Sciences, University of Guelph, Ontario, Canada
Abstract
Given the spatial variability of soil organic carbon (SOC) as a key indicator of soil quality, its precise regional mapping is essential. This study compared the performance of random forest (RF), regression kriging (RK), and extreme gradient boosting (XGBoost) algorithms, and identified the most influential factors controlling SOC distribution in the Karun-3 watershed. Accordingly, 158 composite surface soil samples (0–5 cm) were collected using a conditioned Latin Hypercube Sampling (cLHS) design. After preparation, standard laboratory methods were used to measure several physical and chemical soil properties, including SOC, sand, silt, clay, electrical conductivity (EC), pH, calcite equivalent carbonate (CCE), and bulk density (BD). Additionally, a set of 31 auxiliary variables — comprising topographic, spectral, and climatic indices, as well as soil characteristics —was used to model the spatial variability of SOC. These auxiliary variables were pre-processed by removing those with near zero variance, and those highly intercorrelated (r ≥ 0.8) with variance inflated factor (VIF) greater than 10, The XGBoost algorithm outperformed the others, demonstrating the highest coefficient of determination (R2 = 0.628), the lowest error metrics (RMSE = 0.473 and MAE = 0.316), and the highest ratio of performance to interquartile range (RPIQ = 1.98). BD, CCE, Carbonate Index (Carb.Ind), Normalized Difference Moisture Index (NDMI), and Length-Slope Factor (LS-Factor) contributed most significantly to the distribution of SOC. Analysis of SOC distribution maps indicated that the northern and northwestern parts of the area contain the highest levels, while the central, southern, and southeastern parts have the lowest. Evaluation of the patterns presented in uncertainty maps revealed that the values of predictive maps are less reliable in parts of the northwestern, eastern, and southern study area. Overall, it can be concluded that the simultaneous application of predictive and uncertainty maps is necessary to understand both the predicted values and their reliability.
Keywords
Subjects

Introduction

Soil organic carbon (SOC) is a key indicator of soil quality and a major component of the global carbon cycle. Accurate spatial prediction of SOC supports sustainable land management, enhances soil conservation planning, and contributes to climate-change mitigation by identifying areas with high carbon sequestration potential. However, SOC typically exhibits strong spatial heterogeneity, driven by interacting environmental factors such as topography, moisture regime, vegetation cover, and land use. Conventional soil mapping approaches are often labor-intensive, time-consuming, and expensive. This has motivated the rapid development of Digital Soil Mapping (DSM) as a cost-effective and scalable alternative.

The Karun 3 Dam watershed (eastern Khuzestan Province, Iran) provides a challenging environment for SOC mapping due to its complex terrain and diverse land uses, which can create non-linear and multi-factor controls on SOC distribution. In such landscapes, advanced predictive models are often required to capture the complex relationships between SOC and environmental covariates. Therefore, the main objective of this study was to evaluate and compare the predictive performance of three distinct modeling approaches—Random Forest (RF), Regression Kriging (RK), and Extreme Gradient Boosting (XGBoost)—for spatial prediction of SOC in the Karun 3 watershed. We hypothesized that the gradient boosting framework, particularly XGBoost, would outperform the other approaches by more effectively learning non-linear relationships and interactions between SOC and environmental covariates under heterogeneous environmental conditions.

Materials and Methods

The study was conducted in the Karun 3 Dam watershed located in eastern Khuzestan Province, Iran. The watershed is characterized by rugged topography and heterogeneous land-use patterns, which together contribute to high spatial variability in soil properties, including SOC. To ensure the sample set accurately represented the multivariate distribution of key environmental variables, including topography, geology, soil types, and vegetation cover, a Conditioned Latin Hypercube Sampling (cLHS) strategy was implemented. This was done using the TEUI 460 add-in widget in ArCGIS 10.8.2. For designing the proposed sampling points with this plugin, all input layers were converted to raster format with identical pixel sizes. Subsequently, a total of 158 composite surface soil samples were collected from a depth of 0–5 cm.

Soil samples were air-dried, passed through a 2 mm sieve, and prepared for the measurement of physical and chemical properties. These properties included soil organic carbon (SOC) determined by hot digestion oxidation; soil pH measured in a saturated soil paste using a pH meter; electrical conductivity (EC) measured in the saturated paste extract with an EC meter; soil texture determined by the hydrometer method; bulk density (ρb) measured using a cylinder; and calcium carbonate equivalents (CCE) of the samples determined by back-titration. The land use type and geographical location of the sampling sites were recorded using a Global Positioning System (GPS).

A suite of 55 environmental covariates was derived from Landsat 9 imagery and a 10 m digital elevation model (DEM) using ENVI 4.7, ArcGIS 10.8.2, and SAGA GIS 6.4.0 softwares. These covariates included topographic, spectral, climatic, and soil features, all commonly linked to SOC variability. To enhance model stability and eliminate redundant variables, we assessed multicollinearity by considering correlation coefficients among variables (r ≥ 0.8) and the variance inflation factor (VIF > 10), after first removing variables with near-zero variance.

We then followed a predictive modeling framework and compared three approaches: Random Forest (RF), an ensemble learning method based on recursive partitioning; Extreme Gradient Boosting (XGBoost), a gradient-boosted tree framework designed for high predictive accuracy and efficient learning of complex non-linear patterns; and Regression Kriging (RK), a hybrid approach combining a multiple linear regression (MLR) component with ordinary kriging of regression residuals to incorporate spatial autocorrelation not captured by covariates.

Model performance analysis was evaluated using an independent validation strategy, where 70% of samples (n = 111) were used for model training and 30% (n = 47) for independent validation. Splitting data into training and testing subsets was performed employing a cLHS approach to ensure a more balanced and spatial coverage of both the train and test sample. Predictive accuracy assessment was caried out using the coefficient of determination (R2), root mean square error (RMSE), mean absolute error (MAE), and ratio of performance to interquartile range (RPIQ) metrics. To further examine model robustness, bootstrap resampling was performed within the caret package in R.

To prepare a map of the spatial distribution of SOC using RF and XGBoost models, the final and optimized model for each method was applied to every pixel of the region using the full set of environmental variables to produce the SOC prediction map. For developing the SOC distribution map using the RK approach, the final SOC distribution map consisted of two separate steps. In the first step, a multiple linear regression model was fitted to the sampling points and applied to all raster layers of the region to generate the predicted SOC trend map. In the second step, using the optimum variogram fitted to the residuals of the regression model and ordinary kriging, the residual values were estimated and interpolated, then applied to all pixels in the study area. Finally, the final SOC distribution map was produced by the sum of the trend map and the kriged residuals.

To quantify the uncertainty of predictions using RF and XGBoost models, we employed the 90% prediction interval (PI) width To compute this index for tree-based methods, we first calculated, for each pixel, the distribution of predictions obtained from different trees (in the RF model) or from bootstrapped models (in the XGBoost model). The distance between the 5th and 95th percentiles of this distribution was then computed and used as the uncertainty measure. However, uncertainty in the RK method was derived from two separate sources. First, the variance of the trend estimate, attributable to uncertainty in the regression model coefficients, was computed. This value was then added to the variance derived from residual kriging.

Results

Model comparison revealed a clear ranking in predictive performance. XGBoost provided the most accurate SOC predictions, achieving R2=0.628, RMSE = 0.473, MAE = 0.316, and RPIQ = 1.980. Random Forest showed moderate performance with R2=0.545, RMSE = 0.509, and RPIQ = 1.841. Regression Kriging exhibited the lowest predictive accuracy (R2=0.434, RMSE = 0.534), indicating limited added value from residual spatial interpolation under the conditions of this study. The superior performance of XGBoost suggests that gradient boosting is well-suited for SOC prediction in heterogeneous watersheds where complex, non-linear relationships and interactions between environmental covariates and SOC are expected. The weaker performance of RK may reflect limited spatial autocorrelation remaining in the residuals after accounting for covariates, or potential challenges in fitting a stable variogram structure under strong environmental heterogeneity.

Variable-importance analysis highlighted BD, CCE, Carbonate Index (Carb.Ind), Normalized Difference Moisture Index (NDMI), and Lthe ength Slope Factor (Ls-Factor) as the most influential predictors contributing to the spatial districution of SOC in this study. The importance of BD, CCE, NDMI and LS-Factor underscores the role of soil physical condition and moisture status in regulating SOC patterns within the watershed.

The resulting SOC maps indicated higher SOC concentrations in the northern and northwestern parts of the watershed. In contrast, the central areas showed the lowest prediction uncertainty, suggesting stronger model confidence in this zone. Spatial uncertainty patterns further emphasize the need for careful sampling design and potentially additional covariates or sampling intensification in areas where model uncertainty remains high.

Conclusions

This study demonstrates XGBoost as the most effective approach for regional SOC mapping within the complex Karun 3 watershed, outperforming Random Forest (RF) and Regression Kriging (RK). The practical value of XGBoost lies in its ability to accurately capture the non-linear, multi-factor environmental controls on SOC, thereby improving the reliability of digital soil mapping outputs. The generated SOC prediction and uncertainty maps can assist land managers and decision-makers in identifying high-potential carbon sinks and prioritizing soil conservation efforts. Future research should integrate additional high-resolution covariates and explore deep learning models to further enhance spatial prediction accuracy and reduce uncertainty in complex watersheds.

Funding

The authors would like to thank the Deputy of Research Technology and Social Relationships at Shahid Chamran University of Ahvaz (SCU.AS1402.365) for their financial support of this research.

Authorship contribution

First Author: Formal analysis, methodology, software, writing — original draft,

Second Author: Conceptualization, data curation, funding acquisition, writing — review and editing, methodology, validation.

Third Author: Conceptualization, methodology, software, writing-review and editing.

Declaration of Generative AI and AI-assisted technologies in the writing process

During the preparation of this work the author(s) used editGPT for grammatical and typographical errors.

Data availability statement

Data available on request from the authors.

Acknowledgements

The authors would like to thank anonymous referees for their constructive comments.

The authors would like to thank anonymous reviewers for their valuable suggestions in manuscript revision.

Ethical considerations

The authors avoided data fabrication, falsification, and plagiarism, and any form of misconduct.

Conflict of interest

The authors declare no conflict of interest.

Banaei, M. (1998). Map of soil moisture and temperature regimes in Iranian soils. Soil and Water Research Institute, Tehran, Iran.
Batjes, N. H. (2014). A standardized input data set for global soil carbon model evaluation. Geoderma, 214-215, 119–126.
Biau, G., & Scornet, E. (2016). A random forest guided tour. Test, 25(2), 197–227.
Borůvka, L., Donátová, H., and Němeček, J. (2005). Effect of land use and soil properties on soil acidification in the Czech Republic. Soil and Tillage Research, 78(1), 75–85.
Breiman, L. (2001). Random forests. Machine Learning, 45(1), 5–32.
Cambardella, C. A., Moorman, T. B., Novak, J. M., Parkin, T. B., Karlen, D. L., Turco, R. F., and Konopka, A. E. (1994). Field-scale variability of soil properties in central Iowa soils. Soil Science Society of America Journal, 58(5), 1501–1511.
Carré, F., McBratney, A. B., Mayr, T., and Montanarella, L. (2007). Digital soil assessments: Beyond DSM. Geoderma, 142(1-2), 69–79.
Catani, F., Lagomarsini, D., Segoni, S., and Tofani, V. (2013). Landslide susceptibility estimation by random forests technique: Sensitivity and scaling issues. Natural Hazards and Earth System Sciences, 13(11), 2815–2831.
Chen, T., & Guestrin, C. (2016). XGBoost: A scalable tree boosting system. In Proceedings of the 22nd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining (pp. 785–794). ACM.
Chen, W., Li, Y., Wang, J., Chen, G., and Chen, G. (2019). Spatial prediction of soil organic matter content using machine learning algorithms. Catena, 174, 170–185.
Corwin, D. L., and Lesch, S. M. (2005). Apparent soil electrical conductivity measurements in agriculture. Computers and Electronics in Agriculture, 46(1–3), 11–43.
Dadgar, M., & Faramarzi, S.E. (2024). Assessing the performance of machine learning models for predicting soil organic carbon variability across diverse landforms. Environmental Earth Sciences, 83, 657. https://doi.org/10.1007/s12665-024-11960-0
De Caires, S.A., St Martin, C., Atwell, M.A., Kaya, F., Wuddivira, G., & Wuddivira, M.N. (2025). Advancing soil mapping and management using geostatistics and integrated machine learning and remote sensing techniques: A synoptic review. Discover Soil, 2: 53. https://doi.org/10.1007/s44378-025-00082-z
Fox, J., and Weisberg, S. (2019). An R companion to applied regression (3rd ed.). Sage. https://www.john-fox.ca/Companion/ 
Hateffard, F., Steinbuch, L., & Heuvelink, G. B. M. (2024). Evaluating the extrapolation potential of random forest digital soil mapping. Geoderma, 441, 116740. https://doi.org/10.1016/j.geoderma.2023.116740
Hengl, T., de Jesus, J. M., Heuvelink, G. B. M., Ruiperez Gonzalez, M., Kilibarda, M., Blagotić, A., … & Kempen, B. (2017). SoilGrids250m: Global gridded soil information based on machine learning. PLOS ONE, 12(2), e0169748.
Hengl, T., Heuvelink, G. B. M., and Rossiter, D. G. (2007). About regression-kriging: From equations to case studies. Computers & Geosciences, 33(10), 1301–1315.
Hengl, T., Nussbaum, M., Wright, M. N., Heuvelink, G. B. M., and Gräler, B. (2018). Random forest as a generic framework for predictive modeling of spatial and spatio-temporal variables. PeerJ, 6, e5518.
Hijmans, R.J. (2023). raster: Geographic Data Analysis and Modeling. R package version 3.6-26. https://CRAN.R-project.org/package=raster
Hocking, R. R. (2013). Methods and applications of linear models: Regression and the analysis of variance (3rd ed.). Wiley.
Ho, V. H., Nguyen, T. T., Nguyen, T. A., Pham, T. D., Bui, D. T., & Nguyen, Q. H. (2024). Random forest regression kriging modeling for soil organic carbon density estimation using multi-source environmental data in central Vietnamese forests. Modeling Earth Systems and Environment.
Hojati, S. (2019). Use of spatial statistics to identify hotspots of lead and copper in selected soils from north of Khuzestan Province, southwestern Iran, Archives of Agronomy and Soil Science, 65(5), 654-669. https://doi.org/10.1080/03650340.2018.1520977
Jena, R. K., Moharana, P. C., Dharumarajan, S., Sharma, G. K., Ray, P., Deb Roy, P., and Gaber, A. (2023). Spatial prediction of soil particle-size fractions using digital soil mapping in the North Eastern region of India. Remote Sensing, 15(5), 1295.
Kaya, F., Keshavarzi, A., Gümüş, İ., Erşahin, S., and Başayiğit, L. (2022). Evaluation of machine learning algorithms for predicting soil organic carbon stock in a semi-arid environment. Geoderma Regional, 28, e00466.
Keskin, H., and Grunwald, S. (2018). Regression kriging as a workhorse in the digital soil mapper’s toolbox. Geoderma, 326, 22–41.
Kasraei, B., Schmidt, M.G., Zhang, J., Bulmer, C.E., Filatow, D.S., Arbor, A., Pennell, T., & Heung, B. (2024). A framework for optimizing environmental covariates to improve model parsimony in digital soil mapping. Geoderma, 446, 116890. https://doi.org/10.1016/j.geoderma.2024.116873
Khaledian, Y., and Miller, B. A. (2020). Selecting appropriate machine learning methods for digital soil mapping. Applied Mathematical Modelling, 81, 401–418.
Kuhn, M. (2008). Building predictive models in R using the caret package. Journal of Statistical Software, 28(5), 1–26. https://doi.org/10.18637/jss.v028.i05
Lilburne, L., Helfenstein, A., Heuvelink, G.B.M., & Eger, A. (2024). Interpreting and evaluating digital soil mapping prediction uncertainty: A case study using texture from SoilGrids. Geoderma, 450, 117052. https://doi.org/10.1016/j.geoderma.2024.117052.
Liaw, A., & Wiener, M. (2002). Classification and Regression by randomForest. R News, 2(3), 18-22.
Matinfar, H.R., Jalali, M., & Dibaei, Z. (2021). Estimation of the amount of soil organic carbon using spectral data in the VIS-NIR-SWIR-TIR spectral range. Journal of Water and Soil, 35(4), 567-581.
McBratney, A. B., Santos, M. M., and Minasny, B. (2003). On digital soil mapping. Geoderma, 117(1-2), 3–52.
Minasny, B., and McBratney, A. B. (2006). A conditioned Latin hypercube method for sampling in the presence of ancillary information. Computers & Geosciences, 32(9), 1378–1388.
Meinshausen, N. (2006). Quantile regression forests. Journal of Machine Learning Research, 7, 983-999. http://jmlr.csail.mit.edu/papers/v7/ 
Minasny, B., and McBratney, A. B. (2016). Digital soil mapping: A brief history and some directions. Geoderma, 264, 301–311.
Moharana, P. C., Meena, R. L., Nogiya, M., Jena, R. K., Sharma, G. K., Sahoo, S., and Vara Prasad, P. V. (2022). Impacts of land use on pools and indices of soil organic carbon and nitrogen in the Ghaggar flood plains of arid India. Land, 11(8), 1180.
Moore, I. D., Gessler, P. E., Nielsen, G. A., and Peterson, G. A. (1993). Soil attribute prediction using terrain analysis. Soil Science Society of America Journal, 57(2), 443–452.
Moradinasab, V., Hojati, S., Landi, A., Faz Cano, A. (2021). Comparing soil development in two topo-sequences with different parent materials in part of Karoon 3 Basin, east of Khuzestan Province. Iranian Journal of Soil and Water Research, 52(1), 143-159.
Mousavi, A., Shahbazi, F., Oustan, S., Jafarzadeh, A.A., & Minasny, B. (2020). Application of two data mining techniques for mapping the spatial distribution of soil organic carbon (Case study: East shore of Urmia Lake). Journal of Water and Soil, 34(3), 689-705.
Naimi, B. (2023). usdm: Uncertainty analysis for species distribution models (R package version 2.1-7) [Computer software]. https://CRAN.R-project.org/package=usdm 
Nikou, M., & Tziachris, P. (2022). Prediction and uncertainty capabilities of quantile regression forests in estimating spatial distribution of soil organic matter. ISPRS International Journal of Geo-Information, 11(2), 130. https://doi.org/10.3390/ijgi11020130
Pebesma, E.J. (2004). Multivariable geostatistics in S: the gstat package. Computers & Geosciences, 30(7), 683–691. https://doi.org/10.1016/j.cageo.2004.03.012
Pebesma, E., & Bivand, R. (2005). Classes and methods for spatial data in R. R News, *5*(2), 9–13. https://CRAN.R-project.org/doc/Rnews/
Rahmati, F., Hojati, S., Rangzan, K., & Landi, A. (2024). Modelling and digitally mapping of soil organic carbon in Semiron County employing several machine learning algorithms. Agricultural Engineering, 47(4), 585-605.
R Core Team. (2021). R: A language and environment for statistical computing. R Foundation for Statistical Computing, Vienna, Austria. https://www.R-project.org/
Rohmer, J., Belbeze, G., & Guyonnet, D. (2024). Insights into the prediction uncertainty of machine-learning-based digital soil mapping through a local attribution approach. SOIL, 10(2), 679–697. https://doi.org/10.5194/soil-10-679-2024.
Rossetti, C., Piccini, C., & Conforti, M. (2024). Spatial prediction of soil organic carbon: Combining machine learning with residual kriging in an agricultural lowland area (Lombardy region, Italy). Geoderma, 448, 116953. https://doi.org/10.1016/j.geoderma.2024.116953.
Stavi, I., and Lal, R. (2015). Achieving zero net land degradation: Challenges and opportunities. Journal of Arid Environments, 112, 44-51.
Stoorvogel, J. J., Kempen, B., Heuvelink, G. B. M., & De Bruin, S. (2009). Implementation and evaluation of existing knowledge for digital soil mapping in Senegal. Geoderma, 149(3-4), 161–170.
Talebian, M., Raisossadat, S.N., and Rahimzadeh, F. (1999). Dehdez geological quadrangle map of Iran, no. 6052. Scale 1:100000. Ministry of Industry and Mines and Geological Survey f Iran.
Tassinari, D., Richer-de-Forges, A. C., and Brus, D. J. (2016). Accounting for geologic and geomorphic processes in modeling soil depth and soil classes in Barro Colorado Nature Monument, Panama. Geoderma, 277, 21–38.
Tziolas, N., Tsakiridis, N., Heiden, U., & van Wesemael, B. (2024). Soil organic carbon mapping utilizing conventional neural networks and Earth observation data, a case study in Bavaria state Germany. Geoderma, 444, 116867. https://doi.org/10.1016/j.geoderma.2024.116867  
Venables, W. N., & Ripley, B. D. (2002). Modern applied statistics with S (4th ed.). Springer.
Wadoux, A. M. J.-C., Minasny, B., and McBratney, A. B. (2020). Machine learning for digital soil mapping: Applications, challenges and suggested solutions. Earth-Science Reviews, 210, 103359.
Wang, X., Li, Z., and Li, P. (2009). Topography and spatial variability of soil physical properties. Scientia Agricola, 66(3), 338–352.
Wang, H., Zhang, X., Wu, W., and Liu, H. (2021). Prediction of Soil Organic Carbon under Different Land Use Types Using Sentinel-1/-2 Data in a Small Watershed. Remote Sensing, 13(7), 1229.
Wei, T., & Simko, V. (2024). R package 'corrplot': Visualization of a correlation matrix (Version 0.95) [Computer software]. https://github.com/taiyun/corrplot 
Wickham, H. (2016). ggplot2: Elegant Graphics for Data Analysis. Springer-Verlag, New York, 260p. https://doi.org/10.1007/978-3-319-24277-4
Wickham, H., & Bryan, J. (2026). readxl: Read Excel files (R package version 1.5.0) [Computer software]. https://readxl.tidyverse.org 
Wickham, H., François, R., Henry, L., Müller, K., & Vaughan, D. (2026). dplyr: A grammar of data manipulation (R package version 1.2.1) [Computer software]. https://dplyr.tidyverse.org 
Wiesmeier, M., Barthold, F., Blank, B., and Kögel-Knabner, I. (2011). Digital mapping of soil organic matter stocks using Random Forest modeling in a semi-arid steppe ecosystem. Plant and Soil, 340(1), 7–24.
Wiesmeier, M., Urbanski, L., Hobley, E., Lang, B., von Lützow, M., Marin-Spiotta, E., van Wesemael, B., Rabot, E., Ließ, M., Garcia-Franco, N., Wollschläger, U., Vogel, H.-J., & Kögel-Knabner, I. (2019). Soil organic carbon storage as a key function of soils - A review of key indicators and biological pathways. Geoderma, 333, 149-162.
Wilding, L. P. (1985). Spatial variability: Its documentation, accommodation and implication to soil surveys. In Proceedings of the Soil Spatial Variability Workshop (pp. 166–194). Las Vegas, NV.
Zhang, Y., Wang, H., & Li, X. (2022). Peatland restoration reduces carbon emissions by altering pore characteristics and water content. Land, 11(9), 1646.
Zhang, C., Chen, Y., Wei, Y., Yu, P., Hong, Y., Hu, Y., Wang, J., & Shi, Z. (2024). Unraveling the threshold and interaction effects of environmental variables on soil organic carbon mapping in plateau watershed. Geoderma, 450, 117032. https://doi.org/10.1016/j.geoderma.2024.117032