Multi-output Random Forest NPK nutrient and yield prediction system for Northern Nigeria agriculture
# 🌾 NPK & Yield Prediction System for Northern Nigeria
A comprehensive machine learning application for predicting soil nutrient levels (NPK) and maize yield in Northern Nigeria's savanna region.
## 🎯 Features
### 🔬 NPK Prediction
- **Multi-output Random Forest model** predicting Nitrogen, Phosphorus, and Potassium simultaneously
- **95 soil samples** analyzed across 10 LGAs in Northern Nigeria
- **Real-time predictions** based on soil chemical and physical properties
- **Management recommendations** for nutrient optimization
### 🌾 Yield Prediction
- **Maize yield forecasting** using integrated soil and management data
- **490 yield records** from 9 LGAs with soil-management integration
- **Variety and treatment impact** analysis
- **Actionable insights** for yield improvement
### 📊 Interactive Analytics
- **Feature importance analysis** showing key predictors
- **Soil property correlations** and relationships
- **Geographic variation** across different LGAs
- **Performance metrics** and model validation
## 🚀 Quick Start
### Local Installation
1. **Clone the repository**
```bash
git clone
github.com
cd npk-yield-prediction
```
2. **Install dependencies**
```bash
pip install -r requirements.txt
```
3. **Run the Streamlit app**
```bash
streamlit run app.py
```
4. **Open your browser** to `
localhost`
### Streamlit Cloud Deployment
1. **Fork this repository** to your GitHub account
2. **Go to Streamlit Cloud**
3. **Deploy** by connecting your GitHub repository
4. **Configure** the main file path as `app.py`
## 📊 Dataset Information
### Soil Data
- **Geographic Coverage**: Kaduna, Katsina, and Kano states
- **Sample Size**: 95 soil samples
- **Parameters**: pH, Organic Carbon, N, P, K, texture, location
- **LGAs Covered**: 10 Local Government Areas
### Yield Data
- **Crop Focus**: Maize (Zea mays)
- **Records**: 490 yield observations
- **Management**: Variety types (OPV/Hybrid), fertilizer treat …