| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
#Suitable Crop Prediction via Multi-Class Classification (Machine Learning)
Predict the optimal crop for a farm using soil macronutrients and environmental parameters through a multi-class classification approach.
Agriculture is highly sensitive to soil and environmental variability, making crop selection a non-trivial classification problem. Differences in soil macronutrients, climatic conditions, and environmental factors directly impact crop suitability and yield. This project formulates crop recommendation as a multi-class classification task, using soil health indicators and environmental features to learn patterns associated with optimal crop growth. By applying supervised machine learning techniques to predict the most suitable crop for given farm conditions, the model enables data-driven agricultural decision-making, improved yield potential, and efficient resource utilization.
The dataset contains soil nutrient and environmental parameters used to predict the most suitable crop for cultivation. It is sourced from a publicly available Kaggle dataset.
Source: Kaggle – Crop Recommendation Dataset
Input Features:
Target Variable:
[Dataset Features] (images./Crop_Recommendation_Dataset_Features.png)
This project notebook can be executed directly in Google Colab without any local setup.
**[Open in Google Colab] **
https://colab.research.google.com/drive/1GV_rFAwoDebFCYTpe8anNIQ8KU5RiiAx?usp=sharing
Python, Pandas, Scikit-learn, Seaborn, Matplotlib
Evaluation was performed using the following metrics:
[Performance Scores]:
{With Preprocessing} (images./Crop_Prediction_Performance_of_Models.png)
This project addresses a multi-class classification problem, where traditional binary evaluation metrics such as a single ROC curve are not directly applicable. ROC curves require decomposition into multiple one-vs-rest comparisons in multi-class settings, which can reduce interpretability and obscure class-level performance.
To ensure meaningful and transparent evaluation, the model was assessed using:
• Accuracy (for overall performance comparison)
• Precision, Recall, and F1-score (weighted) to account for class distribution
• Confusion Matrix for per-class error analysis
• Weighted averaging was chosen to account for class imbalance and to ensure that performance across all classes was fairly represented.
crop-recommendation/ ├── data/ │ └── crop_data.csv # Soil & environmental dataset ├── notebooks/ │ └── crop_recommendation.ipynb # EDA, feature analysis & modeling ├── src/ │ ├── preprocessing.py # Data cleaning, scaling, encoding │ ├── train.py # Model training logic │ └── evaluate.py # Model evaluation (accuracy, F1, recall) ├── requirements.txt # Project dependencies └── README.md # Project documentation
git clone https://github.com/your-username/crop-prediction.git cd crop-prediction
Create and activate a virtual environment python -m venv venv
Activate the environment:
macOS / Linux:
source venv/bin/activate
Windows:
venv\Scripts\activate
Install dependencies pip install -r requirements.txt
Run the notebook jupyter notebook
(Recommended) Run on Google Colab
Upload the notebook to Google Colab or click the “Open in Colab” button if available.
[Correlation Matrix Applicability] (images./Crop_Prediction_Key_Learning_Correlation.png)
Model outputs are dependent on the underlying dataset and assumptions and may not generalize across regions, seasons, or real-world conditions due to environmental variability, data coverage limitations, and potential sampling bias.
| Back | FazBrowse Home | New Git URL |