← Back to All Projects

Problem & Audience

Problem: Opaque credit scoring models can mask demographic disparities and surface misleading or protected-attribute explanations when local attributions are left unguarded.

Target Audience: Students, ML engineers, and reviewers exploring interpretable tabular risk scoring and algorithmic fairness trade-offs.

Role: Developer & ML Systems Builder

Outcome & Personal Contribution

Built a FastAPI + Scikit-learn + Fairlearn backend paired with a Next.js + TypeScript dashboard comparing Logistic Regression, Baseline Random Forest (73.0% accuracy, 82.5% F1), and Fairlearn mitigation (77.1% ROC-AUC).

  • Trained and compared Logistic Regression, Baseline Random Forest, and Fairlearn sample-reweighted mitigation models on the UCI German Credit dataset.
  • Implemented semantically guarded tree-path explainability that excludes protected attributes and suppresses polarity conflicts before rendering attributions.
  • Built the Next.js + TypeScript prediction, model performance, and fairness audit interface with SQLite evaluation history logging.

Architecture & Data Flow

Structured applicant features enter a FastAPI inference service that scores risk across baseline and Fairlearn-mitigated models, filters tree-path attributions for protected attributes and polarity conflicts, and reports group fairness metrics.

Applicant InputsUCI German Credit schema

Validates numeric and categorical applicant attributes (duration, credit amount, savings, installment rate, employment, age) via FastAPI.

  1. 1. Applicant Inputs (UCI German Credit): Validates numeric and categorical applicant attributes (duration, credit amount, savings, installment rate, employment, age) via FastAPI. [UCI German Credit schema]
  2. 2. Risk Scoring (RF + Fairlearn): Evaluates default probability across Baseline Random Forest (73.0% acc / 82.5% F1) and Fairlearn reweighted mitigation (77.1% ROC-AUC). [73.0% Acc · 77.1% ROC-AUC]
  3. 3. Feature Contributions (Guarded XAI): Extracts local feature contributions while skipping EXCLUDED_EXPLANATION_FEATURES and suppressing polarity-conflicting attributions. [Protected attributes omitted]
  4. 4. Fairness Audit (Group Metrics + SQLite): Measures demographic parity difference, disparate impact, and equal opportunity difference across groups and logs history in SQLite. [Parity · Disparate Impact · Equal Opp.]

Engineering Decisions & Trade-Offs

Semantically Guarded Local Explanations

Decision: Excluded protected attributes from explanation outputs and suppressed attributions whose sign conflicted with domain monotonicity.

Trade-off: Produces more consistent, policy-aligned explanations for users, at the cost of hiding raw noisy splits that occasionally occur in small tabular trees.

Fairlearn Reweighting Comparison View

Decision: Exposed both Baseline Random Forest and Fairlearn sample-reweighted models side by side rather than hiding the accuracy-vs-fairness shift.

Trade-off: Requires clear educational labeling of metrics, helping reviewers see the trade-off between parity metrics and ROC-AUC.

Testing & Verification Evidence

  • Live deployment hosted at mhsatgit.github.io/fairscore/ with Dashboard, Credit Prediction, Model Performance, and Fairness Audit views.
  • Recorded 73.0% accuracy and 82.5% F1 on Baseline Random Forest and 77.1% ROC-AUC with Fairlearn sample-reweighted mitigation on UCI German Credit.

Known Limitations & Scope

  • Educational demonstration trained on the historical 1,000-row UCI German Credit dataset; not calibrated or approved for real lending decisions.
  • The browser Lab simulator models the published teaching formula and illustrative feature contributions locally without calling the Python backend.
PythonFastAPIScikit-learnFairlearnNext.jsTypeScriptSQLite
See milestone in Journey →

Captured Application Interfaces

FairScore live web application dashboard showing UCI German Credit Dataset metrics, Random Forest 73.0% accuracy, 82.5% F1 score, and fairness status
FairScore Overview Dashboard showing UCI German Credit metrics and model summary.
FairScore live Fairness Audit view showing Gender Fairness selection rates, demographic parity difference, disparate impact, and equal opportunity difference
Fairness Audit comparing selection rates, demographic parity difference, disparate impact, and equal opportunity.
FairScore credit prediction form and guarded local explanation breakdown
Individual credit risk prediction with guarded local feature contributions.
FairScore model performance comparison across Logistic Regression, Random Forest, and Fairlearn mitigation
Model comparison across Logistic Regression, Baseline Random Forest, and Fairlearn mitigation.