Fair-Scoring
Fairness metrics for continuous risk scores.
The implemented algorithms are described in the paper [1].
Project Links
Documentation | PyPI | Paper
Quickstart
Installation
Install with pip directly:
pip install fair-scoring
Example Usage
The following example shows how compute the equal opportunity bias of the compas dataset
import pandas as pd
from fairscoring.metrics import bias_metric_eo
# Load compas data
dataURL = 'https://raw.githubusercontent.com/propublica/compas-analysis/master/compas-scores-two-years.csv'
df = pd.read_csv(dataURL)
# Relevant data
scores = df['decile_score']
target = df['two_year_recid']
attribute = df['race']
# Compute the bias
bias = bias_metric_eo(scores, target, attribute, groups=['African-American', 'Caucasian'], favorable_target=0,
prefer_high_scores=False)
Further examples
Further examples - especially the experiments conducted for the publication - can be found in the documentation.
Development
Setup
Clone the repository and install from this source via
pip install -e .[dev]
Tests
To execute the tests install the package in development mode (see above)
pytest
Following the pytest framework, tests for each package are located in a subpackages named test
Docs
To build the docs move to the ./docs subfolder and call
make clean
make html
References
[1] Becker, A.-K. and Dumitrasc, O. and Broelemann, K.; Standardized Interpretable Fairness Measures for Continuous Risk Scores; Proceedings of the 41th International Conference on Machine Learning, 2024; pdf
Bibtex
@inproceedings{Becker2024FairScoring,
author = {Ann{-}Kristin Becker and Oana Dumitrasc and Klaus Broelemann}
title = {Standardized Interpretable Fairness Measures for Continuous Risk Scores},
booktitle={Proceedings of the 41th International Conference on Machine Learning},
year = {2024}
}
Metadata
Release files for fair-scoring 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| fair_scoring-0.2.1.tar.gz | 395.9 kB | Without provenance | Details for fair_scoring-0.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| fair_scoring-0.2.1-py3-none-any.whl | Python 3 | none | any | Details for fair_scoring-0.2.1-py3-none-any.whl |
Total release size: 425.2 kB
Release files / fair_scoring-0.2.1.tar.gz
| Download URL | fair_scoring-0.2.1.tar.gz |
|---|---|
| Size | 395.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cb376dace0a8088cb4421aa07efc6bcd11d07ef7474f8a75859845c2354e6c0e
|
|
BLAKE2b-256 checksum How to use checksums |
5402fee499beea47a6fb5f98a10b5d9032d52ebbe94fd45629042b65d1dc01c7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.10.14
|
Release files / fair_scoring-0.2.1-py3-none-any.whl
| Download URL | fair_scoring-0.2.1-py3-none-any.whl |
|---|---|
| Size | 29.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4016ae42f7e8064f171c85a892f82b6ae0db9a38f02bb9e124ce21cbe5888e3d
|
|
BLAKE2b-256 checksum How to use checksums |
2b1f9d76773f994e7da0cd1d1abcae5a2b763ca9c725599b3a056393b810a559
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.10.14
|
Security for fair-scoring 0.2.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.