Predicting water pump status in Tanzania (functional / needs repair / non-functional) for the DrivenData Pump It Up competition. Random Forest → Stacking Ensemble pipeline with feature engineering, class imbalance strategies, and an AI-powered EDA agent built with LangGraph + LangChain.
# Machine Learning Pipeline for Water Infrastructure Prediction and Agentic Exploratory Data Analysis using AI
A full predictive maintenance pipeline for ~59,000 water pumps in Tanzania (DrivenData's "Pump It Up" competition), combining classic ML (Random Forest, Extra Trees, Gradient Boosting, Stacking Ensembles) with four dedicated strategies for detecting the most operationally critical class — **pumps that need repair** — and two AI-powered interactive tools: an **agentic EDA assistant** (LangGraph + Claude) and a **conversational "Ask the Project" assistant** that lets non-technical stakeholders query the pipeline's results in natural language.
---
## The Real Problem: Catching Pumps Before They Break Down
Overall accuracy is a misleading metric here. With three classes — `functional` (54.3%), `non functional` (38.4%) and `functional needs repair` (7.3%) — a model can achieve high accuracy by nearly ignoring the minority class entirely. But that minority class is the most operationally valuable one.
**`functional needs repair` pumps are the only ones that can still be saved with a timely intervention.** A pump already labelled `non functional` requires far more expensive remediation or full replacement. Missing a pump that needs repair means it will eventually fail completely — affecting community water access and driving up maintenance costs.
The four standard base models only detect between 27% and 31% of `functional needs repair` pumps. That means roughly **7 out of every 10 repairable pumps go undetected**, are classified as functional, and receive no maintenance. This is the problem the full modelling strategy is designed to fix.
---
## The Pipeline in Three Notebooks
The project is structured as a three-stage pipeline. Each notebook is self-contained, GitHub-renderable, and hands off its outputs to the next through the `00_artifacts/` folder:
```
┌──────────────────────────┐ ┌──────────────────────────┐ ┌──────────────────────────┐
│ 01 …