A multi-task learning framework for soil fertility assessment and nutrient prediction using machine learning
摘要
Soil fertility is a critical determinant of global food security and sustainable agriculture, yet its assessment remains challenging due to the complex interplay of chemical, physical, and biological properties. Traditional laboratory methods are accurate but often slow and costly, underscoring the need for data-driven approaches to support efficient soil monitoring and nutrient management. This study introduces a Multi-Task Learning Framework (MTLF) that integrates XGBoost for soil fertility classification and nutrient prediction, K-Means clustering for exploratory soil grouping, and Shapley Additive Explanations (SHAP) for interpretability. The framework simultaneously addresses classification (low/medium/high fertility), regression (N, P, K concentrations), and clustering, implemented within a unified pipeline to ensure consistency across tasks. Using a dataset of 880 soil samples, preprocessing included SMOTE for class imbalance, MinMax scaling, and feature engineering (Soil Acidity Index, OC/S interaction, Fe/Zn ratio). The XGBoost classifier achieved 94.32% accuracy, with SHAP analysis confirming that nitrogen (N), phosphorus (P), potassium (K), and pH remain the most influential features consistent with established agronomic knowledge while also revealing interaction effects among soil attributes that enrich understanding of nutrient dynamics. Regression performance was moderate for nitrogen (R² ≈ 0.61) but weaker for phosphorus and potassium, reflecting the influence of unobserved environmental factors. Clustering uncovered three distinct soil groups differentiated by organic carbon (OC), sulfur (S), and micronutrients including iron (Fe), manganese (Mn), copper (Cu), and zinc (Zn), providing actionable insights for precision agriculture zoning. By integrating predictive modeling, interpretability, and clustering into a single transparent workflow, the proposed framework offers a scalable tool for targeted soil interventions and optimized resource allocation.