Integrating Explainable Artificial Intelligence and Machine Learning for Fertilizer Management in Smart Farms
Integrating Explainable Artificial Intelligence and Machine Learning for Fertilizer Management in Smart Farms
M. Abo-Zahhad,Gehad Elkoumy
Abstract
Integrating Explainable Artificial Intelligence (XAI) with Machine Learning (ML) offers a transparent and intelligent approach to fertilizer management in smart farming. While ML enhances predictive accuracy in nutrient recommendation, its black-box nature limits trust and practical adoption among farmers. This study introduces an interpretable fertilizer recommendation system that combines multiple ML models with XAI techniques to ensure both accuracy and transparency. A comprehensive dataset comprising soil properties, environmental factors, and crop types was used to train and evaluate several algorithms, including Random Forest, Decision Tree, Gradient Boosting, XGBoost, SVM, KNN, Naive Bayes, and Logistic Regression. Among these, Random Forest, Decision Tree, and Gradient Boosting achieved the highest accuracy of 99.1%, followed closely by XGBoost at 98.97%.In contrast, simpler models such as KNN and Naive Bayes underperformed, achieving approximately 56% and 53.68% accuracy, respectively, due to their limited capacity to model nonlinear relationships. SHAP analysis revealed phosphorus, nitrogen, and pH as the most influential features, while LIME and DiCE provided local and counterfactual explanations to enhance interpretability. A user-friendly web interface was also developed to deliver personalized, explainable fertilizer recommendations. The proposed system improves model transparency, fosters user trust, and supports sustainable and data-driven fertilizer management in future smart farming applications.
