Logo Lanfrica

otimongjonathan/agropredictor

Domaine:

agriculture

Type de record:

modelsoftware
Créateur:
oti
Hôte:
Hybrid Temporal KG model for agriculturral cost prediction in Uganda # Hybrid TemporalKG Agricultural Cost Predictor A Flask-based web application that uses a hybrid AI model combining Temporal (GRU) and Knowledge Graph embeddings to predict agricultural input costs for various crops in Uganda. ## Features - **Hybrid AI Model**: Combines GRU temporal patterns with Knowledge Graph embeddings - **Real-time Predictions**: Predict individual input costs (seeds, fertilizer, herbicide, pesticide, labor) per acre - **Cascading Dropdowns**: Region → District → Crop selection with data validation - **Multipliers Display**: Shows crop-specific input multipliers per acre - **Future Predictions**: Predict costs for next 3 months - **Beautiful UI**: Modern, responsive web interface ## Model Architecture - **Temporal Component (GRU)**: Learns historical price patterns over 6-month sequences - **Knowledge Graph Component**: Captures relationships between Regions, Districts, and Crops using embeddings - **Fusion Layer**: Intelligently combines both components ## Model Performance - Test R²: 99.89% - Test RMSE: 365.49 UGX ## Installation ### Local Development 1. **Clone the repository** ```bash git clone cd myapp ``` 2. **Create virtual environment** ```bash python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate ``` 3. **Install dependencies** ```bash pip install -r requirements.txt ``` 4. **Ensure model files exist** - `models/best_normalized_model.pth` - Trained model weights - `models/normalized_preprocessing.pkl` - Preprocessing pipeline - `train_dataset_cleaned.csv` - Training data 5. **Run the application** ```bash python app.py ``` 6. **Access the application** - Open browser: `localhost` ### Deployment See `DEPLOYMENT.md` for detailed deployment instructions to Crane Cloud. ## Project Structure ``` myapp/ ├── app.py # Main Flask application ├── requirements.txt # Python dependencies ├── Procfile # Gunicorn server config (for deployment …