Skip to content
This repository has been archived by the owner on Dec 16, 2022. It is now read-only.

Fairness Metrics #5093

Merged
merged 24 commits into from
Apr 20, 2021
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
e552116
Added three definitions of fairness
Apr 2, 2021
99a2140
Updated CHANGELOG
Apr 2, 2021
37373c8
Added DemographicParityWithoutGroundTruth and finished tests
Apr 8, 2021
e9275d4
Merge branch 'main' into arjuns/fairness-metrics
AkshitaB Apr 8, 2021
c62d45f
finished refactoring Independence, Separation, and Sufficiency to acc…
Apr 11, 2021
6f857c4
added distributed functionality to Independence, Sufficiency, and Sep…
Apr 11, 2021
55dc79e
Finished aggregate and distributed functionality for DemographicParit…
Apr 12, 2021
22825a6
fixed GPU and doc issues
Apr 12, 2021
728068c
fixed GPU and doc issues
Apr 12, 2021
bc74e6d
fixed GPU and doc issues
Apr 12, 2021
261889b
fixed GPU issues
Apr 12, 2021
6e9422d
fixed GPU issues
Apr 12, 2021
8e921f4
added init file
Apr 14, 2021
29416ae
Merge branch 'main' into arjuns/fairness-metrics
AkshitaB Apr 14, 2021
35aa2eb
fixed typo
Apr 14, 2021
7fa5945
Merge branch 'arjuns/fairness-metrics' of https://github.com/allenai/…
Apr 14, 2021
27d78e9
minor docstring changes
Apr 14, 2021
80b3dc5
minor changes to docstring
Apr 15, 2021
6eb212a
Added simple explanations of fairness metrics to docstrings
Apr 15, 2021
f015422
Further vectorized all metric implementations
Apr 16, 2021
63b5803
Fixed device issue
Apr 16, 2021
102a9dc
Merge branch 'main' into arjuns/fairness-metrics
dirkgr Apr 19, 2021
c7c5a59
Merge branch 'main' into arjuns/fairness-metrics
AkshitaB Apr 20, 2021
9e32b39
Merge branch 'main' into arjuns/fairness-metrics
AkshitaB Apr 20, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

- Ported the following Huggingface `LambdaLR`-based schedulers: `ConstantLearningRateScheduler`, `ConstantWithWarmupLearningRateScheduler`, `CosineWithWarmupLearningRateScheduler`, `CosineHardRestartsWithWarmupLearningRateScheduler`.
- Created the fairness module and added four fairness metrics: `Independence`, `Separation`, `Sufficiency`, and `DemographicParityWithoutGroundTruth`.
- Added new `sub_token_mode` parameter to `pretrained_transformer_mismatched_embedder` class to support first sub-token embedding
- Added a way to run a multi task model with a dataset reader as part of `allennlp predict`.
- Added new `eval_mode` in `PretrainedTransformerEmbedder`. If it is set to `True`, the transformer is _always_ run in evaluation mode, which, e.g., disables dropout and does not update batch normalization statistics.
Expand Down
8 changes: 7 additions & 1 deletion allennlp/common/testing/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,13 @@ def assert_metrics_values(
atol: float = 1e-05,
):
for key in metrics:
assert_allclose(metrics[key], desired_values[key], rtol=rtol, atol=atol)
if isinstance(metrics[key], Dict) and isinstance(desired_values[key], Dict):
for subkey in metrics[key]:
assert_allclose(
metrics[key][subkey], desired_values[key][subkey], rtol=rtol, atol=atol
)
else:
assert_allclose(metrics[key], desired_values[key], rtol=rtol, atol=atol)


def global_distributed_metric(
Expand Down
14 changes: 14 additions & 0 deletions allennlp/fairness/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
"""
This module contains tools to:

1. measure the fairness of models according to multiple definitions of fairness
2. measure bias amplification
3. debias embeddings during training time and post-processing
"""

from allennlp.fairness.fairness_metrics import (
Independence,
Separation,
Sufficiency,
DemographicParityWithoutGroundTruth,
)
Loading