machine learning based analysis on cocoa yield prediction in Ghana using climatic and soil data.
# 🍫 Cocoa Yield Prediction Dashboard - Setup Guide
## Quick Start Guide for Beginners
This dashboard helps you predict cocoa yields in Ghana based on climate and soil conditions. Follow these simple steps to get started!
---
## 📋 Prerequisites
You need Python installed on your computer. Download it from python.org if you don't have it yet.
---
## 🚀 Installation Steps
### Step 1: Install Required Libraries
Open your terminal/command prompt and run:
```bash
pip install streamlit pandas numpy plotly xgboost scikit-learn
```
This installs all the necessary libraries:
- **streamlit**: Creates the web interface
- **pandas**: Handles data
- **numpy**: Mathematical operations
- **plotly**: Interactive charts
- **xgboost**: Machine learning model
- **scikit-learn**: Model training tools
### Step 2: Prepare Your Data
Make sure you have a file called `cocoa_data.csv` in the same folder as the dashboard script.
**Required columns in your CSV:**
- `rainfall` (mm)
- `temp_min` (°C)
- `temp_max` (°C)
- `solar_radiation` (MJ/m²)
- `soil_ph`
- `phosphorus` (ppm)
- `nitrogen` (ppm)
- `yield_kg_ha` (target variable - cocoa yield in kg per hectare)
**Example CSV structure:**
```csv
rainfall,temp_min,temp_max,solar_radiation,soil_ph,phosphorus,nitrogen,yield_kg_ha
1200,22.5,30.2,18.5,6.2,45,120,850
1350,21.8,29.8,19.2,6.5,52,135,920
...
```
### Step 3: Run the Dashboard
Navigate to the folder containing your script and CSV file, then run:
```bash
streamlit run cocoa_yield_dashboard.py
```
The dashboard will automatically open in your web browser at `http:/tie/localhost:8501`
---
## 🎯 How to Use the Dashboard
1. **Adjust Sliders**: Use the sidebar on the left to change climate and soil parameters
2. **View Predictions**: See the predicted yield update instantly in the main panel
3. **Explore Charts**:
- Feature Importance shows which factors matter most
- Sensitivity Analysis shows how rainfall affects yield
4. **Optimize**: Find the best conditions for maximum yiel …