Bias Mirror

See the bias before it sees you.


Inspiration

While working with real-world datasets — hiring records, salary distributions, employee analytics, and even historical datasets like Titanic — I noticed something important:

Bias is rarely obvious. It hides quietly inside data.

Most datasets show disparities across groups (e.g., gender, race, department), but detecting them requires technical expertise. Even selecting a "positive outcome" becomes confusing when outcomes are numeric (like hourly wages) or ordinal (like job involvement ratings 1–4).

This inspired Bias Mirror — a simple, intelligent tool that makes fairness analysis accessible to everyone.


The Problem

Fairness metrics work best when the outcome is binary:

  • Hired / Not Hired
  • Approved / Rejected
  • Survived / Did Not Survive

However, many real-world datasets contain:

  • Continuous variables (e.g., salary, hourly rate)
  • Ordinal scales (e.g., performance ratings 1–5)
  • Multi-class categories (e.g., job roles)

Most existing tools require manual preprocessing, which can lead to arbitrary thresholds and misleading results.

We needed a universal, structured solution.


The Solution

Bias Mirror automatically detects the type of outcome column and intelligently converts it into a meaningful binary decision for fairness analysis.

Universal Outcome Handling

Outcome Type Approach
Binary Outcome Used directly.
Ordinal Numeric (e.g., 1–4 scale) Converted using threshold ranges (e.g., top 50% = positive).
Continuous Numeric (e.g., salary) Converted using: Median threshold, Mean threshold, Percentile-based selection
Multi-Class Categorical User selects which category (or categories) count as positive.

This ensures compatibility with virtually any structured dataset.


Fairness Metrics

Bias Mirror focuses on interpretable, widely used fairness metrics.

Statistical Parity Difference (SPD)

Statistical Parity Difference (SPD) Formula: SPD = P(Y=1 | A=a) - P(Y=1 | A=b) In words: The difference in positive outcome rates between group A and group B.

Example:

If men have a 80% approval rate and women have a 60% approval rate SPD = 0.80 - 0.60 = 0.20 (20 percentage point difference)

SPD measures the difference in positive outcome rates between groups.

2️⃣ Disparate Impact Ratio (DIR)

Formula: DIR = P(Y=1 | A=a) / P(Y=1 | A=b) In words: The ratio of positive outcome rates between groups.

The 80% Rule: If DIR < 0.8, there may be disparate impact Example:

If women have a 60% approval rate and men have an 80% approval rate DIR = 0.60 / 0.80 = 0.75 Since 0.75 < 0.80, this suggests potential disparity Where:

Y = the decision/outcome (hired, approved, etc.) A = the sensitive attribute (gender, race, age, etc.) a, b = different demographic groups


How I Built It

⚙ Backend

  • Python + Pandas for data processing
  • Automatic column type detection
  • Dynamic binary outcome generation

Frontend

  • React / Next.js
  • Tailwind CSS for clean, minimal UI
  • Step-by-step guided workflow

AI Integration

  • LLM-generated plain-language explanations
  • Context-aware fairness interpretation
  • Non-accusatory tone to avoid misleading claims

UI Philosophy

Bias Mirror was designed to be:

  • Minimal
  • Clean
  • Intuitive
  • Non-technical

User Flow:

  1. Upload dataset
  2. Select group column
  3. Select outcome column
  4. Adjust threshold (if needed)
  5. View fairness dashboard

Dashboard Features:

  • Positive outcome rates by group
  • SPD and DIR values
  • Clear visual bar charts
  • AI-generated explanation

No clutter. No unnecessary metrics.


Challenges

1️⃣ Handling Non-Binary Outcomes

Converting continuous and ordinal data into meaningful binary decisions required careful UX design and clear communication.

2️⃣ Avoiding Misinterpretation

Fairness metrics measure disparity — not intent or discrimination. The AI explanations were designed to clearly communicate this distinction.

3️⃣ Balancing Simplicity and Depth

Too many fairness metrics overwhelm users. Too few oversimplify analysis. We focused on clarity and interpretability.


What I Learned

  • Fairness is not just a model problem — it is a data interpretation problem.
  • Threshold selection significantly affects fairness conclusions.
  • Clear explanation builds trust in AI systems.
  • Disparity detection is the first step toward responsible AI.

Impact

Bias Mirror empowers:

  • Students
  • HR teams
  • Data analysts
  • Researchers
  • Hackathon participants

to detect potential disparities quickly and transparently.

Instead of writing custom fairness code, users can upload data and instantly see insights.


Future Scope

  • Regression fairness metrics
  • Multi-group intersectional analysis
  • Time-series bias tracking
  • Auto-generated downloadable fairness reports

Final Thought

Data influences decisions. Decisions influence lives.

Bias Mirror ensures we examine our data — before it shapes the world unfairly.

Built With

Share this project:

Updates