ExFairness.Detection.DisparateImpact (ExFairness v0.5.1)
View SourceDisparate Impact detection using the 80% rule (4/5ths rule).
The 80% rule is a legal guideline from the EEOC (Equal Employment Opportunity Commission) used to determine if there is adverse impact in employment decisions.
The 80% Rule
A selection rate for any group that is less than 80% (4/5ths) of the rate for the group with the highest selection rate is generally regarded as evidence of adverse impact.
Ratio = (Selection Rate for Group with Lower Rate) / (Selection Rate for Group with Higher Rate)If Ratio ≥ 0.8, the process passes the 80% rule. If Ratio < 0.8, there may be disparate impact.
Legal Context
This is a legal standard, not just a statistical measure. It's used in:
- Employment discrimination cases (hiring, promotion, termination)
- Lending decisions
- Educational admissions
- Housing decisions
Limitations
- The 80% rule is a guideline, not an absolute legal requirement
- Statistical significance should also be considered
- Small sample sizes may produce unreliable ratios
- Does not prove discrimination, only suggests further investigation
References
- EEOC Uniform Guidelines on Employee Selection Procedures (1978)
- https://www.eeoc.gov/laws/guidance/questions-and-answers-clarify-and-provide-common-interpretation-uniform-guidelines
Examples
iex> predictions = Nx.tensor([1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0])
iex> sensitive = Nx.tensor([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])
iex> result = ExFairness.Detection.DisparateImpact.detect(predictions, sensitive)
iex> result.passes_80_percent_rule
true
Summary
Functions
Detects disparate impact using the 80% rule.
Types
Functions
@spec detect(Nx.Tensor.t(), Nx.Tensor.t(), keyword()) :: result()
Detects disparate impact using the 80% rule.
Parameters
predictions- Binary predictions tensor (0 or 1)sensitive_attr- Binary sensitive attribute tensor (0 or 1)opts- Options::min_per_group- Minimum samples per group for validation (default: 10)
Returns
A map containing:
:group_a_rate- Selection rate for group A:group_b_rate- Selection rate for group B:ratio- Disparate impact ratio (min rate / max rate):passes_80_percent_rule- Whether ratio ≥ 0.8:interpretation- Plain language explanation
Examples
iex> predictions = Nx.tensor([1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0])
iex> sensitive = Nx.tensor([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])
iex> result = ExFairness.Detection.DisparateImpact.detect(predictions, sensitive)
iex> result.passes_80_percent_rule
false