Explainable AI-enabled Mixed-crop Recommendation Model using Hybrid Machine Learning and Ant Colony Optimization

A
Ahmed Mohammed Gimba1
P
Pradeep Kumar Mishra1,*
1Department of Computer Science and Applications, School of Computing Science and Engineering, Sharda University, Greater Noida-201 310, Uttar Pradesh, India.

Background: Mixed-cropping are widely recognized for enhancing land-use efficiency, improving soil fertility and contributing to long-term agricultural sustainability. However, choosing optimal crop combinations tailored to specific farm conditions remains a challenging, particularly in developing regions.

Methods: To address this limitation, this study proposes a novel explainable artificial intelligence (XAI)-Driven hybrid machine learning and ant colony optimization (ACO) framework (XAI-HACO) for mixed-crop recommendation, integrating soil nutrient, weather variables. hybrid machine learning techniques such as random forest-extra trees (RF-ET), decision tree-C4.5 (DT-C4.5), extreme gradient boosting-gradient boosting (XGBoost-GBoost), quadratic discriminant analysis-linear discriminant analysis (QDA-LDA) and support vector machine-stochastic gradient decent (SVM-SGD) were developed and assessed using an indigenous mixed-crop dataset of Andhra Pradesh, India. The models performance was assessed using accuracy, precision, recall, F1-score, confusion matrix and ROC-Curve, while ACO was employed to optimize feature selection and model hyperparameters.

Result: The investigational results show that the proposed RF-ET hybrid model achieved superior performance 95.91% accuracy, precision at 95.08%, recall at 95.91% and F1-score at 95.49%. These results show that the proposed XAI-HACO framework offers a reliable, transparent, interpretability and data-driven decision support tool for farmers and agricultural stakeholders, facilitating informed selection of suitable mixed-cropping systems.

Sustainable agriculture depends on smart decision-making farmers need to use their land efficiently, boost yield, and reduce risks from climate and pests. Mixed-cropping, where two or more crops are grown together on the same field, helps achieve these goals by improving soil fertility, reducing pest pressure, increasing overall productivity, and giving farmers more stable income. However, choosing the right crop combinations is not simple. It requires understanding numerous aspects such as soil nutrients (NPK), pH level, rainfall patterns, how well crops grow together, and even market demand. Traditionally, farmers rely heavily on single-crop recommendation practices, and this system limit land utilization and decrease farming productivity. With the rise of Machine Learning (ML), we now have influential tools that can analyze huge volumes of agricultural data and offer more consistent recommendations. Currently most ML systems are designed for recommending a single crop, not combinations of crops grown together. However, these models largely as black-box systems, proposing limited transparency and interpretability, which makes it hard for farmers to understand the reasoning behind the recommended crops. In (Gao et al., 2023). The study integrates machine learning and swarm intelligence to improve crop yield prediction and fertilization decisions. RF, ERT, and XGBoost models are tested, with ERT showing the best performance. The proposed model effectively identifies optimal fertilization strategies with high accuracy. (Ed-daoudi et al., 2023). The study develops a web-based crop recommendation system that uses machine learning to suggest suitable crops based on soil and climate conditions. Among the five algorithms tested, Random Forest delivered the highest performance. (Sajindra et al., 2024). Proposes a deep learning model to estimate soil NPK levels using plant growth features such as height, leaf count, and leaf area. The Levenberg-Marquardt method with different transfer functions was tested, showing improved predictions, with pure linear and tangent sigmoid functions achieving the highest Pearson correlation (Tkatek et al., 2023). The researchers developed and compared several ML prediction models, including SVM, KNN, NB, RF, DT, and XGBoost. They evaluated model performance by employing error metrics like MSE, MAE, RMSE, and R-Squared. (Khan et al., 2022). Presents a machine learning-based fertilizer recommendation system that leverages IoT-enabled real-time soil nutrient data. By integrating a soil fertility mapping framework, the system provides context-aware and accurate fertilizer recommendations. (Islam et al., 2023). Employs an ML-based IoT system that collects real-time soil and climate data through sensors and transmits it via MQTT. The data is analyzed using machine learning models to recommend suitable crops and optimal fertilizer plans based on current soil conditions. (Kuradusenge et al., 2023). Uses machine learning models comprising RF, PR, and SVR to predict crop yields for Irish potatoes and maize based on climatological data. In (Huang et al., 2023). Proposes a machine learning-based soil analysis system that uses real-time and sensor data to provide crop, irrigation, and fertilizer recommendations, helping farmers farm more sustainably and proficiently. (Deepak, 2023). Develops an IoT-based monitoring system combined with machine learning to recommend suitable crops. By integrating real-time field data with ML models, it supports farmers in making informed decisions on crop selection, timing, and resource management. (Dey et al., 2024). Evaluated five ML models on agricultural, horticultural, and combined crop datasets, concluding that predicting yields is more accurate when crop types are analyzed separately. (Musanase et al., 2023). Estimates soil suitability for potato cultivation using Rwanda as a case study. It applies bootstrapping to expand limited data, uses fuzzy logic for classification, and evaluates machine learning models to support accurate soil quality prediction (Cruz et al., 2022). The study uses graph convolutional networks and graph neural networks to recommend crops by modeling relationships between soil and climate features, enabling accurate seasonal crop predictions (Kollu et al., 2023). Employs IoT data and machine learning for fertilizer recommendation, using SFFS for feature selection and Multilinear Regression for classification. The proposed SFFS-MLR model outperforms Random Forest, C4.5, and Naïve Bayes (Kukkar et al., 2024). Introduces AgroAdvisor, a hybrid model combining RFXGB and DeepFM for crop recommendation, achieving higher accuracy than traditional ML and deep learning methods. (Tamilarasan, 2024). Compares multiple ML models for crop recommendation, with Random Forest performing best. A hybrid approach combining Random Forest and PCA further improves accuracy.
       
According to (Naveen et al., 2023). Proposes an algorithm that converts discrete values into factors, creates multiple datasets, and applies an extended K-means approach with lambda estimation for class assignment. (Chen et al., 2025). Uses vegetation indices (NDVI, GNDVI, and canopy cover) with machine learning models to predict crop growth and yield, validated using ground-based data. (Kalmani et al., 2024). The authors develop an enhanced CNN-LSTM hybrid model with attention mechanisms to improve wheat and rice yield prediction accuracy in India. (Na and Na, 2024). The study uses a VGG16-based CNN model to detect soybean wilting, providing an accurate deep learning approach for identifying crop stress.
Key gaps identified in previous studies. 
       
Despite the growing attention in machine learning crop recommendation models, there remains a significant need to explore how Explainable Artificial Intelligence (XAI) and Hybrid Machine Learning can be effectively merge with optimization techniques (XAI-HACO) for mixed-crop recommendations. Existing studies uncommonly integrate multiple classifiers within a combined XAI-HACO framework. This study addresses these limitations by introducing a novel XAI-HACO model specifically designed for region-specific mixed-crop recommendation system.
       
According to Food and Agriculture Organization (FAO, 2023). Disclose that 20-40% yield losses, while mixed cropping in India can increase smallholder profits by up to 25%. However, the lack of digital tools limits its adoption, highlighting the need for an ML-based system to support optimal mixed-crop decisions.
       
This study presents a XAI-Enable Hybrid Machine Learning and Ant Colony Optimization Framework (XAI-HACO) that recommends optimal mixed-crop combinations by analyzing soil, nutrient, and climate data, specifically tailored to the environments of Andhra Pradesh, India. The proposed model can provide transparency, interpretability and visual explanation for farmers to know the motive behind the recommended crops.
Key contribution to this research.
       
A state-of-the-art XAI-HACO mixed-crop recommendation system that can accurately classify the most suitable mixed-cropping and transparent, interpretable inform decision based on regional soil and climatic conditions of individual farmland.
This study presents a novel mixed-crop recommendation framework that combines XAI-HACO to provide accurate, context-specific mixed-crop recommendations for the soil and climate conditions of Andhra Pradesh, India. Using primary soil and climatic features obtained from Indian Institute of Soil Science (IISS), Bhopal, the system integrates multiple classifiers including RF-ET, DT-C4.5, XGBoost-GBoost, QDA-LDA and SVM-SGD to enhance predictive performance. The incorporated ACO technique further optimizes mixed-crop patterns, resulting in a robust, data-driven recommendation framework. Fig 1 illustrate the sequence modules of the XA-HACO system, form the data collection and pre-processing to hybrid model training, ACO optimization, model evaluation and final mix-crop recommendation.

Fig 1: Proposed model workflow.


 
Dataset
 
The datasets have been collected from Indian Institute of Soil Science, Bhopal. By utilizing a specific region of Andhra Pradesh, India. The dataset includes soil and climate variables consist of (NPK), temperature, humidity, pH and rainfall. A total of 2552 entries and 36 different variety of crops were collected for this study. Fig 2 indicate sample records from the processed dataset, emphasizing soil and climate features with their corresponding mixed-crop labels utilized in model training and evaluation.  

Fig 2: Illustrate the dataset of Andhra Pradesh used for mixed-crop recommendation.


       
The dataset samples were collected from all the major towns in Andhra Pradesh, India. Finally, the study also considered the aggregation of all agricultural seasons. Fig 3 demonstrate the major cities that soil and climate samples were collected.

Fig 3: Study area from which soil and climate were derived, i.e. Andhra Pradesh.


 
Data preprocessing
 
This is one of the most significant phase in machine learning since the accuracy and performance of the machine learning technique are dependent on the excellence of the data that we keep (Sani et al., 2023). Data pre-processing consists of selecting some important features, fixing missing data values, removing duplicates, overfitting and under-fitting, dealing with outliers, feature engineering and so on. Feature selection The process of selecting the appropriate input parameters from the dataset that contribute the most to the prediction output of a machine learning model.
 
Model training and testing
 
The dataset is spread into training and testing batches, which enhances memory efficiency and accuracy. A validation set continuously analyzes the models performance to sidestep overfitting and selects the optimal model based on the validation parameters. After training is completed, we tested on a different test set to see how fit it generalizes to new data.
 
Model performance evaluation
 
The model assessment refers to the method in machine learning during which performance of a model is analytically assess and evaluated. The purpose is to find out how good the prediction quality of the model is and how well. Each mixed-crop recommendation models accuracy, precision and recall score were thoroughly assessed.
 
Accuracy
 
A simple technique to assess accuracy is to look at how frequently the classifier predicts accurately. The ratio of the total of precisely predicted outcomes to all of the models predictions can be used to calculate accuracy.

 
Precision
 
Describes as the ratio of true positives to the sum of true positives and false positives, which indicates the accuracy of positive predictions. 

 
Recall
 
Is the ratio of true positives to the sum of true positives and false negatives, which indicates how successfully the model classifies all appropriate events.


F1-score
 
Incorporate precision and recall into a sole balanced metric, creating it particularly suitable for evaluating models on imbalanced datasets where accuracy can be deceptive.

 
Confusion matrix
 
A confusion matrix is a performance assessment tool in machine learning that visualizes the accuracy of a classification model. It indicates the totals of true positives, true negatives, false positives and false negatives, helping to evaluate model performance, detect misclassifications and enhance overall prediction accuracy.
 
For a dataset of size N
 
N = True positive (TP) + True negative (TN) + False positive (FP) + False negative (FN)
 
Receiver operating characteristics curve
 
Shows how fit a classification model achieves by illustrating the trade-off among the true positive rate (TPR) and (the false positive rate (FPR) across diverse decision thresholds.

 
Algorithm-XAI-HACO mixed-crop recommendation System
 
Step 1: Collect the dataset (Regional dataset).
 
Step 2: Perform data-preprocessing (Data cleaning, replacing missing values, feature selection and engineering).
 
Step 3: Model training and testing (Split the dataset into 80% for training and 20% for testing).
 
Step 4: Building hybrid ML models (RF+ET, DT+C4.5, XGBoost+GBoost, QDA+LDA, SVM+SGD.
 
Step 5: Define (Ant colony optimization) Initialize necessary parameters and pheromone trials.
While not termination do.
Generate ant population.
Calculate fitness values associated with each ant.
Find best solution through selection methods.
Update pheromone trial.
End while.
End procedure.
 
Step 6: Model performance evaluation (Accuracy, precision, recall, F1-score, confusion matrix, ROC-curve).
 
Step 7: XAI-HACO mixed-crop recommendation.
The results of our proposed XAI-HACO mixed-crop recommendations obtained using RF-ET, DT-C4.5, XGBoost-GBoost, QDA-LDA and SVM-SGD, models show that RF-ET outperforms the others with 0.95.91% accuracy. The hybrid machine learning models were compared using various performance metrics. Table 1 show the accuracy, precision, recall and F1-score of the XAI-HACO recommendation models used. The proposed XAI-HACO model offers personalized mixed-crop recommendations by analyzing an indigenous soil and climatic conditions of individual farmers farmland, enabling the cultivation of diverse and suitable mixed-crop. This has the potential to significantly improve farm production and increase the economic returns for farmers.  

Table 1: XAI-HACO mixed-crop recommendation performance metrics.


       
Fig 4 proves the ROC curve comparison of the hybrid ML models, proving their discriminative capability by contrasting true positive rates against false positive rates across diverse classification thresholds.     

Fig 4: ROC-curve of XAI-HACO models.


       
Fig 5 describes the confusion matrix of proposed model, indicating classification performance across various mixed-crop classes and highlighting the distribution of correct and misclassified predictions.

Fig 5: Illustrate the RF-ET classifier mixed-crop recommendation confusion matrix.


       
Fig 6 shows a sample prediction output of the trained hybrid model, demonstrating how input soil and climatic features are processed to generate a recommended suitable mixed-crop.  

Fig 6: Demonstrate the model prediction for mixed-crop before employing XAI.


       
Fig 7 demonstrate the SHAP summary plot of the XAI model, showing the relative significance and influence of soil and climatic parameters on mixed-crop recommendation results.  

Fig 7: Illustrate the SHAP prediction summary plot of mixed-crop recommendation.


       
This SHApley Additive exPlanations (SHAP) summary explains why the proposed XAI-HACO-based model recommends maize, cowpea and groundnut together as demonstrated in the Fig 7. High (N) level strongly drive the model toward recommending maize, indicating maize demand high nitrogen and also moderate nitrogen levels support cowpea and groundnut. The soil nutrient levels strongly support crops like maize, which requires more nutrients to grow healthy. Temperature and humidity are appropriate for cowpea and groundnut, which grow well in warm environments and support to enhance soil fertility. Soil pH value influence how well crops soak-up nutrients. The pH level indicate supports groundnut development. Rainfall has a lesser effect, which means the crops can still perform well even with modest precipitation.
       
The findings of this study demonstrate XAI-HACO offers strong potential for addressing real-world mixed-crop recommendation challenges. By incorporating essential soil nutrient and climatic variables nitrogen (N), phosphorus (P), potassium (K), temperature, humidity, pH value and rainfall the proposed framework effectively captures the complex interactions present in high-dimensional agricultural datasets. Among the evaluated hybrid models, the RF-ET classifier attained the highest performance, attaining an accuracy of 95.91% and consistently outperforming other hybrid approaches such as DT-C4.5, XGBoost-GBoost, QDA-LDA and SVM-SGD. Its strong predictive accuracy, robustness and capability to generalize effectively to unseen data highlight its suitability for use in agricultural decision-support systems.
       
The results emphasize the significant promise of XAI-HACO in advancing precision agriculture. In particular, the superior performance of the RF-ET model suggests that algorithms capable of handling diverse feature sets, reducing overfitting and capturing complex decision boundaries are especially effective for mixed-crop recommendation tasks. This study demonstrates that such intelligent, data-driven frameworks can support more accurate and efficient crop planning, eventually enhancing farmland utilization, improving agricultural productivity and provide transparent inform decision-making for farmers.
This study introduced an innovative XAI-HACO framework to enhance crop selection and planning across varying agro-ecological conditions. By utilizing key soil and climatic variables comprise of nitrogen, phosphorus, potassium, temperature, humidity, pH and rainfall the proposed framework successfully captured the complex and non-linear interactions that influence optimal crop combinations in region specific farms condition. Among the tested hybrid models, the RF-ET classifier achieved the highest overall performance, consistently surpassing other hybrid approaches. Its strong predictive accuracy and stable generalization ability highlight its potential for practical use in agronomic decision-support systems.
       
The results demonstrate the effectiveness of novel XAI-HACO techniques to develop intelligent and context-aware mixed-crop recommendation solutions. The XAI-HACO framework provides a robust, data-driven tool that can assist farmers in improving crop productivity, optimizing farmland utilization, transparent and interpretability decision and encouraging more sustainable agricultural practices. Future research should give emphasis to farmer-centric decision support system. A model that can be employed as a web-based or mobile, by allowing farmers to get explainable recommendations in their local dialects. 
The authors like to appreciate the support acknowledged from Nigerian Tertiary Education Trust Fund (Tetfund) and Sharda University, India.
The authors declared that they don’t have any conflict of interest.

  1. Bhimanpallewar, R.N. and Narasingarao, M.R. (2021). Evaluating the influence of soil and environmental parameters in terms of crop suitability using machine learning. Indian Journal of Agricultural Research. 56(2): 208-213. doi: 10.18805/IJARe.A-4942.

  2. Chen, E., Gao, Q., Zheng, B., Wang, L. and Lin, W. (2025). Assessing legume crop growth and yield prediction using drone- based remote sensing. Legume Research-An International Journal. 1-7. doi: 10.18805/LRF-868.

  3. Cruz, U.C., Anne, K., Antonio, B., Jaime, D.C. and Constantino, V. (2022). Robotic fertilization in strip cropping using a CNN Vegetables detection-characterization method. Computers and Electronics in Agriculture. 193: 106684. https://doi. org/10.1016/j.compag.2022.106684.

  4. Deepak, P. (2023). IoT-based winter season crop prediction using machine learning on Vyas municipality ward No-13, Nepal. International Journal of Agricultural Science and Food Technology. 9(3): 76-86. https://doi.org/10.17352/2455-815X.000196.

  5. Dey, B., Ferdous, J. and Ahmed, R. (2024). Machine learning based recommendation of agricultural and horticultural crop farming in India under the regime of NPK, soil pH and three climatic variables. Heliyon. 10(3): e25112. https:/ /doi.org/10.1016/j.heliyon.2024.e25112.

  6. Ed-daoudi, R., Altaf, A., Badia, E. and Jamal, Z.  (2023). A predictive approach to improving agricultural productivity in morocco through crop recommendations. International Journal of Advanced Computer Science and Applications. 14(3): 199. https://doi.org/10.14569/IJACSA.2023.0140322.

  7. FAO (2023). Up to 40 Per cent of Global Crop Production is Lost Due To Single-Cropping, Pests and Diseases Every Year. Food and Agriculture Organization of the United Nations. https://www.fao.org/. 

  8. Gao, J., Wenzhi, Z., Zhipeng, R., Chang, A., Guoqing, L., Thomas, G. and Amit, K.S. (2023). A fertilization decision model for maize, rice and soybean based on machine learning and swarm intelligent search algorithms. Agronomy. 13(5): 1400. https://doi.org/10.3390/agronomy13051400.

  9. Huang, Y., Rishi, S., Chloe, N., Jerry, G., Jane, W. and Sen, C.  (2023). Data-driven soil analysis and evaluation for smart farming using machine learning approaches. Agriculture. 13(9): 1777. https://doi.org/10.3390/agriculture13091777.

  10. Islam, M.R., Khondokar, O., Kabir, M.M.,  Alom, M. and Mridha, M.F.  (2023). Machine learning enabled IoT system for soil nutrients monitoring and crop recommendation. Journal of Agriculture and Food Research. 14: 100880. https:// doi.org/10.1016/j.jafr.2023.100880.

  11. Kalmani, V.H., Dharwadkar, N.V. and Thapa, V. (2024). Crop yield prediction using deep learning algorithm based on CNN- LSTM with attention layer and skip connection. Indian Journal of Agricultural Research. 59(8): 1303-1311. doi: 10.18805/IJARe.A-6300.

  12. Khan, A.A., Muhammad, F., Rab, N.B., Chitapong, W. and Muhammad, Z. A. (2022). Internet of things (IoT) assisted context aware fertilizer recommendation. IEEE Access. 10: 129505- 129519. https://doi.org/10.1109/ACCESS.2022.3228160.

  13. Kollu, P.K., Bangare, M.L., Prasad, P.V.H., Bangare, P.M., Rane, K.P., Arias-Gonzáles, J.L., Lalar, S. and Shabaz, M.  (2023). Internet of things driven multilinear regression technique for fertilizer recommendation for precision agriculture. SN Applied Sciences. 5(10): 264. https://doi.org/10.1007/s42452-023-05484-8.

  14. Kukkar, A., Rajni, M., Sharma, A., Mallik, S. and Shah, M.A.  (2024). AgroAdvisor: Crop yield prediction, crop and fertilizer recommendation system using random forest with gradient boosting and DeepFM for precise agriculture. General Information. https://doi.org/10.21203/rs.3.rs-4099720/v1.

  15. Kuradusenge, M., Hitimana, E., Hanyurwimfura, D., Rukundo, P., Mtonga, K., Mukasine, A., Uwitonze, C., Ngabonziza, J. and Uwamahoro, A. (2023). Crop yield prediction using machine learning models: Case of irish potato and maize. Agriculture. 13(1): 225. https://doi.org/10.3390/agriculture13010225.

  16. Musanase, C., Vodacek, A., Hanyurwimfura, D., Uwitonze, A., Fashaho, A. and Turamyemyirijuru, A. (2023). Prediction of soil quality in rwanda for ideal cultivation of potato (Solanum tuberosum) using fuzzy logic and machine learning. International Journal of Fuzzy Logic and Intelligent Systems. 23(2): 214-228. https://doi.org/10.539 1/IJFIS.2023.23.2.214.

  17. Na, M.H. and Na, I.S. (2024). Detection and classification of wilting in soybean crop using cutting-edge deep learning techniques. Legume Research-An International Journal. 47(10): 1723-1729. doi: 10.18805/LRF-797.


  18. Sajindra, H., Abekoon, T., Jayakody, C.A. and  Rathnayake, U. (2024). A novel deep learning model to predict the soil nutrient levels (N, P and K) in cabbage cultivation. Smart Agricultural Technology. 7: 100395. https://doi.org/10.10 16/j.atech.2023.100395.

  19. Sani, S.R., Ummadi, S.V.S., Thota, S., Muthineni, N., Swargam, V.S.S. and Ravella, T.S. (2023). Crop Recommendation System using Random Forest Algorithm in Machine Learning. 2023 2nd International Conference on Applied Artificial Intelligence and Computing (ICAAIC). 2023 2nd International Conference on Applied Artificial Intelligence and Computing (ICAAIC), Salem, India: IEEE, pp. 501- 505. https://doi.org/10.1109/ICAAIC56838.2023.10141384.

  20. Tamilarasan, M. (2024). Crop plantaion suggesion and yield forcasting system. Industrial Engineering Journal. 53(2): 108-124.

  21. Tkatek, S., Amassmir, S., Belmzoukia, M. and Abouchabaka, J.  (2023). Predictive fertilization models for potato crops using machine learning techniques in moroccan gharb region. International Journal of Electrical and Computer Engineering (IJECE). 13(5): 5942. https://doi.org/10.11591/ijece.v13i5.pp5942-5950.

Explainable AI-enabled Mixed-crop Recommendation Model using Hybrid Machine Learning and Ant Colony Optimization

A
Ahmed Mohammed Gimba1
P
Pradeep Kumar Mishra1,*
1Department of Computer Science and Applications, School of Computing Science and Engineering, Sharda University, Greater Noida-201 310, Uttar Pradesh, India.

Background: Mixed-cropping are widely recognized for enhancing land-use efficiency, improving soil fertility and contributing to long-term agricultural sustainability. However, choosing optimal crop combinations tailored to specific farm conditions remains a challenging, particularly in developing regions.

Methods: To address this limitation, this study proposes a novel explainable artificial intelligence (XAI)-Driven hybrid machine learning and ant colony optimization (ACO) framework (XAI-HACO) for mixed-crop recommendation, integrating soil nutrient, weather variables. hybrid machine learning techniques such as random forest-extra trees (RF-ET), decision tree-C4.5 (DT-C4.5), extreme gradient boosting-gradient boosting (XGBoost-GBoost), quadratic discriminant analysis-linear discriminant analysis (QDA-LDA) and support vector machine-stochastic gradient decent (SVM-SGD) were developed and assessed using an indigenous mixed-crop dataset of Andhra Pradesh, India. The models performance was assessed using accuracy, precision, recall, F1-score, confusion matrix and ROC-Curve, while ACO was employed to optimize feature selection and model hyperparameters.

Result: The investigational results show that the proposed RF-ET hybrid model achieved superior performance 95.91% accuracy, precision at 95.08%, recall at 95.91% and F1-score at 95.49%. These results show that the proposed XAI-HACO framework offers a reliable, transparent, interpretability and data-driven decision support tool for farmers and agricultural stakeholders, facilitating informed selection of suitable mixed-cropping systems.

Sustainable agriculture depends on smart decision-making farmers need to use their land efficiently, boost yield, and reduce risks from climate and pests. Mixed-cropping, where two or more crops are grown together on the same field, helps achieve these goals by improving soil fertility, reducing pest pressure, increasing overall productivity, and giving farmers more stable income. However, choosing the right crop combinations is not simple. It requires understanding numerous aspects such as soil nutrients (NPK), pH level, rainfall patterns, how well crops grow together, and even market demand. Traditionally, farmers rely heavily on single-crop recommendation practices, and this system limit land utilization and decrease farming productivity. With the rise of Machine Learning (ML), we now have influential tools that can analyze huge volumes of agricultural data and offer more consistent recommendations. Currently most ML systems are designed for recommending a single crop, not combinations of crops grown together. However, these models largely as black-box systems, proposing limited transparency and interpretability, which makes it hard for farmers to understand the reasoning behind the recommended crops. In (Gao et al., 2023). The study integrates machine learning and swarm intelligence to improve crop yield prediction and fertilization decisions. RF, ERT, and XGBoost models are tested, with ERT showing the best performance. The proposed model effectively identifies optimal fertilization strategies with high accuracy. (Ed-daoudi et al., 2023). The study develops a web-based crop recommendation system that uses machine learning to suggest suitable crops based on soil and climate conditions. Among the five algorithms tested, Random Forest delivered the highest performance. (Sajindra et al., 2024). Proposes a deep learning model to estimate soil NPK levels using plant growth features such as height, leaf count, and leaf area. The Levenberg-Marquardt method with different transfer functions was tested, showing improved predictions, with pure linear and tangent sigmoid functions achieving the highest Pearson correlation (Tkatek et al., 2023). The researchers developed and compared several ML prediction models, including SVM, KNN, NB, RF, DT, and XGBoost. They evaluated model performance by employing error metrics like MSE, MAE, RMSE, and R-Squared. (Khan et al., 2022). Presents a machine learning-based fertilizer recommendation system that leverages IoT-enabled real-time soil nutrient data. By integrating a soil fertility mapping framework, the system provides context-aware and accurate fertilizer recommendations. (Islam et al., 2023). Employs an ML-based IoT system that collects real-time soil and climate data through sensors and transmits it via MQTT. The data is analyzed using machine learning models to recommend suitable crops and optimal fertilizer plans based on current soil conditions. (Kuradusenge et al., 2023). Uses machine learning models comprising RF, PR, and SVR to predict crop yields for Irish potatoes and maize based on climatological data. In (Huang et al., 2023). Proposes a machine learning-based soil analysis system that uses real-time and sensor data to provide crop, irrigation, and fertilizer recommendations, helping farmers farm more sustainably and proficiently. (Deepak, 2023). Develops an IoT-based monitoring system combined with machine learning to recommend suitable crops. By integrating real-time field data with ML models, it supports farmers in making informed decisions on crop selection, timing, and resource management. (Dey et al., 2024). Evaluated five ML models on agricultural, horticultural, and combined crop datasets, concluding that predicting yields is more accurate when crop types are analyzed separately. (Musanase et al., 2023). Estimates soil suitability for potato cultivation using Rwanda as a case study. It applies bootstrapping to expand limited data, uses fuzzy logic for classification, and evaluates machine learning models to support accurate soil quality prediction (Cruz et al., 2022). The study uses graph convolutional networks and graph neural networks to recommend crops by modeling relationships between soil and climate features, enabling accurate seasonal crop predictions (Kollu et al., 2023). Employs IoT data and machine learning for fertilizer recommendation, using SFFS for feature selection and Multilinear Regression for classification. The proposed SFFS-MLR model outperforms Random Forest, C4.5, and Naïve Bayes (Kukkar et al., 2024). Introduces AgroAdvisor, a hybrid model combining RFXGB and DeepFM for crop recommendation, achieving higher accuracy than traditional ML and deep learning methods. (Tamilarasan, 2024). Compares multiple ML models for crop recommendation, with Random Forest performing best. A hybrid approach combining Random Forest and PCA further improves accuracy.
       
According to (Naveen et al., 2023). Proposes an algorithm that converts discrete values into factors, creates multiple datasets, and applies an extended K-means approach with lambda estimation for class assignment. (Chen et al., 2025). Uses vegetation indices (NDVI, GNDVI, and canopy cover) with machine learning models to predict crop growth and yield, validated using ground-based data. (Kalmani et al., 2024). The authors develop an enhanced CNN-LSTM hybrid model with attention mechanisms to improve wheat and rice yield prediction accuracy in India. (Na and Na, 2024). The study uses a VGG16-based CNN model to detect soybean wilting, providing an accurate deep learning approach for identifying crop stress.
Key gaps identified in previous studies. 
       
Despite the growing attention in machine learning crop recommendation models, there remains a significant need to explore how Explainable Artificial Intelligence (XAI) and Hybrid Machine Learning can be effectively merge with optimization techniques (XAI-HACO) for mixed-crop recommendations. Existing studies uncommonly integrate multiple classifiers within a combined XAI-HACO framework. This study addresses these limitations by introducing a novel XAI-HACO model specifically designed for region-specific mixed-crop recommendation system.
       
According to Food and Agriculture Organization (FAO, 2023). Disclose that 20-40% yield losses, while mixed cropping in India can increase smallholder profits by up to 25%. However, the lack of digital tools limits its adoption, highlighting the need for an ML-based system to support optimal mixed-crop decisions.
       
This study presents a XAI-Enable Hybrid Machine Learning and Ant Colony Optimization Framework (XAI-HACO) that recommends optimal mixed-crop combinations by analyzing soil, nutrient, and climate data, specifically tailored to the environments of Andhra Pradesh, India. The proposed model can provide transparency, interpretability and visual explanation for farmers to know the motive behind the recommended crops.
Key contribution to this research.
       
A state-of-the-art XAI-HACO mixed-crop recommendation system that can accurately classify the most suitable mixed-cropping and transparent, interpretable inform decision based on regional soil and climatic conditions of individual farmland.
This study presents a novel mixed-crop recommendation framework that combines XAI-HACO to provide accurate, context-specific mixed-crop recommendations for the soil and climate conditions of Andhra Pradesh, India. Using primary soil and climatic features obtained from Indian Institute of Soil Science (IISS), Bhopal, the system integrates multiple classifiers including RF-ET, DT-C4.5, XGBoost-GBoost, QDA-LDA and SVM-SGD to enhance predictive performance. The incorporated ACO technique further optimizes mixed-crop patterns, resulting in a robust, data-driven recommendation framework. Fig 1 illustrate the sequence modules of the XA-HACO system, form the data collection and pre-processing to hybrid model training, ACO optimization, model evaluation and final mix-crop recommendation.

Fig 1: Proposed model workflow.


 
Dataset
 
The datasets have been collected from Indian Institute of Soil Science, Bhopal. By utilizing a specific region of Andhra Pradesh, India. The dataset includes soil and climate variables consist of (NPK), temperature, humidity, pH and rainfall. A total of 2552 entries and 36 different variety of crops were collected for this study. Fig 2 indicate sample records from the processed dataset, emphasizing soil and climate features with their corresponding mixed-crop labels utilized in model training and evaluation.  

Fig 2: Illustrate the dataset of Andhra Pradesh used for mixed-crop recommendation.


       
The dataset samples were collected from all the major towns in Andhra Pradesh, India. Finally, the study also considered the aggregation of all agricultural seasons. Fig 3 demonstrate the major cities that soil and climate samples were collected.

Fig 3: Study area from which soil and climate were derived, i.e. Andhra Pradesh.


 
Data preprocessing
 
This is one of the most significant phase in machine learning since the accuracy and performance of the machine learning technique are dependent on the excellence of the data that we keep (Sani et al., 2023). Data pre-processing consists of selecting some important features, fixing missing data values, removing duplicates, overfitting and under-fitting, dealing with outliers, feature engineering and so on. Feature selection The process of selecting the appropriate input parameters from the dataset that contribute the most to the prediction output of a machine learning model.
 
Model training and testing
 
The dataset is spread into training and testing batches, which enhances memory efficiency and accuracy. A validation set continuously analyzes the models performance to sidestep overfitting and selects the optimal model based on the validation parameters. After training is completed, we tested on a different test set to see how fit it generalizes to new data.
 
Model performance evaluation
 
The model assessment refers to the method in machine learning during which performance of a model is analytically assess and evaluated. The purpose is to find out how good the prediction quality of the model is and how well. Each mixed-crop recommendation models accuracy, precision and recall score were thoroughly assessed.
 
Accuracy
 
A simple technique to assess accuracy is to look at how frequently the classifier predicts accurately. The ratio of the total of precisely predicted outcomes to all of the models predictions can be used to calculate accuracy.

 
Precision
 
Describes as the ratio of true positives to the sum of true positives and false positives, which indicates the accuracy of positive predictions. 

 
Recall
 
Is the ratio of true positives to the sum of true positives and false negatives, which indicates how successfully the model classifies all appropriate events.


F1-score
 
Incorporate precision and recall into a sole balanced metric, creating it particularly suitable for evaluating models on imbalanced datasets where accuracy can be deceptive.

 
Confusion matrix
 
A confusion matrix is a performance assessment tool in machine learning that visualizes the accuracy of a classification model. It indicates the totals of true positives, true negatives, false positives and false negatives, helping to evaluate model performance, detect misclassifications and enhance overall prediction accuracy.
 
For a dataset of size N
 
N = True positive (TP) + True negative (TN) + False positive (FP) + False negative (FN)
 
Receiver operating characteristics curve
 
Shows how fit a classification model achieves by illustrating the trade-off among the true positive rate (TPR) and (the false positive rate (FPR) across diverse decision thresholds.

 
Algorithm-XAI-HACO mixed-crop recommendation System
 
Step 1: Collect the dataset (Regional dataset).
 
Step 2: Perform data-preprocessing (Data cleaning, replacing missing values, feature selection and engineering).
 
Step 3: Model training and testing (Split the dataset into 80% for training and 20% for testing).
 
Step 4: Building hybrid ML models (RF+ET, DT+C4.5, XGBoost+GBoost, QDA+LDA, SVM+SGD.
 
Step 5: Define (Ant colony optimization) Initialize necessary parameters and pheromone trials.
While not termination do.
Generate ant population.
Calculate fitness values associated with each ant.
Find best solution through selection methods.
Update pheromone trial.
End while.
End procedure.
 
Step 6: Model performance evaluation (Accuracy, precision, recall, F1-score, confusion matrix, ROC-curve).
 
Step 7: XAI-HACO mixed-crop recommendation.
The results of our proposed XAI-HACO mixed-crop recommendations obtained using RF-ET, DT-C4.5, XGBoost-GBoost, QDA-LDA and SVM-SGD, models show that RF-ET outperforms the others with 0.95.91% accuracy. The hybrid machine learning models were compared using various performance metrics. Table 1 show the accuracy, precision, recall and F1-score of the XAI-HACO recommendation models used. The proposed XAI-HACO model offers personalized mixed-crop recommendations by analyzing an indigenous soil and climatic conditions of individual farmers farmland, enabling the cultivation of diverse and suitable mixed-crop. This has the potential to significantly improve farm production and increase the economic returns for farmers.  

Table 1: XAI-HACO mixed-crop recommendation performance metrics.


       
Fig 4 proves the ROC curve comparison of the hybrid ML models, proving their discriminative capability by contrasting true positive rates against false positive rates across diverse classification thresholds.     

Fig 4: ROC-curve of XAI-HACO models.


       
Fig 5 describes the confusion matrix of proposed model, indicating classification performance across various mixed-crop classes and highlighting the distribution of correct and misclassified predictions.

Fig 5: Illustrate the RF-ET classifier mixed-crop recommendation confusion matrix.


       
Fig 6 shows a sample prediction output of the trained hybrid model, demonstrating how input soil and climatic features are processed to generate a recommended suitable mixed-crop.  

Fig 6: Demonstrate the model prediction for mixed-crop before employing XAI.


       
Fig 7 demonstrate the SHAP summary plot of the XAI model, showing the relative significance and influence of soil and climatic parameters on mixed-crop recommendation results.  

Fig 7: Illustrate the SHAP prediction summary plot of mixed-crop recommendation.


       
This SHApley Additive exPlanations (SHAP) summary explains why the proposed XAI-HACO-based model recommends maize, cowpea and groundnut together as demonstrated in the Fig 7. High (N) level strongly drive the model toward recommending maize, indicating maize demand high nitrogen and also moderate nitrogen levels support cowpea and groundnut. The soil nutrient levels strongly support crops like maize, which requires more nutrients to grow healthy. Temperature and humidity are appropriate for cowpea and groundnut, which grow well in warm environments and support to enhance soil fertility. Soil pH value influence how well crops soak-up nutrients. The pH level indicate supports groundnut development. Rainfall has a lesser effect, which means the crops can still perform well even with modest precipitation.
       
The findings of this study demonstrate XAI-HACO offers strong potential for addressing real-world mixed-crop recommendation challenges. By incorporating essential soil nutrient and climatic variables nitrogen (N), phosphorus (P), potassium (K), temperature, humidity, pH value and rainfall the proposed framework effectively captures the complex interactions present in high-dimensional agricultural datasets. Among the evaluated hybrid models, the RF-ET classifier attained the highest performance, attaining an accuracy of 95.91% and consistently outperforming other hybrid approaches such as DT-C4.5, XGBoost-GBoost, QDA-LDA and SVM-SGD. Its strong predictive accuracy, robustness and capability to generalize effectively to unseen data highlight its suitability for use in agricultural decision-support systems.
       
The results emphasize the significant promise of XAI-HACO in advancing precision agriculture. In particular, the superior performance of the RF-ET model suggests that algorithms capable of handling diverse feature sets, reducing overfitting and capturing complex decision boundaries are especially effective for mixed-crop recommendation tasks. This study demonstrates that such intelligent, data-driven frameworks can support more accurate and efficient crop planning, eventually enhancing farmland utilization, improving agricultural productivity and provide transparent inform decision-making for farmers.
This study introduced an innovative XAI-HACO framework to enhance crop selection and planning across varying agro-ecological conditions. By utilizing key soil and climatic variables comprise of nitrogen, phosphorus, potassium, temperature, humidity, pH and rainfall the proposed framework successfully captured the complex and non-linear interactions that influence optimal crop combinations in region specific farms condition. Among the tested hybrid models, the RF-ET classifier achieved the highest overall performance, consistently surpassing other hybrid approaches. Its strong predictive accuracy and stable generalization ability highlight its potential for practical use in agronomic decision-support systems.
       
The results demonstrate the effectiveness of novel XAI-HACO techniques to develop intelligent and context-aware mixed-crop recommendation solutions. The XAI-HACO framework provides a robust, data-driven tool that can assist farmers in improving crop productivity, optimizing farmland utilization, transparent and interpretability decision and encouraging more sustainable agricultural practices. Future research should give emphasis to farmer-centric decision support system. A model that can be employed as a web-based or mobile, by allowing farmers to get explainable recommendations in their local dialects. 
The authors like to appreciate the support acknowledged from Nigerian Tertiary Education Trust Fund (Tetfund) and Sharda University, India.
The authors declared that they don’t have any conflict of interest.

  1. Bhimanpallewar, R.N. and Narasingarao, M.R. (2021). Evaluating the influence of soil and environmental parameters in terms of crop suitability using machine learning. Indian Journal of Agricultural Research. 56(2): 208-213. doi: 10.18805/IJARe.A-4942.

  2. Chen, E., Gao, Q., Zheng, B., Wang, L. and Lin, W. (2025). Assessing legume crop growth and yield prediction using drone- based remote sensing. Legume Research-An International Journal. 1-7. doi: 10.18805/LRF-868.

  3. Cruz, U.C., Anne, K., Antonio, B., Jaime, D.C. and Constantino, V. (2022). Robotic fertilization in strip cropping using a CNN Vegetables detection-characterization method. Computers and Electronics in Agriculture. 193: 106684. https://doi. org/10.1016/j.compag.2022.106684.

  4. Deepak, P. (2023). IoT-based winter season crop prediction using machine learning on Vyas municipality ward No-13, Nepal. International Journal of Agricultural Science and Food Technology. 9(3): 76-86. https://doi.org/10.17352/2455-815X.000196.

  5. Dey, B., Ferdous, J. and Ahmed, R. (2024). Machine learning based recommendation of agricultural and horticultural crop farming in India under the regime of NPK, soil pH and three climatic variables. Heliyon. 10(3): e25112. https:/ /doi.org/10.1016/j.heliyon.2024.e25112.

  6. Ed-daoudi, R., Altaf, A., Badia, E. and Jamal, Z.  (2023). A predictive approach to improving agricultural productivity in morocco through crop recommendations. International Journal of Advanced Computer Science and Applications. 14(3): 199. https://doi.org/10.14569/IJACSA.2023.0140322.

  7. FAO (2023). Up to 40 Per cent of Global Crop Production is Lost Due To Single-Cropping, Pests and Diseases Every Year. Food and Agriculture Organization of the United Nations. https://www.fao.org/. 

  8. Gao, J., Wenzhi, Z., Zhipeng, R., Chang, A., Guoqing, L., Thomas, G. and Amit, K.S. (2023). A fertilization decision model for maize, rice and soybean based on machine learning and swarm intelligent search algorithms. Agronomy. 13(5): 1400. https://doi.org/10.3390/agronomy13051400.

  9. Huang, Y., Rishi, S., Chloe, N., Jerry, G., Jane, W. and Sen, C.  (2023). Data-driven soil analysis and evaluation for smart farming using machine learning approaches. Agriculture. 13(9): 1777. https://doi.org/10.3390/agriculture13091777.

  10. Islam, M.R., Khondokar, O., Kabir, M.M.,  Alom, M. and Mridha, M.F.  (2023). Machine learning enabled IoT system for soil nutrients monitoring and crop recommendation. Journal of Agriculture and Food Research. 14: 100880. https:// doi.org/10.1016/j.jafr.2023.100880.

  11. Kalmani, V.H., Dharwadkar, N.V. and Thapa, V. (2024). Crop yield prediction using deep learning algorithm based on CNN- LSTM with attention layer and skip connection. Indian Journal of Agricultural Research. 59(8): 1303-1311. doi: 10.18805/IJARe.A-6300.

  12. Khan, A.A., Muhammad, F., Rab, N.B., Chitapong, W. and Muhammad, Z. A. (2022). Internet of things (IoT) assisted context aware fertilizer recommendation. IEEE Access. 10: 129505- 129519. https://doi.org/10.1109/ACCESS.2022.3228160.

  13. Kollu, P.K., Bangare, M.L., Prasad, P.V.H., Bangare, P.M., Rane, K.P., Arias-Gonzáles, J.L., Lalar, S. and Shabaz, M.  (2023). Internet of things driven multilinear regression technique for fertilizer recommendation for precision agriculture. SN Applied Sciences. 5(10): 264. https://doi.org/10.1007/s42452-023-05484-8.

  14. Kukkar, A., Rajni, M., Sharma, A., Mallik, S. and Shah, M.A.  (2024). AgroAdvisor: Crop yield prediction, crop and fertilizer recommendation system using random forest with gradient boosting and DeepFM for precise agriculture. General Information. https://doi.org/10.21203/rs.3.rs-4099720/v1.

  15. Kuradusenge, M., Hitimana, E., Hanyurwimfura, D., Rukundo, P., Mtonga, K., Mukasine, A., Uwitonze, C., Ngabonziza, J. and Uwamahoro, A. (2023). Crop yield prediction using machine learning models: Case of irish potato and maize. Agriculture. 13(1): 225. https://doi.org/10.3390/agriculture13010225.

  16. Musanase, C., Vodacek, A., Hanyurwimfura, D., Uwitonze, A., Fashaho, A. and Turamyemyirijuru, A. (2023). Prediction of soil quality in rwanda for ideal cultivation of potato (Solanum tuberosum) using fuzzy logic and machine learning. International Journal of Fuzzy Logic and Intelligent Systems. 23(2): 214-228. https://doi.org/10.539 1/IJFIS.2023.23.2.214.

  17. Na, M.H. and Na, I.S. (2024). Detection and classification of wilting in soybean crop using cutting-edge deep learning techniques. Legume Research-An International Journal. 47(10): 1723-1729. doi: 10.18805/LRF-797.


  18. Sajindra, H., Abekoon, T., Jayakody, C.A. and  Rathnayake, U. (2024). A novel deep learning model to predict the soil nutrient levels (N, P and K) in cabbage cultivation. Smart Agricultural Technology. 7: 100395. https://doi.org/10.10 16/j.atech.2023.100395.

  19. Sani, S.R., Ummadi, S.V.S., Thota, S., Muthineni, N., Swargam, V.S.S. and Ravella, T.S. (2023). Crop Recommendation System using Random Forest Algorithm in Machine Learning. 2023 2nd International Conference on Applied Artificial Intelligence and Computing (ICAAIC). 2023 2nd International Conference on Applied Artificial Intelligence and Computing (ICAAIC), Salem, India: IEEE, pp. 501- 505. https://doi.org/10.1109/ICAAIC56838.2023.10141384.

  20. Tamilarasan, M. (2024). Crop plantaion suggesion and yield forcasting system. Industrial Engineering Journal. 53(2): 108-124.

  21. Tkatek, S., Amassmir, S., Belmzoukia, M. and Abouchabaka, J.  (2023). Predictive fertilization models for potato crops using machine learning techniques in moroccan gharb region. International Journal of Electrical and Computer Engineering (IJECE). 13(5): 5942. https://doi.org/10.11591/ijece.v13i5.pp5942-5950.
In this Article
Published In
Indian Journal of Agricultural Research

Editorial Board

View all (0)