AgriPredict is a machine learning project that explores the economic impact of climate change on agriculture. By analyzing factors such as temperature, CO2 emissions, precipitation, and crop yield, the model predicts the economic outcomes in agriculture. The project leverages a Random Forest Regressor to model the relationships between climate and agricultural productivity.
- Data Preprocessing: Encoding of categorical variables and scaling of numerical data.
- Exploratory Data Analysis: Visualizations of the relationships between environmental factors and agricultural outcomes.
- Model Training and Tuning: Training a Random Forest model and tuning it using
RandomizedSearchCV. - Feature Importance Analysis: Understanding which variables most influence the economic impact.
- Prediction and Evaluation: Evaluating the model's performance with Mean Absolute Error (MAE) and visualizing actual vs. predicted values.
- Python
- Jupyter Notebook
- Libraries:
pandasnumpyseabornmatplotlibscikit-learn
To run the project, ensure you have Python 3.x installed along with the required libraries. Install the dependencies using the following command:
pip install -r requirements.txt- Clone the repository:
git clone https://github.com/LazarusAA/AgriPredict-Climate-Change-Impact-on-Agriculture.git- Navigate to the project directory:
cd AgriPredict-Climate-Change-Impact-on-Agriculture- Install the required dependencies:
pip install -r requirements.txtThe dataset used for this project comes from Kaggle. It contains features related to climate change and agriculture, such as average temperature, CO2 emissions, precipitation, crop yield, and economic impact.
- Launch the Jupyter Notebook:
jupyter notebook-
Open the notebook file
climate_change_impact.ipynband execute the cells step by step to preprocess the data, train the model, and evaluate the results. -
You can customize the notebook by modifying the dataset or model parameters.
Once the dataset is preprocessed, the notebook will guide you through training the Random Forest model, tuning it with RandomizedSearchCV, and evaluating its performance using Mean Absolute Error.
- Feature Importance: Visualizations of the top contributing features in the model.
- Model Performance: Scatter plots comparing actual vs. predicted values for economic impact.
agri-predict/
│
├── climate_change_impact.ipynb # Main Jupyter Notebook
├── climate_change_impact_on_agriculture_2024.csv # Dataset (replace with your data)
├── README.md # Project Documentation
└── requirements.txt # Required dependenciesThe model identifies Crop Yield per Hectare, Irrigation Access, and Total Precipitation as key drivers of economic outcomes in agriculture. The Random Forest model achieves a Mean Absolute Error of 227.51 million USD, with potential for further improvement by incorporating more data or trying advanced models.