Answers are grounded in this paper and cite their sources.
Climate variability is a major constraint on agricultural production, with potential impacts on yields, soil degradation, and economic security. In order to solve this problem, the present study introduces a crop recommendation framework based on machine learning which considers the soil nutrients (N, P, K) and environmental factors (temp, humidity, rainfall, soil pH). The model is built using the publicly available Crop Recommendation dataset from Kaggle which has 2200 samples divided into 22 balanced classes of crops and no missing values. The data were preprocessed to ensure consistency, including Z-score-based outlier detection, standardization of features, and label encoding. The data set was divided into training (70%), validation (15%) and test (15%) sets and five-fold cross-validation was used to check the robustness of the model and its generalization. Random Forest (RF), XGBoost, LightGBM, Deep Neural Network (DNN) and Multi-Layer Perceptron (MLP) models were implemented and tuned with hyperparameter tuning using grid search. The accuracy, macro precision, macro recall, and macro F1-score were used to assess performance. Experimental results show that XGBoost and LightGBM models perform better than all the other models. The accuracy of XGBoost is 99.27% and that of LightGBM is nearly the same with 99.22%, which is also very stable in the cross-validation, thus the excellent generalization capability. Cross-validation scores (0.9909, 0.9955, 0.9955, 0.9955, 0.9932) further validate the robustness of ensemble-based approaches. Random Forest has an accuracy of 93% while DNN and MLP have an accuracy of around 98%, which are competitive but less stable than the ensemble methods from trees. The work shows that the optimized gradient boosting is better than deep learning when it comes to structured data from the agricultural domain.The study reveals that gradient boosting models like XGBoost and LightGBM outperformed deep learning models when applied to structured agricultural data sets.The study shows that structured agricultural data sets feature optimized gradient boosting models (XGBoost and LightGBM) that are consistently superior to deep learning models. What is new in this work is that it gives a comprehensive comparative analysis of various ensemble models and deep learning models and gives a strong evidence to choose one model for a crop recommendation system. Real-world noisy data and dynamic agricultural datasets like soil moisture, pest incidence, and temporal variability would be incorporated into the future to improve the applicability of the data.
No takes yet. Share an insight, caveat, or question.
Kumar et al. (2026) studied this question.
Synapse has enriched 10 related papers. Consider them for comparative context: