Logo Lanfrica

TechieBbt/crop-yield-linear-regression

Domain:

agriculture

Record type:

project
Creator:
Tec
Host:
This project applies simple linear regression to Maji Ndogo agricultural survey data, systematically testing whether temperature or pollution level predicts standardised crop yield, and rigorously evaluating model assumptions through residual analysis. # πŸ“ˆ Crop Yield Prediction β€” Linear Regression Analysis **Author:** Oluwatobi Victoria Babalola | MSc Data Science **Portfolio:** bbt-portfolio.vercel.app | **LinkedIn:** oluwatobi-babalola-victoria --- ## πŸ“Œ Project Summary Can we predict crop yield from a single environmental factor? This project applies **simple linear regression** to Maji Ndogo agricultural survey data, systematically testing whether temperature or pollution level predicts standardised crop yield β€” and rigorously evaluating model assumptions through residual analysis. --- ## 🎯 Objectives - Test whether `Ave_temps` and `Pollution_level` have a linear relationship with `Standard_yield` - Quantify relationships using Pearson correlation across all numeric features - Fit and evaluate simple linear regression models using Scikit-learn - Apply 80/20 train-test split for honest generalisation testing - Diagnose model fit through residual histogram, scatter, and actual vs predicted plots - Identify which crop types are most sensitive to pollution using per-crop regression loops --- ## πŸ—ƒοΈ Dataset Agricultural field survey data from Maji Ndogo, loaded from an SQLite database using the `FieldDataProcessor` pipeline module. **Target variable:** `Standard_yield` β€” standardised yield normalised per crop type **Features tested:** | Feature | Description | |---------|-------------| | `Ave_temps` | Average temperature (Β°C) | | `Pollution_level` | Pollution level (0 = clean, 1 = highly polluted) | | `Soil_fertility` | Fertility index (0–1) | | `Rainfall` | Annual rainfall (mm) | | `Elevation` | Field elevation (metres) | --- ## πŸ› οΈ Tools & Technologies | Tool | Purpose | |------|---------| | Python 3.10 | Core language | | Pandas | Data manipulation | | NumPy | Numerical computation | | Scikit-learn | Linear regression, train-test split, metrics | | SciPy | Pearson correlation | | Matplotlib / Seaborn | Visualisation | | SQLAlchemy | Database connection | --- ## πŸ“ Repository Structure ``` crop-yie …

Languages