Skip to main content

A Python Library of Curated Disparity Testing Metrics for Use in Real-World Settings

Project description

SolasAI Disparity and Bias Testing Library

A Python Library of Curated Disparity Testing Metrics for Use in Real-World Settings


SolasAI banner

This text and associated software do not represent and should not be construed as providing legal advice or requirements for regulatory compliance.

About the SolasAI Disparity and Bias Testing Lbrary

The SolasAI Disparity Testing Library is a collection of tools that allows modelers, compliance, and business stakeholders to test outcomes for bias or discrimination using widely accepted fairness metrics.

See also:

Example usage: Calculating an adverse impact ratio

import solas_disparity as sd

air_disparity = sd.adverse_impact_ratio(
    group_data=df,
    protected_groups=['black', 'hispanic', 'asian', 'female'],
    reference_groups=['white', 'white', 'white', 'male'],
    group_categories=['race', 'race', 'race', 'sex'],
    outcome=df['Approved'],
    sample_weight=None,
    air_threshold=0.90,
    percent_difference_threshold=0.0,
)

For more detailed examples, please refer to our example notebooks

Additional metrics included with SolasAI's Disparity Testing Library

  • Adverse Impact Ratio (AIR)
  • By-Quantile Adverse Impact Ratio
  • Categorical Adverse Impact Ratio
  • Segmented Adverse Impact Ratio
  • Standardized Mean Difference (SMD)
  • Residual Standardized Mean Difference
  • Odds Ratio

Additional metrics are coming soon, including a generic customizable disparity testing function, which can create a disparity measurement from nearly any scikit-learn-style metric.

Installation

pip install solas-ai

To run the example notebooks in this repository, also install the following:

pip install notebook xgboost scikit-learn

SolasAI is supported on Python 3.7 through 3.10, on Windows, MacOS, and Linux.

Why SolasAI?

There are many good open-source disparity testing libraries already available (we encourage you to try them!). So why use SolasAI's Library?

SolasAI's disparity testing library was built by industry practitioners with decades of experience in fair lending, employment discrimination analysis, and algorithmic compliance. The methodologies included in this library are widely used across the fairness analytics space and were created to align with legal and regulatory expectations. For example, the Adverse Impact Ratio is cited by the EEOC as a standard metric for evaluating disparities in employment decisions.

Because of our experience in the field, we built SolasAI and this disparity testing library to solve common challenges that many users will face. Using the United States as an example, outside of mortgage lending, lenders generally do not have access to race/ethnicity data and will rely on proxy methodologies like the Bayesian Improved Surname Geocoding (BISG) method to predict probabilities of demographic membership. Other libraries require binary (0/1) demographic membership for testing (ex. "Black" or "White"), which is unfortunate since converting BISG probabilities to fit that format results in substantial loss of information. SolasAI's disparity testing library accommodates binary or continuous demographic probabilities, making it compatible with self-reported or proxied values with no changes in functionality.

In addition to standard metrics like the Adverse Impact Ratio (AIR) and Standardized Mean Difference (SMD), other metrics extend on the AIR or SMD to better solve real-world use cases. Some are more straightforward: the Categorical AIR, for example, allows for disparity calculations on rankable categorical outcomes instead of just binary outcomes. Others involve more sophisticated methodological changes. The Segmented AIR allows a user to account for differences in underlying demographics across some segment (ex. State, product type) and then uses a Cochran-Mantel-Haenszel test to determine the statistical significance of any remaining disparity.

Other examples of enhancements include:

  • Customizable practical significance thresholds
  • Compatibility with sample weights

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

solas_ai-0.2.4-cp310-cp310-manylinux_2_17_x86_64.whl (1.9 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

solas_ai-0.2.4-cp310-cp310-macosx_10_16_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.10macOS 10.16+ x86-64

solas_ai-0.2.4-cp39-cp39-win_amd64.whl (2.4 MB view details)

Uploaded CPython 3.9Windows x86-64

solas_ai-0.2.4-cp39-cp39-manylinux_2_17_x86_64.whl (1.8 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

solas_ai-0.2.4-cp39-cp39-macosx_10_16_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.9macOS 10.16+ x86-64

solas_ai-0.2.4-cp38-cp38-win_amd64.whl (2.4 MB view details)

Uploaded CPython 3.8Windows x86-64

solas_ai-0.2.4-cp38-cp38-manylinux_2_17_x86_64.whl (1.8 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

solas_ai-0.2.4-cp38-cp38-macosx_10_16_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.8macOS 10.16+ x86-64

solas_ai-0.2.4-cp37-cp37m-win_amd64.whl (2.3 MB view details)

Uploaded CPython 3.7mWindows x86-64

solas_ai-0.2.4-cp37-cp37m-manylinux_2_17_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.7mmanylinux: glibc 2.17+ x86-64

solas_ai-0.2.4-cp37-cp37m-macosx_10_16_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.7mmacOS 10.16+ x86-64

File details

Details for the file solas_ai-0.2.4-cp310-cp310-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for solas_ai-0.2.4-cp310-cp310-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 2146793a197d7f4ac1a737b71ec690b1caa4eff4d5195a1a0b2bb45da39625a1
MD5 272f28617133631446585a8089bfbc0c
BLAKE2b-256 dc9ca3f39f1e7de0db9519d70a3bb3a2efb01a65a00f670ec1d92faf5b469671

See more details on using hashes here.

File details

Details for the file solas_ai-0.2.4-cp310-cp310-macosx_10_16_x86_64.whl.

File metadata

File hashes

Hashes for solas_ai-0.2.4-cp310-cp310-macosx_10_16_x86_64.whl
Algorithm Hash digest
SHA256 c0bbab8631bb421668bf07c85685aa4a1530f05d2d83e7d724543978dbd90ea1
MD5 0541c31d4f791a6ca0211d533c48e7dc
BLAKE2b-256 b5ba97dd5afe56a260b636f839576cb79ecec0c2d1cb1663520b0344c45d96e3

See more details on using hashes here.

File details

Details for the file solas_ai-0.2.4-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: solas_ai-0.2.4-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 2.4 MB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.13

File hashes

Hashes for solas_ai-0.2.4-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 39c55d0d81feb20a4794a33bf701807bfff0aa3bee810f09377cd3f83ef4ede7
MD5 c65480e9637170f2eedff803d81344ce
BLAKE2b-256 12c51d3ccfaf80edc878c66ae3d3d6eec92a1699fd051d7c7e9da74cb40abcc9

See more details on using hashes here.

File details

Details for the file solas_ai-0.2.4-cp39-cp39-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for solas_ai-0.2.4-cp39-cp39-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 e7a3138216c3ca6ebbf9938f94b598e472c88614795f5f3fda24f9915b0c7127
MD5 80a59b1e1708d35eb08614b24dd33206
BLAKE2b-256 f8e137d2aaa0082f3ec69a9d2e2756cc372f040778e32ce95b8279aadc371026

See more details on using hashes here.

File details

Details for the file solas_ai-0.2.4-cp39-cp39-macosx_10_16_x86_64.whl.

File metadata

File hashes

Hashes for solas_ai-0.2.4-cp39-cp39-macosx_10_16_x86_64.whl
Algorithm Hash digest
SHA256 99eeab2e599b67c4ce43d0b916d44d857e2bf84451f2fd71ebbe7d9bcae2a473
MD5 07d3504dc56f97667a805601e9cac078
BLAKE2b-256 a4a7efcbedcc0af9e885f55ce9b2d7217000175afab0be6d74f7de7b2ce86c9a

See more details on using hashes here.

File details

Details for the file solas_ai-0.2.4-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: solas_ai-0.2.4-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 2.4 MB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.13

File hashes

Hashes for solas_ai-0.2.4-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 002801111926d36ca9830ca8ba58ad522b5d05fe3dae326324884c0d2d0d4fb5
MD5 6e6007d6b76afe77556e2e291ce6001b
BLAKE2b-256 d23f4b53a00f392a656bfac6133a9dac23fe9bd4179f3f95ed15e8da030fcf04

See more details on using hashes here.

File details

Details for the file solas_ai-0.2.4-cp38-cp38-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for solas_ai-0.2.4-cp38-cp38-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 3d4c477585724b023312028f276c88a8594263545d86f0bdb4854ec5fe7a6925
MD5 428a7383c86942cf6e9b6630df836fde
BLAKE2b-256 419962fea3d8d6673642192d37d6ffd8081c852316bd27307e3d7a5aa92b93cc

See more details on using hashes here.

File details

Details for the file solas_ai-0.2.4-cp38-cp38-macosx_10_16_x86_64.whl.

File metadata

File hashes

Hashes for solas_ai-0.2.4-cp38-cp38-macosx_10_16_x86_64.whl
Algorithm Hash digest
SHA256 e5a718263e0e07bbb86ba18d244ca8fb15c07e96dffa2d1d5ae95f8d471d704a
MD5 590872224be8eecf3e22f9e1d385616c
BLAKE2b-256 94f8edfe5d4b8ab8b895f086d2f0d68f30dabf090a53378af0aeab6cc6b59c34

See more details on using hashes here.

File details

Details for the file solas_ai-0.2.4-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: solas_ai-0.2.4-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 2.3 MB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.13

File hashes

Hashes for solas_ai-0.2.4-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 d5cdcc37a62b3d74fef6cb45515efe2cfa5e1737bdda5b75e520334df42d556f
MD5 41c0aeef3ada492c0568850734b909e8
BLAKE2b-256 bc34f640e9788151183e8db24459b1ea276c54c14696cc8309c2924d1304293b

See more details on using hashes here.

File details

Details for the file solas_ai-0.2.4-cp37-cp37m-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for solas_ai-0.2.4-cp37-cp37m-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 7acd731aa2b7a981dc4cf01e0b46e4f2ef986485a27a14f7f53afc89696c2571
MD5 547ccff96ddaf59b529790194e662666
BLAKE2b-256 9d4cefafb8f06607e554929d5121194867622e84242139175870d099bb72957b

See more details on using hashes here.

File details

Details for the file solas_ai-0.2.4-cp37-cp37m-macosx_10_16_x86_64.whl.

File metadata

File hashes

Hashes for solas_ai-0.2.4-cp37-cp37m-macosx_10_16_x86_64.whl
Algorithm Hash digest
SHA256 cfb0a1f74f7866cafad904c229d72839123d4929eaae5ba60734a7cc5bcd52ba
MD5 a84f97704f087cb76162f7f7436c065c
BLAKE2b-256 da07c877d4522663983a1863d0160a5f741e5aae2d3d414b13d7f77f84edd5f4

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