Precision agriculture is increasingly important for making informed decisions about farming strategies. This project provides a dataset and tools to build a predictive model that recommends the most suitable crops to grow on a particular farm based on various parameters such as soil nutrients, temperature, humidity, pH, and rainfall.
The dataset Crop_recommendation.csv
contains information about different crops and their requirements:
- N: Nitrogen content in the soil
- P: Phosphorus content in the soil
- K: Potassium content in the soil
- temperature: Temperature of the environment
- humidity: Humidity of the environment
- ph: pH level of the soil
- rainfall: Rainfall in the area
- label: Crop name
This project involves the following steps:
- Data Exploration: Understanding the dataset, checking for missing values, and summarizing crop statistics.
- Interactive Analysis: Using interactive widgets to explore crop requirements and compare them with average conditions.
- Clustering: Applying K-Means clustering to group similar crops based on their requirements.
- Predictive Modeling: Building a logistic regression model to predict the most suitable crop based on input parameters.
- Model Evaluation: Assessing the model's performance using confusion matrices.
- Real-Time Prediction: Making real-time predictions for new data.
Install the necessary Python libraries:
pip install pandas numpy matplotlib seaborn ipywidgets scikit-learn