A machine learning-based decision support system designed to recommend optimal crops based on soil and environmental conditions, enhanced with business impact analysis to evaluate economic and agricultural implications.
This project applies supervised machine learning techniques to predict the most suitable crop using agricultural features such as soil nutrients and climate conditions. Beyond model development, the project incorporates a business impact analysis to assess how predictive recommendations can improve yield optimization, resource allocation, and profitability in agricultural decision-making.
Input features:
- Nitrogen (N)
- Phosphorus (P)
- Potassium (K)
- Temperature
- pH
- Rainfall
Target variable:
- Recommended Crop Type
- Exploratory Data Analysis (EDA)
- Data preprocessing
- Addressed class imbalance using SMOTE (Synthetic Minority Over-sampling Technique)
- Model training and comparison
- Confusion matrix and classification report analysis
- Business impact interpretation of model predictions
Models implemented:
- Logistic Regression
- Support Vector Machine
- K-Nearest Neighbors
- Random Forest
- XGBoost
The best-performing model achieved strong classification performance across all crop classes, demonstrating robust generalization capability under varying environmental conditions.
Evaluation metrics used:
- Accuracy
- Precision
- Recall
- F1-Score
Beyond predictive modeling, this project evaluates the economic implications of crop recommendations by estimating potential profit outcomes.
- Total ideal profit (perfect prediction scenario): 80,372,790,000
- Total predicted profit (model-based recommendation): 78,664,440,000
- Total opportunity loss: 1,708,350,000
- Average loss per sample: 472,441.92
The model captures approximately 97.88% of the maximum theoretical profit, indicating strong real-world applicability with minimal economic deviation from optimal decisions. This indicates that the model maintains near-optimal economic performance while operating under realistic predictive constraints.
This highlights the practical value of machine learning in supporting data-driven agricultural decisions while minimizing financial risk.
The results illustrate how predictive analytics can be translated into measurable economic impact within agribusiness contexts.
To enhance transparency and trust in model predictions, SHapley Additive exPlanations (SHAP) were applied to the multi-class Random Forest model.
- SHAP values were computed for all samples, features, and crop classes
- Global feature importance was derived by summing absolute SHAP values across classes
- A SHAP summary (beeswarm) plot was used to visualize feature influence
The analysis revealed that Soil Nitrogen (N) is the most influential factor in crop classification. The model relies more heavily on soil chemical properties (Nitrogen, pH, Potassium, Phosphorus) than on climatic variables (Rainfall, Temperature). Both extremely high and low Nitrogen levels were found to strongly influence specific crop predictions.
This interpretability analysis strengthens the model’s reliability and provides actionable agronomic insights beyond predictive accuracy.