{"id":30614662,"url":"https://github.com/redshiftzero/fairness","last_synced_at":"2026-02-12T05:05:40.869Z","repository":{"id":146756342,"uuid":"45223183","full_name":"redshiftzero/fairness","owner":"redshiftzero","description":"Ensuring fairness in algorithms","archived":false,"fork":false,"pushed_at":"2015-12-28T04:35:51.000Z","size":290,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2023-03-24T07:14:49.697Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/redshiftzero.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":"auditing/fairweb.py","citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-10-30T02:06:46.000Z","updated_at":"2023-04-17T01:12:14.181Z","dependencies_parsed_at":"2023-04-17T01:12:14.012Z","dependency_job_id":null,"html_url":"https://github.com/redshiftzero/fairness","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"purl":"pkg:github/redshiftzero/fairness","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redshiftzero%2Ffairness","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redshiftzero%2Ffairness/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redshiftzero%2Ffairness/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redshiftzero%2Ffairness/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/redshiftzero","download_url":"https://codeload.github.com/redshiftzero/fairness/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redshiftzero%2Ffairness/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272821186,"owners_count":24998598,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-30T02:00:09.474Z","response_time":77,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-08-30T07:30:53.930Z","updated_at":"2026-02-12T05:05:40.813Z","avatar_url":"https://github.com/redshiftzero.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Fairness\n\n![Build Status](https://travis-ci.org/redshiftzero/fairness.svg)\n\nAlgorithms are increasingly being used for decision making and risk assessment in a wide range of applications, from criminal justice to housing and employment. While algorithms are sometimes treated as impartial, it is important to evaluate how unbiased these systems really are. \n\nIt is also important to appreciate that discrimination is not necessarily negative. In some cases discrimination is necessary or even desired. Whether each case of discrimination is problematic depends on the situation in question. These metrics also cannot determine if discrimination is intentional or unintentional. \n\n_WARNING:_ This is a work in progress! Stay tuned. \n\n## Metrics\n\nThese are a set of metrics contained in `fairness/metrics.py` that can be used to examine inputs and outputs to evaluate if there is discrimination present with respect to some protected class. \n\n### Disparate Impact\n\nThis metric is based on the legal term \"disparate impact\" and its corresponding 80 percent rule. \n\n### Statistical Parity / Group Fairness\n\nBased on Zemel et al., this metrics characterizes the degree of discrimination between groups, where groups are defined with respect to some protected class. \n\n### Individual Fairness\n\nAlso based on Zemel et al., this metric characterizes the degree to which similar people are characterized similarly [TODO]. \n\n### Fairness in Errors\n\nThis metric measures if the algorithm in question has a higher error rate with respect to the protected class. Unevenly distributed errors are another way that algorithms can be unfair.\n\n## Examples\n\nClone the repo and make sure the requirements (in `requirements.conda`) are satisfied. \n\nYou can then use metrics to test how fair the algorithm's predictions are: \n\n```\nIn [2]: from fairness import metrics\n\nIn [3]: data = pd.read_csv('tests/validation.csv', index_col=0) \n\nIn [4]: protected_status = data['gender'].values\n\nIn [5]: model_outcome = data['prediction'].values\n\nIn [6]: metrics.group_fairness(protected_status, model_outcome)\nOut[6]: 0.0\n```\n\nYou can infer then that this algorithm is then not-discriminatory with respect to gender.\n\n## Auditing\n\nThis is a testing web application contained in `auditing/` enabling simple auditing of model outputs for fairness. \n\nFirst, upload your model outputs in csv format: \n\n![](images/fairness_upload.png)\n\nNext, run the audit and examine each metric. Here is an example for an example model, demonstrating that there may be concerns with respect to the classification of women: \n\n![](images/example_audit_v1.png)\n\n## Tests\n\nUnit tests in `tests` make use of an artificial dataset `tests/validation.csv`. The tests are run with `nosetests -v`. \n\n## References\n\nZemel, Richard S., Wu, Yu, Swersky, Kevin, Pitassi, Toniann and Dwork, Cynthia. \"Learning Fair Representations..\" Paper presented at the meeting of the ICML (3), 2013.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredshiftzero%2Ffairness","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fredshiftzero%2Ffairness","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredshiftzero%2Ffairness/lists"}