Document Type : Research Article
Author
Department of Agrotechnology, Faculty of Agriculture, Ferdowsi University of Mashhad, Mashhad, Iran
Abstract
Introduction
This study undertook a detailed comparison of two supervised machine-learning algorithms—Random Forest (RF) and eXtreme Gradient Boosting (XGBoost)—to predict irrigated wheat (Triticum aestivum L.) yield across 20 counties in Razavi Khorasan Province. Both models were trained on 70 % of the dataset (years 1383–1402) and tested on the remaining 30 %. Hyperparameter tuning was performed via a grid search coupled with five-fold cross-validation.
Materials and Methods
The two algorithms were initially trained and optimized using 70% of the data (approximately 14 years per county) and subsequently tested on the remaining 30% (approximately 6 years). Hyperparameter tuning was performed through a grid search combined with five-fold cross-validation. Hyperparameter Tuning was performed using Gridsearch over key parameters (e.g., number of trees n_estimators, maximum depth max_depth, learning rate for XGBoost) with 5-fold cross-validation. Afterwards, both models were evaluated and validated using RMSE (Root Mean Squared Error), R² (Coefficient of Determination), MAE (Mean Absolute Error), Willmott’s d (Index of Agreement). Two machine learning algorithms, Random Forest and XGBoost, were developed to predict wheat performance at the district level. The performance values were initially predicted numerically using regression and then divided into three distinct classes using statistical percentiles: Low: 0th to 33rd percentile; Medium: 33rd to 66th percentile; High: 66th to 100th percentile. This classification was based on both the actual and predicted values for each district. The results of this classification are presented in the form of a confusion matrix for each model. Using three indices—Aridity Index, Seasonal Intensity of Temperature, and Growing Degree Days—districts in the province were clustered into three climatic zones. Then, wheat performance in these zones was analyzed based on two models. In this study, the machine learning algorithms Random Forest and XGBoost were implemented in Python 3.3 using the Scikit-learn library. DataFrame preparation and the clustering of the province’s counties into climatic zones were carried out using R 4.3.2 and ArcGIS 10.8.2.
Results and Discussion
Alghoritms Performance: On average, RF reduced prediction error by ~19 % (395 vs. 492 kg ha-1 RMSE) and achieved a slightly higher agreement with observed yields (d=0.467 vs. 0.419). Random forest showed Best RF Performance for Khalilabad (RMSE = 141.19 kg ha-1, MAE = 125.68 kg ha-1, d = 0.37) and Bardeskan (RMSE = 187.69 kg ha-1, d = 0.80); Worst RF Performance was obtained for Quchan (RMSE = 667.65 kg ha-1, d = 0.36) and Torbat-e Heydarieh (RMSE = 581.33 kg ha-1, d = 0.47). Best XGBoost Performance was obtained for Torbat-e Jam (RMSE = 269.36 kg ha-1, d = 0.77), Neyshabur (RMSE = 377.91, d = 0.78). Worst XGBoost Performance resulted for Quchan (RMSE = 943.99 kg ha-1, d = 0.25) and Torbat-e Heydarieh (RMSE = 786.20 kg ha-1, d = 0.39). In 6 out of 20 counties (Khaf, Mahvelat, Kalat-e Nader, Kashmar, Chenaran, Fariman) both RF and XGBoost performed nearly identical errors (ΔRMSE < 15 kg ha-1), indicating similar predictive power under those local conditions.
Feature Importance: Daily Minimum Temperature (Tmin): Ranked #1 in RF’s importance list; ranked #3 in XGBoost. Seasonal Tmin (TminGS): Consistently #3 in both models. Other Key Predictors: Precipitation over the growing season (Prec, PGS), Growing Degree Days (GDDGS), and Evapotranspiration (ETGS) all contributed substantially, though with 4th–8th ranks markedly lower in RF than in XGB.
Classifiction of Yield into Three Performance Classes: Using percentile thresholds—Low (0–33rd), Medium (34–66th), High (67–100th)—the models were also evaluated as classifiers. Low-Performing Counties Needing Intervention Seven counties (35 % of the sample)- Quchan, Torbat-e Heydarieh, Sarakhs, Kalat-e Nader, Gonabad, Neyshabur, Taybad- fell in the Low performance class across both models. These areas should be prioritized for targeted agronomic management and resource allocation.
Cluster-Based Insights: Counties were grouped into three agro-climatic clusters: Very Dry & Hot (4 counties): RF outperformed XGB in all (e.g., Bardeskan, Khalilabad, Mahvelat, Sarakhs). Semi-humid Cooler (6 counties): Mixed results-RF won in 4 (Chenaran, Kalat-e Nader, Mashhad, Nishapur); XGB was slightly better in 2 (Fariman, Quchan). Warm Semi-arid (10 counties): RF superior in 7; equivalence in Taybad & Torbat-e Heydarieh; XGB edged ahead only in no counties here.
Conclusion
Overall, the Random Forest model showed better results for predicting wheat yield in Razavi Khorasan province, especially in most counties. Although the XGBoost model has higher potential for modeling complex patterns, Random Forest performed more accurately in conditions of greater data dispersion. In conclusion, the results of this study emphasize that by utilizing climatic and agricultural data, machine learning algorithms can be optimized not only to achieve high accuracy but also to provide a clear interpretation of the contribution of each variable in wheat yield using the SHAP tool.
Keywords
Send comment about this article