A machine learning project that recommends the best crop to grow based on soil and environmental conditions.
This project uses machine learning to help farmers choose the right crop based on:
- Soil nutrients (NPK values)
- Temperature & Humidity
- pH level
- Rainfall
Dataset: 2,200 samples covering 22 different crops
| Model | Accuracy |
|---|---|
| Gaussian Naive Bayes | 99.55% 🥇 |
| Support Vector Machine | 99.55% 🥇 |
| Random Forest | 99.32% |
| XGBoost | 99.09% |
pip install -r requirements.txtjupyter notebook crop_recommendation.ipynb- N: Nitrogen content
- P: Phosphorus content
- K: Potassium content
- Temperature: °C
- Humidity: %
- pH: Soil pH level
- Rainfall: mm
Rice, Wheat, Maize, Cotton, Jute, Coffee, Apple, Banana, Mango, Grapes, Watermelon, Orange, Papaya, Coconut, Chickpea, Lentil, Blackgram, Mungbean, Mothbeans, Pigeonpeas, Kidneybeans, Pomegranate
- Python 3.8+
- scikit-learn
- pandas, numpy
- matplotlib, seaborn
- XGBoost, LightGBM, CatBoost
crop_recommendation.ipynb- Main notebook with all modelsEM(1).ipynb- Ensemble methods experimentsCrop_recommendation.csv- Dataset
Machine Learning for Agriculture - Making farming smarter 🌾