Skip to main content

The Word Embedding Fairness Evaluation Framework

Project description

ReadTheDocs CircleCI Conda CondaLatestRelease CondaVersion

WEFE: The Word Embedding Fairness Evaluation Framework

Word Embedding Fairness Evaluation (WEFE) is an open source library for measuring bias in word embedding models. It generalizes many existing fairness metrics into a unified framework and provides a standard interface for:

  • Encapsulating existing fairness metrics from previous work and designing new ones.

  • Encapsulating the test words used by fairness metrics into standard objects called queries.

  • Computing a fairness metric on a given pre-trained word embedding model using user-given queries.

It also provides more advanced features for:

  • Running several queries on multiple embedding models and return a DataFrame with the results.

  • Plotting those results on a barplot.

  • Based on the above results, calculating a bias ranking for all embedding models. This allows the user to evaluate the fairness of the embedding models according to the bias criterion (defined by the query) and the metric used.

  • Plotting the ranking on a barplot.

  • Correlating the rankings. This allows the user to see how the rankings of the different metrics or evaluation criteria are correlated with respect to the bias presented by the models.

The official documentation can be found at this link.

Installation

There are two different ways to install WEFE:

To install the package with pip

pip install wefe
  • With conda:

To install the package with conda:

conda install -c pbadilla wefe

Requirements

These package will be installed along with the package, in case these have not already been installed:

  1. numpy

  2. scikit-learn

  3. scipy

  4. pandas

  5. gensim

  6. plotly

Contributing

You can download the code executing

git clone https://github.com/dccuchile/wefe

To contribute, visit the Contributing section in the documentation.

Testing

All unit tests are in the wefe/test folder. It uses pytest as a framework to run them. You can run all tests, first install pytest and pytest-cov:

pip install -U pytest
pip install pytest-cov

To run the test, execute:

pytest wefe

To check the coverage, run:

py.test wefe --cov-report xml:cov.xml --cov wefe

And then:

coverage report -m

Build the documentation

The documentation is created using sphinx. It can be found in the doc folder at the root of the project. Here, the API is described as well as quick start and use cases. To compile the documentation, run it:

cd doc
make html

Citation

Please cite the following paper if using this package in an academic publication:

P. Badilla, F. Bravo-Marquez, and J. Pérez WEFE: The Word Embeddings Fairness Evaluation Framework In Proceedings of the 29th International Joint Conference on Artificial Intelligence and the 17th Pacific Rim International Conference on Artificial Intelligence (IJCAI-PRICAI 2020), Yokohama, Japan.

Bibtex:

@InProceedings{wefe2020,
    title     = {WEFE: The Word Embeddings Fairness Evaluation Framework},
    author    = {Badilla, Pablo and Bravo-Marquez, Felipe and Pérez, Jorge},
    booktitle = {Proceedings of the Twenty-Ninth International Joint Conference on
                Artificial Intelligence, {IJCAI-20}},
    publisher = {International Joint Conferences on Artificial Intelligence Organization},
    pages     = {430--436},
    year      = {2020},
    month     = {7},
    doi       = {10.24963/ijcai.2020/60},
    url       = {https://doi.org/10.24963/ijcai.2020/60},
    }

Team

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

wefe-0.1.5.tar.gz (326.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

wefe-0.1.5-py3-none-any.whl (339.9 kB view details)

Uploaded Python 3

File details

Details for the file wefe-0.1.5.tar.gz.

File metadata

  • Download URL: wefe-0.1.5.tar.gz
  • Upload date:
  • Size: 326.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0.post20200518 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.3

File hashes

Hashes for wefe-0.1.5.tar.gz
Algorithm Hash digest
SHA256 308d4f1a3c8a7e2282dc14738aa8580f3f3d284255d9636a64efd8763172d440
MD5 0dacb1a7dde615b5b464b691f3acf1a8
BLAKE2b-256 731833288c7f52d7568fe0a7595bb3fe0e837798d8e604bbe1a1a880b9cb15da

See more details on using hashes here.

File details

Details for the file wefe-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: wefe-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 339.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0.post20200518 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.3

File hashes

Hashes for wefe-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 a441c131d211ddb2983c5915593e117006809c005ae74eeebd6c349842efb905
MD5 bb256e79789da0cdb1482222b0675096
BLAKE2b-256 e611f49bc6a4a9637bcf354395ce9980f52a4632e2a162e0fabcd27c2c396a20

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page