{"id":13738387,"url":"https://github.com/synthesized-io/fairlens","last_synced_at":"2025-06-24T14:02:48.224Z","repository":{"id":38208160,"uuid":"352935315","full_name":"synthesized-io/fairlens","owner":"synthesized-io","description":"Identify bias and measure fairness of your data","archived":false,"fork":false,"pushed_at":"2025-06-23T16:29:08.000Z","size":6435,"stargazers_count":92,"open_issues_count":18,"forks_count":10,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-06-23T17:35:01.269Z","etag":null,"topics":["bias","data","data-analysis","data-science","fairness","ml","pandas","python","statistics"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/synthesized-io.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-03-30T08:58:36.000Z","updated_at":"2025-06-23T09:45:54.000Z","dependencies_parsed_at":"2023-10-17T01:59:50.842Z","dependency_job_id":"2bf8abfe-29a1-42ef-9071-5583cb4a2c33","html_url":"https://github.com/synthesized-io/fairlens","commit_stats":{"total_commits":114,"total_committers":10,"mean_commits":11.4,"dds":0.6842105263157895,"last_synced_commit":"6b864ecdb96446397d3f761fcdc3dbbfc008f03b"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/synthesized-io/fairlens","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/synthesized-io%2Ffairlens","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/synthesized-io%2Ffairlens/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/synthesized-io%2Ffairlens/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/synthesized-io%2Ffairlens/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/synthesized-io","download_url":"https://codeload.github.com/synthesized-io/fairlens/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/synthesized-io%2Ffairlens/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261525985,"owners_count":23172533,"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","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":["bias","data","data-analysis","data-science","fairness","ml","pandas","python","statistics"],"created_at":"2024-08-03T03:02:20.854Z","updated_at":"2025-06-24T14:02:48.170Z","avatar_url":"https://github.com/synthesized-io.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"\u003cimg width=60% src=\"https://raw.githubusercontent.com/synthesized-io/fairlens/main/docs/_static/FairLens_759x196.png\"\u003e\n\n[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)][sdk_colab_url]\n[![Documentation Status](https://readthedocs.org/projects/fairlens/badge/?version=latest)][documentation_url]\n[![CI](https://github.com/synthesized-io/fairlens/actions/workflows/ci.yml/badge.svg?branch=main\u0026event=push)](https://github.com/synthesized-io/fairlens/actions/workflows/ci.yml)\n[![PyPI](https://img.shields.io/pypi/v/fairlens)](https://pypi.org/project/fairlens/)\n[![PyPI - Downloads](https://img.shields.io/pypi/dw/fairlens)](https://pypi.org/project/fairlens)\n[![Python version](https://img.shields.io/badge/python-3.6%20%7C%203.7%20%7C%203.8%20%7C%203.9-blue.svg)](https://pypi.org/project/fairlens/)\n[![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=synthesized-io_fairlens\u0026metric=sqale_rating\u0026token=4df8d79db869c4f81a2225da446ca06d3b83d4be)](https://sonarcloud.io/dashboard?id=synthesized-io_fairlens)\n[![codecov](https://codecov.io/gh/synthesized-io/fairlens/branch/main/graph/badge.svg?token=0EWTY95MU0)](https://codecov.io/gh/synthesized-io/fairlens)\n![GitHub Repo stars](https://img.shields.io/github/stars/synthesized-io/fairlens?style=social)\n\n# FairLens\n\nFairLens is an open source Python library for automatically discovering bias and measuring fairness in data. The package can be used to quickly identify bias, and provides multiple metrics to measure fairness across a range of sensitive and legally protected characteristics such as age, race and sex.\n\n\n## Bias in my data?\nIt's very simple to quickly start understanding any biases that may be present in your data.\n\n\u003cimg width=\"50%\" align=\"right\" src=\"https://user-images.githubusercontent.com/13236749/128219642-baeb8577-11cc-4e5a-8a40-0065eb14037a.png\"\u003e\n\n\n```python\nimport pandas as pd\nimport fairlens as fl\n\n# Load in the data\ndf = pd.read_csv(\"datasets/compas.csv\")\n\n# Automatically generate a report\nfscorer = fl.FairnessScorer(\n    df,\n    target_attribute=\"RawScore\",\n    sensitive_attributes=[\n        \"Sex\",\n        \"Ethnicity\",\n        \"MaritalStatus\"\n    ]\n)\nfscorer.demographic_report()\n```\n```\nSensitive Attributes: ['Ethnicity', 'MaritalStatus', 'Sex']\n\n                         Group Distance  Proportion  Counts   P-Value\nAfrican-American, Single, Male    0.249    0.291011    5902 3.62e-251\n      African-American, Single    0.202    0.369163    7487 1.30e-196\n                       Married    0.301    0.134313    2724 7.37e-193\n        African-American, Male    0.201    0.353138    7162 4.03e-188\n                 Married, Male    0.281    0.108229    2195 9.69e-139\n              African-American    0.156    0.444899    9023 3.25e-133\n                      Divorced    0.321    0.063754    1293 7.51e-112\n            Caucasian, Married    0.351    0.049504    1004 7.73e-106\n                  Single, Male    0.121    0.582910   11822  3.30e-95\n           Caucasian, Divorced    0.341    0.037473     760  1.28e-76\n\nWeighted Mean Statistical Distance: 0.14081832462333957\n```\n\nCheck out the [documentation][documentation_url] to get started, or try out FairLens now in [Google Colab][sdk_colab_url]!\n\nSee some of our previous blog posts for our take on bias and fairness in ML:\n\n- [Legal consensus regarding biases and fairness in machine learning in Europe and the US](https://www.synthesized.io/post/discrimination-by-artificial-intelligence-2)\n- [Fairness and biases in machine learning and their impact on banking and insurance](https://www.synthesized.io/post/fairness-and-biases-in-machine-learning-and-their-impact-on-banking-and-insurance)\n- [Fairness and algorithmic biases in machine learning and recommendations to enterprise](https://www.synthesized.io/post/fairness-and-algorithmic-biases-in-machine-learning-and-recommendations)\n\n## Core Features\n\n- **Bias Measurement** - Metrics and tests to measure the extent and significance of bias in data using statistical distances and metrics. See the [overview](https://fairlens.readthedocs.io/en/stable/user_guide/fairness.html) for more details.\n\n- **Sensitive Attribute and Proxy Detection** - Methods to identify legally protected features, and measure hidden correlations between these features and others.\n\n- **Visualization Tools** - Tools to visualize the distributions of different types of variables or columns in sensitive sub groups.\n\n- **Fairness Assessment** - A streamlined way of assessing the fairness of an arbitrary dataset, and generating reports highlighting biases and hidden correlations.\n\nThe goal of FairLens is to enable data scientists to gain a deeper understanding of their data, and helps to to ensure fair and ethical use of data in analysis and machine learning tasks. The insights gained from FairLens can be harnessed by the [Bias Mitigation](https://www.synthesized.io/post/synthesized-mitigates-bias-in-data) feature of the [Synthesized](https://synthesized.io) platform, which is able to automagically remove bias using the power of synthetic data.\n\n\n## Installation\n\nFairLens can be installed using pip\n```bash\npip install fairlens\n```\n\n## Contributing\n\nFairLens is under active development, and we appreciate community contributions. See [CONTRIBUTING.md](https://github.com/synthesized-io/fairlens/blob/main/.github/CONTRIBUTING.md) for how to get started.\n\nThe repository's current roadmap is maintained as a Github project [here](https://github.com/synthesized-io/fairlens/projects/1).\n\n\n## License\n\nThis project is licensed under the terms of the [BSD 3](https://github.com/synthesized-io/fairlens/blob/main/LICENSE.md) license.\n\n\n[documentation_url]: https://fairlens.readthedocs.io/en/stable/\n[sdk_colab_url]: https://colab.research.google.com/github/synthesized-io/synthesized-notebooks/blob/master/synthesized-sdk.ipynb\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsynthesized-io%2Ffairlens","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsynthesized-io%2Ffairlens","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsynthesized-io%2Ffairlens/lists"}