An end-to-end unsupervised ML pipeline (K-Means + PCA) for partitioning Ethiopian soil telemetry into management zones with an integrated prescriptive agronomic advisory engine.
# 🌾 EthioSoil ML: Unsupervised Soil Clustering & Prescriptive Advisory System
An end-to-end unsupervised machine learning pipeline that ingests multi-variate soil telemetry data, partitions fields into dynamic management zones, and layers an automated rule engine to output localized land-remediation blueprints.
---
## 🚀 Core Features
* **Scale-Agnostic Preprocessing:** Handles severe numeric scale disparities (e.g., narrow pH shifts vs. thousands of ppm of Nitrogen) using $Z$-score standardization.
* **Dual-Partition Clustering:** Configures K-Means ($K=2$) to naturally isolate stable, functional agricultural matrices from heavily degraded anomaly zones.
* **Dimensionality Reduction & Interpretability:** Compresses 5D space into a 2D projection via Principal Component Analysis (PCA) to expose a clean "Soil Stress Vector" boundary at $PC_1 = 0$.
* **Hybrid Post-Clustering Evaluation:** Features a dynamic evaluation matrix that weights nutrient Z-scores against a non-linear, raw absolute deviation penalty for soil pH.
* **Prescriptive Rule Engine:** Bypasses abstract numerical labels to generate actionable, real-world text remediation guides (e.g., lime requirements, freshwater field leaching, and catch-cropping mandates).
---
## 📊 Dataset Profile
The underlying dataset consists of **908,867 unique agricultural rows** monitoring 5 critical agronomic telemetry features.
### Descriptive Statistical Distribution
| Feature | Count | Mean | Std | Min | 50% (Median) | Max |
| :--- | :---: | :---: | :---: | :---: | :---: | :---: |
| **Nitrogen** | 908,867 | 1,363.91 | 988.11 | 0.54 | 1,091.06 | 19,861.14 |
| **Phosphorus** | 908,867 | 13.01 | 9.39 | 0.0001 | 11.75 | 603.64 |
| **Potassium** | 908,867 | 420.32 | 208.29 | 19.27 | 400.74 | 2,647.79 |
| **pH** | 908,867 | 7.20 | 0.91 | 4.29 | 7.35 | 9.81 |
| **EC (Salinity)** | 908,867 | 332.31 | 607.36 | 0.10 | 140.71 | 16,109.97 |
> 💡 **The Fertilizer Accumulation Paradox:** The model unmasks an important counter-intuit …