Fairnes checker
Project description
Fairness Checker
This Python module fairness_checker provides a set of methods to evaluate the fairness of a predictive model's outcomes across different demographic groups represented in a CSV file or given a model.
Dependencies
- Python >= 3.6
Installation
pip3 install fairness-checker
Usage
For example:
from fairness_checker import fairness_csv_checker
c = fairness_csv_checker("compas-scores-two-years.csv")
c.demographic_parity(0.2, lambda row: row['sex'] == 'Male', lambda row: row['score_text'] in {'Medium', 'High'})
Output:
demographic parity
fair: 0.04 < 0.2
Note the function signature of demographic_parity
:
demographic_parity(ratio: float,
privileged_predicate: Callable[[csv_row], bool],
positive_predicate: Callable[[T], bool]) -> bool:
Here the privileged_predicate
is
lambda row: row['sex'] == 'Male'
meaning the privileged group is the male group, and the positive_predicate
is
lambda row: row['score_text'] in {'Medium', 'High'}
meaning the row is positive if the score is categorized as medium or high.
Project details
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
Close
Hashes for fairness_checker-0.0.41-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a370ebe75a9d7474195c569487e6e187e8db65f1ce9549b6070ba85c5f28876a |
|
MD5 | f648579877be49f34d5ef46fb8272a20 |
|
BLAKE2b-256 | ae4b698669db171990d80c09ca591f827b9bf42fdcf3ecc448dbb878e44bb9fb |