FairLoan: Bias Detection and Mitigation in Loan Approval Inspiration

Loan approvals can define someone’s financial future, but unfortunately, they are often influenced by hidden biases. In real life, certain groups — such as women, racial minorities, or younger applicants — are disproportionately denied access to credit. This unfairness inspired us to build FairLoan, a project that ensures machine learning models don’t just predict outcomes, but do so fairly. Our motivation came from the realization that AI should not repeat historical discrimination but instead help close opportunity gaps.

What it does# FairLoan: Bias Detection and Mitigation in Loan Approval

Inspiration

Loan approvals can define someone’s financial future, but unfortunately, they are often influenced by hidden biases. In real life, certain groups — such as women, racial minorities, or younger applicants — are disproportionately denied access to credit. This unfairness inspired us to build FairLoan, a project that ensures machine learning models don’t just predict outcomes, but do so fairly. Our motivation came from the realization that AI should not repeat historical discrimination but instead help close opportunity gaps.

What it does

FairLoan is an AI-powered fairness framework that predicts whether a loan will be approved, while also:

  • Detecting biases across sensitive groups (e.g., gender, race, age).
  • Using fairness metrics like Demographic Parity, Equal Opportunity, and Disparate Impact.
  • Applying bias mitigation techniques (e.g., Exponentiated Gradient, reweighting).
  • Explaining predictions using SHAP values so stakeholders understand why decisions were made.

In short, it balances accuracy + fairness, making financial decisions ethical, interpretable, and legally compliant.

How we built it

  1. Dataset: Used loan_access_dataset.csv for training and test.csv for evaluation.
  2. Preprocessing:
    • One-hot encoded categorical features.
    • Binned continuous features (e.g., Income, Credit Score).
    • Handled missing values via imputation or “Unknown” categories.
  3. Models Trained:
    • Logistic Regression (baseline, interpretable)
    • Random Forest (best balance of accuracy & fairness)
    • SVM (comparative baseline for high-dimensional data)
    • XGBoost (competitive performance)
  4. Fairness Auditing:
    • Applied Fairlearn and AIF360 for bias detection.
    • Measured approval rate gaps, False Positive Rate (FPR) disparities, and fairness ratios.
  5. Interpretability:
    • Generated SHAP plots to highlight key features (Credit Score, Income, Loan Amount).

Challenges we ran into

  • Balancing accuracy vs fairness: Improving fairness often reduced predictive power.
  • Intersectional bias detection: Bias across multiple sensitive attributes (e.g., young women from minority groups) was harder to analyze.
  • Complex trade-offs: Some bias mitigation techniques improved one metric while worsening another.
  • Data quality issues: Missing values and noisy features required careful handling.

Accomplishments that we're proud of

  • Built a working loan approval ML model that doesn’t just optimize accuracy but also fairness.
  • Successfully applied bias detection and mitigation frameworks to a real-world dataset.
  • Created visual evidence (approval rate plots, error rate breakdowns, SHAP summaries) to make fairness gaps clear.
  • Learned to think like both a data scientist and an ethicist, ensuring our work impacts society positively.

What we learned

  • Fairness ≠ accuracy: A “good” model is not just the most accurate one but also the most equitable.
  • Bias mitigation requires continuous monitoring, not a one-time fix.
  • SHAP and fairness metrics are powerful tools to make AI decisions transparent.
  • Collaboration between technical + social perspectives is crucial in AI ethics.
  • Mathematics of fairness:
    • Disparate Impact Ratio
      [ DI = \frac{P(\hat{Y}=1 \mid A= \text{protected})}{P(\hat{Y}=1 \mid A=\text{unprotected})} ]
      A value below 0.8 indicates potential bias.

What's next for FairLoan: ML Bias Detection & Mitigation in Financial Lending

  • Explore advanced debiasing algorithms like Adversarial Debiasing and Reject Option Classification.
  • Perform deeper intersectional analysis across multiple sensitive features.
  • Collect richer datasets with more applicant context to reduce noise.
  • Develop an explainable AI dashboard for loan officers to visualize fairness metrics in real time.
  • Extend the framework to other high-stakes domains like hiring, healthcare, and insurance.

FairLoan is an AI-powered fairness framework that predicts whether a loan will be approved, while also:

Detecting biases across sensitive groups (e.g., gender, race, age).

Using fairness metrics like Demographic Parity, Equal Opportunity, and Disparate Impact.

Applying bias mitigation techniques (e.g., Exponentiated Gradient, reweighting).

Explaining predictions using SHAP values so stakeholders understand why decisions were made.

In short, it balances accuracy + fairness, making financial decisions ethical, interpretable, and legally compliant.

How we built it

Dataset: Used loan_access_dataset.csv for training and test.csv for evaluation.

Preprocessing:

One-hot encoded categorical features.

Binned continuous features (e.g., Income, Credit Score).

Handled missing values via imputation or “Unknown” categories.

Models Trained:

Logistic Regression (baseline, interpretable)

Random Forest (best balance of accuracy & fairness)

SVM (comparative baseline for high-dimensional data)

XGBoost (competitive performance)

Fairness Auditing:

Applied Fairlearn and AIF360 for bias detection.

Measured approval rate gaps, False Positive Rate (FPR) disparities, and fairness ratios.

Interpretability:

Generated SHAP plots to highlight key features (Credit Score, Income, Loan Amount).

Challenges we ran into

Balancing accuracy vs fairness: Improving fairness often reduced predictive power.

Intersectional bias detection: Bias across multiple sensitive attributes (e.g., young women from minority groups) was harder to analyze.

Complex trade-offs: Some bias mitigation techniques improved one metric while worsening another.

Data quality issues: Missing values and noisy features required careful handling.

Accomplishments that we're proud of

Built a working loan approval ML model that doesn’t just optimize accuracy but also fairness.

Successfully applied bias detection and mitigation frameworks to a real-world dataset.

Created visual evidence (approval rate plots, error rate breakdowns, SHAP summaries) to make fairness gaps clear.

Learned to think like both a data scientist and an ethicist, ensuring our work impacts society positively.

What we learned

Fairness ≠ accuracy: A “good” model is not just the most accurate one but also the most equitable.

Bias mitigation requires continuous monitoring, not a one-time fix.

SHAP and fairness metrics are powerful tools to make AI decisions transparent.

Collaboration between technical + social perspectives is crucial in AI ethics.

Mathematics of fairness:

Disparate Impact Ratio

𝐷

𝐼

𝑃 ( 𝑌

^

1 ∣

𝐴

protected ) 𝑃 ( 𝑌

^

1 ∣

𝐴

unprotected ) DI= P( Y ^ =1∣A=unprotected) P( Y ^ =1∣A=protected) ​

A value below 0.8 indicates potential bias.

What's next for FairLoan: ML Bias Detection & Mitigation in Financial Lending

Explore advanced debiasing algorithms like Adversarial Debiasing and Reject Option Classification.

Perform deeper intersectional analysis across multiple sensitive features.

Collect richer datasets with more applicant context to reduce noise.

Develop an explainable AI dashboard for loan officers to visualize fairness metrics in real time.

Extend the framework to other high-stakes domains like hiring, healthcare, and insurance.

Built With

Share this project:

Updates