💡 Inspiration
Over 1.4 billion adults globally—including smallholder rural farmers, street food vendors, and app-based gig workers—are classified as "credit invisible." Because they lack formal credit cards, collateralized bank loans, or salaried tax returns, traditional credit bureaus (such as CIBIL or FICO) automatically reject them. This forces hard-working families toward predatory informal moneylenders charging 60% to 120% APR.
Worse yet, even when financial institutions deploy Machine Learning models, they almost always operate as opaque black boxes:
- They output a cold "Loan Rejected" decision without explaining why to the loan officer or borrower.
- They fail to audit for geographic redlining between rural and urban citizens.
- They offer zero actionable path for a rejected worker to become creditworthy.
I built CrediTrust XAI under Track 3: Human Impact (HI-04 — Alternative Credit Scoring for the Unbanked) to transform alternative credit underwriting from a black-box gatekeeper into a transparent, fair, and empowering financial coach.
🚀 What It Does
CrediTrust XAI is an end-to-end alternative credit underwriting, explainability, and borrower recourse engine built for Microfinance Institutions (MFIs), rural cooperatives, and digital wallets:
- 8 Everyday Alternative Telemetry Signals: Evaluates real-world financial discipline across four pillars: Utility & Telecom Bill Timeliness (%), Prepaid SIM Recharge Gap Days, UPI/Mobile Wallet Inflow Volatility, Essential Spend Ratio, Micro-Savings Retention (%), Cash-Flow Shock Recovery Speed, Verified Livelihood Tenure, and Self-Help Group (SHG) Peer Trust.
- Instant Risk-Adjusted Pricing: Maps ensemble repayment probabilities \( P(y=1 \mid \mathbf{x}) \) into an intuitive 300–850 Alternative Credit Score, fair-cap microfinance APR, 12-month EMI, and safe exposure limit.
- Real-Time Local TreeSHAP Attribution: Explains every individual score in plain human language alongside exact log-odds SHAP feature attributions so loan officers and borrowers immediately see which habits are helping or hurting their score.
- Automated 30-Day Counterfactual Coaching Plan: Rather than leaving high-risk borrowers at a dead end, our counterfactual optimizer calculates the smallest, realistic behavioral adjustments over the next 30 days required to cross the approval threshold and lower their interest rate.
- Batch Village / SHG Portfolio Triage: Enables field officers to upload a CSV cohort and underwrite an entire village Self-Help Group in milliseconds.
- Built-In Algorithmic Fairness Proof: Continuously audits model predictions across Rural vs. Urban cohorts for EEOC 80% Disparate Impact Rule compliance.
🛠️ How I Built It
1. Calibrated 5-Fold Stacking Ensemble
To capture non-linear risk interactions (such as how strong micro-savings retention buffers seasonal gig-income volatility), I engineered a two-layer StackingClassifier combining gradient-boosted decision trees (XGBoost and LightGBM) and RandomForest with a LogisticRegression meta-learner:
$$P(y = 1 \mid \mathbf{x}) = \sigma \left( w_0 + \sum_{m=1}^{M} w_m \cdot f_m(\mathbf{x}) \right)$$
The predicted probability is mapped to our bounded Alternative Credit Score \( S \in [300, 850] \):
$$S(\mathbf{x}) = \text{clip}\Big( \text{round}\big(300 + 550 \cdot P(y=1 \mid \mathbf{x})\big), \, 300, \, 850 \Big)$$
2. Local Explainability via TreeSHAP
For every applicant profile \( \mathbf{x} \), we compute exact Shapley additive explanations across our primary gradient-boosted tree estimator:
$$\phi_i(f, \mathbf{x}) = \sum_{S \subseteq F \setminus {i}} \frac{|S|!(|F| - |S| - 1)!}{|F|!} \left[ f_x(S \cup {i}) - f_x(S) \right]$$
3. Counterfactual Financial Recourse Optimizer
For rejected or borderline applicants, we solve a constrained greedy counterfactual optimization problem over actionable features \( \mathcal{A} \) (excluding immutable time features like historical tenure) within realistic 30-day behavioral bounds \( \mathcal{B}(\mathbf{x}) \):
$$\mathbf{x}^* = \arg\min_{\mathbf{x}' \in \mathcal{B}(\mathbf{x})} |\mathbf{x}' - \mathbf{x}|1 \quad \text{subject to} \quad P(y=1 \mid \mathbf{x}') \ge \tau{\text{approve}}$$
4. Algorithmic Fairness & Demographic Parity Auditing
We verify that the model does not penalize rural borrowers by computing the Disparate Impact Ratio (DIR) and Equal Opportunity Difference (EOD) on our 1,600-profile stratified holdout test set:
$$\text{DIR} = \frac{P(\hat{Y} = 1 \mid D = \text{Rural})}{P(\hat{Y} = 1 \mid D = \text{Urban})} = 1.042 \in [0.80, 1.25] \quad (\text{PASSED})$$
📊 Model Performance Benchmarks
Evaluated on a stratified 20% holdout test set (1,600 unseen profiles out of 8,000 total profiles):
| Model Architecture | Accuracy | ROC-AUC | F1-Score | Precision | Recall | Brier Calibration Loss |
|---|---|---|---|---|---|---|
| Logistic Regression (Baseline) | 84.19% | 0.9182 | 0.8569 | 0.8512 | 0.8627 | 0.1124 |
| Random Forest Classifier | 84.56% | 0.9210 | 0.8611 | 0.8520 | 0.8704 | 0.1098 |
| LightGBM Classifier | 84.88% | 0.9245 | 0.8634 | 0.8588 | 0.8681 | 0.1069 |
| XGBoost (Primary XAI Tree) | 85.12% | 0.9268 | 0.8659 | 0.8605 | 0.8714 | 0.1052 |
| CrediTrust Stacking Ensemble | 85.56% | 0.9294 | 0.8698 | 0.8648 | 0.8749 | 0.1031 |
🚧 Challenges I Faced
- Bridging Data Science Math & Human Usability: Early iterations of the dashboard displayed raw log-odds SHAP outputs and statistical terms like Coefficient of Variation (CV), which felt intimidating to non-technical loan officers and borrowers. I redesigned the UX around real-world personas (Ramesh the Dairy Farmer, Priya the Delivery Partner, Suresh the Street Vendor) and added a natural-language translation layer that turns SHAP vectors into plain-English insights and coaching steps.
- Preventing Unrealistic Counterfactual Suggestions: A naive optimizer might tell a borrower to "increase work tenure by 24 months" in 30 days—which is physically impossible. I constrained the recourse engine to only mutate actionable short-term habits (such as utility bill timeliness, UPI cash deposits, and prepaid SIM recharge continuity) within realistic 30-day step bounds.
- Zero-Cost Cloud Cold Starts: To ensure judges experience instant load times on free community cloud tiers, I engineered a self-healing
@st.cache_resourcepipeline that serializes and caches both the ensemble and TreeSHAP explainer in memory.
📚 What I Learned
- How to combine multi-model ensembling (
StackingClassifier) with fast local tree explainability (TreeSHAP) without sacrificing sub-second web inference latency. - How to operationalize Responsible AI in fintech by embedding quantitative fairness metrics (Disparate Impact Ratio and Equal Opportunity Difference) directly into the deployment pipeline.
- Why human-centered product design is essential in AI for Social Good: an accurate model only creates real-world impact when its decisions are understandable and actionable for the end user.
🔮 What's Next for CrediTrust XAI
- Account Aggregator & Open API Integration: Connecting directly to consent-based digital public infrastructure (such as India's Account Aggregator framework and telecom APIs) for automated one-click telemetry verification.
- Multilingual Voice & WhatsApp Bot: Delivering the 30-Day Counterfactual Coaching Plan via voice notes in regional languages (Hindi, Nepali, Telugu) for low-literacy borrowers.
Built With
- explainable-ai
- joblib
- lightgbm
- machine-learning
- numpy
- pandas
- plotly
- python
- scikit-learn
- scipy
- shap
- streamlit
- xgboost

