๐พ Crop Nitrogen Prediction using Random Forest Regressor Welcome to the Crop Nitrogen Prediction project! This repository houses a Python script that leverages the power of the Random Forest Regressor to predict crop nitrogen levels with precision. This comprehensive script covers data preprocessing, model training, evaluation, and the generation of insightful visualizations.
Prerequisites Before delving into the script, make sure you've got these essential libraries installed:
๐ฆ pandas ๐ฆ scikit-learn ๐ฆ matplotlib You can easily install these libraries using pip:
bash Copy code pip install pandas scikit-learn matplotlib Getting Started Follow these simple steps to harness the capabilities of this project:
- Clone the Repository Clone this repository to your local machine using the following command:
bash Copy code git clone https://github.com/aryand1/crop-nitrogen-prediction.git 2. Data Preparation The script is designed to work with CSV data. Ensure your data adheres to the specified format for seamless processing.
- Run the Script Execute the Python script using this command:
bash Copy code python crop_nitrogen_prediction.py Results Upon running the script, you'll receive the following valuable insights:
๐ Mean Squared Error (MSE): A measure of the model's accuracy. ๐ R-squared (R2): A metric indicating the goodness of fit. ๐ Residual Plot: A scatter plot that vividly displays the differences between true and predicted values. Project Structure crop_nitrogen_prediction.py: The main Python script that handles data preprocessing, model training, and evaluation. Available Regression Models Our toolkit supports a range of powerful regression models:
Linear Regression Ridge Regression Lasso Regression Support Vector Regression (SVR) Random Forest Regression Gradient Boosting Regression Finding the Best Model Our script automates the process of model selection by identifying the best-performing model based on the lowest Mean Squared Error (MSE). The result is conveniently displayed at the end of the execution.
Accepted Crop Types This application caters to a diverse range of crops for accurate predictions, including but not limited to:
rice maize chickpea kidneybeans pigeonpeas mothbeans mungbean blackgram lentil pomegranate banana mango grapes watermelon muskmelon apple orange papaya coconut cotton jute coffee
Project Components data.csv: The dataset utilized for training and testing. README.md: This document provides a comprehensive overview of the project. Training_and_Prediction.ipynb: Code for training the model and prediction with the user interface: To run this file, use the command "streamlit run with user interface.py" in your virtual environment in anaconda (as anaconda is their official partner. It works best there; I am not sure about other IDEs; it should work but I am not sure).
Author Aryan Singh Dalal
Acknowledgments We'd like to extend our gratitude to the data sources and references that contributed to the success of this project.