Logo Lanfrica

Richill25/coffee-yield-classification

Domain:

agriculture

Record type:

model
Creator:
Ric
Host:
Machine learning model to predict coffee yield for smallholder farmers in East Africa using Random Forest classification # coffee-yield-classification Machine learning model to predict coffee yield for smallholder farmers in East Africa using Random Forest classification # Coffee Yield Classification in East Africa A machine learning solution to predict coffee yield categories for smallholder farmers across East Africa using agronomic and climatic features. ## Project Overview This project applies the **Nine Wheels of Statistical Machine Learning** framework to develop a predictive model that helps smallholder coffee farmers in East Africa optimize yield through data-driven decisions. **Problem**: Smallholder farmers lack information about what drives coffee yield, leading to suboptimal resource allocation and financial instability. **Solution**: A trained Random Forest model that predicts yield categories (Low/Medium/High) based on farm features, enabling farmers and extension agents to implement targeted interventions. ## Dataset - **Sample Size**: 300 farms - **Features**: 10 agronomic and climatic variables - Rainfall (mm) - Temperature (°C) - Soil pH - Nitrogen content (%) - Altitude (meters) - Fertilizer application (kg/hectare) - Planting density (plants/hectare) - Irrigation events (count) - Soil moisture (%) - **Target**: Yield category - Low: ≤ 800 kg/hectare - Medium: 800-1200 kg/hectare - High: > 1200 kg/hectare ## Model Performance **Random Forest (Winning Model)** - Test Accuracy: 1 - 95% Confidence Interval: [1 1] **Key Finding**: Rainfall and soil pH are the most important predictors of coffee yield. ## Files in This Repository - `coffee_yield_model.rds` – Trained Random Forest model (R format) - `model_importance.csv` – Feature importance scores (open in Excel) - `model_summary.txt` – Model details and performance metrics - `README.md` – This file - `data/` – Synthetic training dataset - `notebooks/` – Complete analysis following Nine Wheels of SML framework - Wheel 1: Problem Formulation - Wheel 2: Data Exploration - Wheel 3: Model Specification - Wheel …