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.3.8-cp310-cp310-manylinux_2_17_x86_64.whl (15.8 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

solas_ai-0.3.8-cp310-cp310-macosx_12_0_x86_64.whl (14.4 MB view details)

Uploaded CPython 3.10macOS 12.0+ x86-64

solas_ai-0.3.8-cp39-cp39-win_amd64.whl (14.0 MB view details)

Uploaded CPython 3.9Windows x86-64

solas_ai-0.3.8-cp39-cp39-manylinux_2_17_x86_64.whl (15.7 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

solas_ai-0.3.8-cp39-cp39-macosx_12_0_x86_64.whl (14.3 MB view details)

Uploaded CPython 3.9macOS 12.0+ x86-64

solas_ai-0.3.8-cp38-cp38-win_amd64.whl (13.9 MB view details)

Uploaded CPython 3.8Windows x86-64

solas_ai-0.3.8-cp38-cp38-manylinux_2_17_x86_64.whl (15.6 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

solas_ai-0.3.8-cp38-cp38-macosx_12_0_x86_64.whl (14.3 MB view details)

Uploaded CPython 3.8macOS 12.0+ x86-64

solas_ai-0.3.8-cp37-cp37m-win_amd64.whl (13.9 MB view details)

Uploaded CPython 3.7mWindows x86-64

solas_ai-0.3.8-cp37-cp37m-manylinux_2_17_x86_64.whl (15.5 MB view details)

Uploaded CPython 3.7mmanylinux: glibc 2.17+ x86-64

solas_ai-0.3.8-cp37-cp37m-macosx_12_0_x86_64.whl (14.3 MB view details)

Uploaded CPython 3.7mmacOS 12.0+ x86-64

File details

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

File metadata

File hashes

Hashes for solas_ai-0.3.8-cp310-cp310-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 87b112154c326aef7a341e037cc33d4003d2b38d3e7cdc20c62007daa13e4bbc
MD5 c3453fe283f3c3c62f974085169ad51a
BLAKE2b-256 4fa8341a1d215dea8404cb4f54e64a7b44c8582744f219a94c7fdd9f72c4c7a2

See more details on using hashes here.

File details

Details for the file solas_ai-0.3.8-cp310-cp310-macosx_12_0_x86_64.whl.

File metadata

File hashes

Hashes for solas_ai-0.3.8-cp310-cp310-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 a6bd6a00f74f516e16e93db0a43c6958a563a2444cd199d43c1acd90bd99e7a7
MD5 b80ccf901f4e41ca01e50b16ed26346b
BLAKE2b-256 8fae35419f5be18983241c2877101872fcbb5ee44a8e6736441a75bf532cb0e8

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for solas_ai-0.3.8-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 8c41fb7bcc32c1a26021dacc7239b6f65007e7f60d1af094c36de3e8fc2661eb
MD5 40c2d4d467834a120284be3c990ea27d
BLAKE2b-256 0471690281f35db0bf4d3bca827dfd20ce68118e233dad75e5a4ab1b3966abd1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for solas_ai-0.3.8-cp39-cp39-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 25f99c27cb5948a296c685f7f7116c1fcc31c26f1748fa2d5ceeb8edd48ffcfc
MD5 7075627a1d648810a43985efdbeb3585
BLAKE2b-256 049cc823c70dc23a2f8ec6c57b5f30f45dd93fcb17c688ff8062363b831610ad

See more details on using hashes here.

File details

Details for the file solas_ai-0.3.8-cp39-cp39-macosx_12_0_x86_64.whl.

File metadata

File hashes

Hashes for solas_ai-0.3.8-cp39-cp39-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 1bbef3145d80d3841f0ddc0dda007923152603163f784d7aa862ccd89b516280
MD5 a67ede0885fd15f86c75a699a9b20d5c
BLAKE2b-256 cb4cbba0cdf9f29f38c3fc468a1500159e4f619ebb0375fd2748772c04c396bb

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for solas_ai-0.3.8-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 7c2ec0ca3a32cfbcac68f85a89c90b112556e3c8748180e3636c824cfdd9235a
MD5 51aa48a47e1e731a931f77426a9df759
BLAKE2b-256 9c7e5cecf2edc2310e5da7b4539b5b537cc2fa0d404d1deec0fb0e9d2abbbe65

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for solas_ai-0.3.8-cp38-cp38-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 6ddb368848f1b1f2ce94139b7d026e0f98d54d7489338f6d060bfb5cee43246b
MD5 41cbe7533fc49e87895615d9261ce1dd
BLAKE2b-256 cbcb8950c967b8853c5d6aaf2c610d5de21e651d2acc46eb785b7bc7db1105ff

See more details on using hashes here.

File details

Details for the file solas_ai-0.3.8-cp38-cp38-macosx_12_0_x86_64.whl.

File metadata

File hashes

Hashes for solas_ai-0.3.8-cp38-cp38-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 5c9d496425636ed25bdb11b76a734895faf29a65af9832fa7e6faab2fba64684
MD5 371434c13b7ad68ad71dfae0192ea2b4
BLAKE2b-256 73575b2b04c5ea882d5216f7835943b7a14ab1b34952ac9c9b769ed8592fed7a

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for solas_ai-0.3.8-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 0b98505709a8c41b2511f1a4d5dd60276380ac6d9320736ebfb0e4f66e6756fc
MD5 49fc7e7f6bc6f55dcbf30c18449de90e
BLAKE2b-256 ef5b4726b3d4f2c66f72ef6ee1be6fdf01d533ac6c616406ed9acc412f30358b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for solas_ai-0.3.8-cp37-cp37m-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 c7c0ba573d259bf140a6e125c2b05b17509eee8f84d2907074ee1b1a36b6340a
MD5 485fffbbc85197efe7895c3649c4b425
BLAKE2b-256 3adb10f1a663b6de5d28e798ff32c6832c86909b57bc116eccf05d533c925da8

See more details on using hashes here.

File details

Details for the file solas_ai-0.3.8-cp37-cp37m-macosx_12_0_x86_64.whl.

File metadata

File hashes

Hashes for solas_ai-0.3.8-cp37-cp37m-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 b120695d7a86125fde6ffaff2c71cc0dad3deab85155f923c46979cd0256ca37
MD5 243aa08e839200b363789faf2c62f4b4
BLAKE2b-256 ddac6c1d27cd39b82a44102ad1e60049506a8c5f9408b1f0ca4fdb34af19ae33

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