Science Score: 67.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 1 DOI reference(s) in README -
✓Academic publication links
Links to: acm.org -
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (14.9%) to scientific vocabulary
Keywords
Repository
A fairness library in PyTorch.
Basic Info
- Host: GitHub
- Owner: aida-ugent
- License: mit
- Language: Python
- Default Branch: main
- Homepage: https://aida-ugent.github.io/fairret/
- Size: 447 KB
Statistics
- Stars: 30
- Watchers: 2
- Forks: 1
- Open Issues: 1
- Releases: 3
Topics
Metadata Files
README.md
fairret - a fairness library in PyTorch
The goal of fairret is to serve as an open-source library for measuring and pursuing statistical fairness in PyTorch models.
The library is designed to be 1. flexible in how fairness is defined and pursued. 2. easy to integrate into existing PyTorch pipelines. 3. clear in what its tools can and cannot do.
Central to the library is the paradigm of the fairness regularization term (fairrets) that quantify unfairness as differentiable PyTorch loss functions.
These can be minimized jointly with other losses, like the binary cross-entropy error, by just adding them together!
Quickstart
It suffices to simply choose a statistic that should be equalized across groups and a fairret that quantifies the gap.
The model can then be trained as follows:
```python import torch.nn.functional as F from fairret.statistic import PositiveRate from fairret.loss import NormLoss
statistic = PositiveRate() norm_fairret = NormLoss(statistic)
def train(model, optimizer, trainloader): for feat, sens, target in trainloader: optimizer.zero_grad()
logit = model(feat)
bce_loss = F.binary_cross_entropy_with_logits(logit, target)
fairret_loss = norm_fairret(logit, sens)
loss = bce_loss + fairret_loss
loss.backward()
optimizer.step()
```
No special data structure is required for the sensitive features. If the training batch contains $N$ elements, then sens should be a tensor of floats with shape $(N, ds)$, with $ds$ the number of sensitive features. Like any categorical feature, it is expected that categorical sensitive features are one-hot encoded.
A notebook with a full example pipeline is provided here: Simple Pipeline.ipynb.
We also host documentation.
Installation
The fairret library can be installed via PyPi:
pip install fairret
A minimal list of dependencies is provided in pyproject.toml.
If the library is installed locally, the required packages can be installed via pip install .
Warning: AI fairness != fairness
There are many ways in which technical approaches to AI fairness, such as this library, are simplistic and limited in actually achieving fairness in real-world decision processes.
More information on these limitations can be found here or here.
Future plans
The library maintains a core focus on only fairrets for now, yet we plan to add more fairness tools that align with the design principles in the future. These may involve breaking changes. At the same time, we'll keep reviewing the role of this library within the wider ecosystem of fairness toolkits.
Want to help? Please don't hesitate to open an issue, draft a pull request, or shoot an email to maarten.buyl@ugent.be.
Citation
This framework will be presented as a paper at ICLR 2024. If you found this library useful in your work, please consider citing it as follows:
bibtex
@inproceedings{buyl2024fairret,
title={fairret: a Framework for Differentiable Fairness Regularization Terms},
author={Buyl, Maarten and Defrance, Marybeth and De Bie, Tijl},
booktitle={International Conference on Learning Representations},
year={2024}
}
Owner
- Name: Ghent University Artificial Intelligence & Data Analytics Group
- Login: aida-ugent
- Kind: organization
- Email: tijl.debie@ugent.be
- Location: Ghent
- Website: aida.ugent.be
- Repositories: 36
- Profile: https://github.com/aida-ugent
Citation (CITATION.cff)
cff-version: 1.0.2
message: "If you use our framework, please cite it as below."
authors:
- family-names: "Buyl"
given-names: "Maarten"
orcid: "https://orcid.org/0000-0002-5434-2386"
- family-names: "Defrance"
given-names: "MaryBeth"
orcid: "https://orcid.org/0000-0002-6570-8857"
- family-names: "De Bie"
given-names: "Tijl"
title: "fairret"
url: "https://openreview.net/pdf?id=NnyD0Rjx2B"
preferred-citation:
type: conference-paper
authors:
- family-names: "Buyl"
given-names: "Maarten"
- family-names: "Defrance"
given-names: "MaryBeth"
- family-names: "De Bie"
given-names: "Tijl"
title: "fairret: a Framework for Differentiable Fairness Regularization Terms"
year: 2024
collection-title: "International Conference on Learning Representations"
GitHub Events
Total
- Watch event: 3
Last Year
- Watch event: 3
Committers
Last synced: about 1 year ago
Top Committers
| Name | Commits | |
|---|---|---|
| Maarten Buyl | m****l@u****e | 54 |
| midfranc | m****e@u****e | 10 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 1
- Total pull requests: 1
- Average time to close issues: 5 months
- Average time to close pull requests: N/A
- Total issue authors: 1
- Total pull request authors: 1
- Average comments per issue: 1.0
- Average comments per pull request: 5.0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 1
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 1
- Average comments per issue: 0
- Average comments per pull request: 5.0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- Dashuto22 (1)
Pull Request Authors
- makoeppel (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 38 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 4
- Total maintainers: 1
pypi.org: fairret
A fairness library in PyTorch.
- Documentation: https://fairret.readthedocs.io/
- License: MIT License Copyright (c) 2024 Ghent University Artificial Intelligence & Data Analytics Group Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
Latest release: 0.1.3
published almost 2 years ago
Rankings
Maintainers (1)
Dependencies
- cvxpy *
- numpy *
- torch *
- torchmetrics *
- actions/checkout v4 composite
- actions/download-artifact v3 composite
- actions/setup-python v4 composite
- actions/upload-artifact v3 composite
- pypa/gh-action-pypi-publish release/v1 composite
- sphinx-notes/pages v3 composite
- torchmetrics *
