Fairness metrics for continuous risk scores
Project description
Fair-Scoring
Fairness metrics for continuous risk scores.
The implemented algorithms are described in the paper [1].
Installation
Install with pip
directly:
pip install git+https://github.com/schufa-innovationlab/fair-scoring.git
To install a specific version, use
pip install git+https://github.com/schufa-innovationlab/fair-scoring.git@0.0.1
where 0.0.1
has to be replaced with any tag or branch.
Usage
The following example shows how compute the equal opportunity bias of the compas dataset
import pandas as pd
from fairscoring.metrics import bias_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 = 11 - df['decile_score']
target = df['two_year_recid']
attribute = df['race']
# Compute the bias
bias = bias_eo(scores, target, attribute, groups=['African-American', 'Caucasian'],favorable_target=0)
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;
Bibtex
@inproceedings{Zern2023Interventional,
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}
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for fair_scoring-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2980347ff4c7b7ffe15e4c6450d7c2374508a4ffce90cfd5138cb095b0d92004 |
|
MD5 | 449572dc969a7561d532fee485d85739 |
|
BLAKE2b-256 | ab7527ddac6542f400f77201161dea91131a9f8ada2ebbe13c3592b192b546cc |