PMGSY Infrastructure Classification & GenAI Explanation Agent
End-to-end Machine Learning pipeline classifying rural road projects using Random Forest and natural language explanations with IBM Granite 4 on watsonx.ai.
Interactive Client-Side Demonstration • Features sample road infrastructure records and pre-trained classification demonstration.
What real-world challenge does this system address?
System Design & Approach
- 300-Tree Balanced Random Forest: Robust against heavy class imbalance across rural scheme records.
- Comprehensive Feature Engineering: Automated handling of missing geographic values, numeric coercion, and cost-per-km ratio features.
- GenAI Policy Explanations: Invokes IBM Granite 4 Small on watsonx.ai to output concise textual rationale for why a project aligns with PMGSY-I, II, III, or special packages.
- Interactive Confusion Matrix & Metrics Dashboard: Visualizes precision, recall, and state-by-state classification distributions.
System Architecture & Dataflow
Raw CSV (2,189 rows) -> Preprocessing & Feature Engineering -> 300-Tree Random Forest Classifier -> watsonx.ai Granite 4 LLM -> Flask Web Dashboard
Cleans state identifiers, handles NaNs, computes road length/cost ratios, and applies StandardScaler.
Predicts the scheme category across 5 target classes (PMGSY-I, II, III, RCPLWEA, PM-JANMAN).
Synthesizes contextual rationale connecting feature attributes to federal scheme eligibility criteria.
Renders class confidence distributions, confusion matrix heatmaps, and audit reports.
Stack Specification & Components
Python 3.11
Flask Backend with Scikit-learn Pipeline
PMGSY_DATASET.csv (2,189 verified infrastructure records)
Flask WSGI / Web Showcase
PMGSY Random Forest & Granite 4 Explanation Demo
Evaluates road attributes across 32 state weights & generates synthetic rationale
“High cost-per-km ratio and interstate connectivity characteristics indicate consolidation under PMGSY-III guidelines. Evaluated across Madhya Pradesh rural infrastructure parameters.”
Engineering Decisions
Key design choices, constraints, and solutions formulated during development
Random Forest with Class Balancing vs. Deep Neural Net
Selected a 300-tree Random Forest with balanced class weights rather than an artificial neural network.
Tabular data with categorical state variables and skewed class distributions performs better and avoids overfitting on tabular datasets under 5,000 samples, while offering intrinsic feature importance rankings.
Dual-Layer Classification + Explanation Architecture
Used classical ML for deterministic label prediction and an LLM strictly for explanation synthesis.
Ensures the core classification remains verifiable and statistically grounded while harnessing LLM fluency without risking hallucinations on numerical thresholds.