expect_table_binary_label_model_bias

AI model · Safety / moderation · Text → Tables / structured data by Great Expectations

Expect fairness in a model by calculating disparities among features, scores, and labels using Aequitas.

A specialized AI/ML data quality model for evaluating classifier fairness and detecting bias across attribute groups. It uses the Aequitas library to calculate disparities between predicted and true values within the Great Expectations framework.

Model specs

The full spec card (context, pricing per token, modalities and more) on AntSpace. Sign up free to see the full spec card.

Languages
Python

Category: Machine Learning

Modalities
Table data → ExpectationSuiteValidationResult
Access
Available as a Batch Expectation within GX Core
Languages
English (Documentation)
Expectation Type
Contrib BatchExpectation
Status
BETA
Dependency
Aequitas
  • Calculates disparities among features, scores, and labels using Aequitas
  • Supports both binary and continuous prediction scores for evaluation
  • Customizable reference groups for race, sex, and age comparisons
  • Adjustable statistical significance levels (alpha) for bias determination
  • Integrated as a Batch Expectation within the GX Core framework

Overview

expect_table_binary_label_model_bias is a specialized AI/ML data quality model offered as a Batch Expectation within the Great Expectations (GX) framework. It is designed for data scientists and ML engineers to evaluate the fairness of classifier models by calculating disparities among features, scores, and labels using the Aequitas library. The model analyzes predicted and true values to detect bias imposed on specific attribute groups, such as race, gender, or age. It supports both binary and continuous prediction scores and allows for fine-grained control over statistical significance levels and reference group comparisons. This tool helps organizations ensure their AI models are equitable and compliant with internal fairness standards before deployment. It is currently categorized as a BETA level expectation contributed by the community.

Fairness and Bias Detection

  • Bias Calculation: The model calculates disparities among features, scores, and labels to evaluate how a classifier imposes bias on specific attribute groups.
  • Fairness Evaluation: It analyzes predicted and true values to evaluate metrics on how a classifier model imposes bias on a given attribute group.
  • Reference Group Comparison: Users can specify a reference group for comparison, such as specific race, sex, or age categories, using a JSON-serializable dictionary.
  • Significance Testing: The model uses a statistical significance level (alpha) between 0 and 1 to determine significance in bias detection.

Data Requirements and Control

  • Binary Label Support: The model requires a binary column for the actual y value (y_true).
  • Flexible Score Inputs: The modeled y value (y_pred) can be provided as either a binary or continuous score column.
  • Partial Success Evaluation: Expectations can be configured to pass if supervised fairness is observed even if overall fairness is false.
  • Validation Results: The model returns an ExpectationSuiteValidationResult containing the outcome of the fairness checks.

Use cases

  • Data scientists evaluate a classifier model to detect if it imposes bias on specific attribute groups like race or gender.
  • ML engineers compare model performance against a specific reference group to ensure equitable outcomes across different demographics.
  • Organizations validate that their predictive models meet internal fairness standards before deploying them into production environments.
  • Teams use statistical significance testing to determine if observed disparities in model scores are mathematically significant.

Specifications

Modalities
Table data → ExpectationSuiteValidationResult
Access
Available as a Batch Expectation within GX Core
Languages
English (Documentation)
Expectation Type
Contrib BatchExpectation
Status
BETA
Dependency
Aequitas
Metric Name
table.modeling.binary.model_bias
Input y_true Type
Binary String Column
Input y_pred Type
Binary or Continuous String Column
Reference Group Format
JSON-serializable dictionary

How it works

  1. Identify Data Source: The user identifies the table containing model predictions and true labels within their data pipeline.
  2. Configure Expectation: The expect_table_binary_label_model_bias expectation is configured with required columns and optional parameters like reference_group and alpha.
  3. Execute Fairness Analysis: The expectation uses the Aequitas library to calculate disparities and evaluate fairness metrics across attribute groups.
  4. Review Validation Results: The system returns an ExpectationSuiteValidationResult indicating whether the model meets the defined fairness criteria.

FAQ

What data columns are required for this model?

The model requires two primary columns: 'y_true' for the actual binary label and 'y_pred' for the modeled value, which can be binary or continuous.

How do I specify a reference group for bias comparison?

The reference group is defined using a JSON-serializable dictionary that specifies the attribute values to compare against, such as {'race':'Caucasian', 'sex':'Male'}.

What does the partial_success parameter do?

If the partial_success argument is set to True, the expectation will pass if supervised or supervised fairness are observed, even if the overall fairness result is false.

Added by AntSpace from public sources (greatexpectations.io).

More AI models by Great Expectations