AI Fairness 360 (AIF360)

repository·main·Indexed 25 days ago

https://github.com/trusted-ai/aif360

An extensible open-source toolkit for detecting and mitigating bias in machine learning models. AIF360 provides metrics for datasets and models, explanations for those metrics, and various bias mitigation algorithms across pre-processing, in-processing, and post-processing stages. It includes an R package, a scikit-learn compatible interface via the aif360.sklearn sub-package, and Kubeflow pipeline components for automated fairness checks.

Tokens
20.9K
Snippets
41
Records
109
Agent score
81%

What's inside AIF360

  1. Explore MLOps integration samples for AIF360

    main

    AIF360 provides samples and examples for integrating fairness workflows into MLOps pipelines and Machine Learning platforms. Key integration areas include:

    • MLOps Pipelines: Integrating AIF360 with orchestration tools like Kubeflow Pipelines.
    • ML Platforms: Surfacing AIF360 capabilities within platforms such as OpenScale or KFServing.

    Available samples include implementations for Kubeflow and Apache NiFi.

  2. Use AIF360 Kubeflow Pipeline Components

    main

    AIF360 provides Kubeflow pipeline components designed to automate fairness checks within a Kubeflow workflow. These components are implemented as pipeline tasks that consume artifacts as input and produce artifacts as output.

    One available component is the Bias Detector - PyTorch, which performs fairness checks on specific attributes using AIF360 to ensure models are fair and ethical.

  3. Use the aif360.sklearn interface for scikit-learn workflows

    main
    The aif360.sklearn sub-package provides a separate interface designed to match scikit-learn paradigms and APIs. This allows for easier integration of fairness metrics and debiasing algorithms into typical machine learning workflows compared to the main AIF360 package. It supports datasets reformatted as separate X and y (and sample_weight) DataFrame objects, where protected attributes are stored as the index.
  4. Use scikit-learn compatible AIF360 API

    main
    The aif360.sklearn module provides a version of the AIF360 API designed to follow scikit-learn paradigms. It uses pandas.DataFrame for datasets and is functionally equivalent to the standard AIF360 API where possible. Note that this module is under active development and may not support all AIF360 functionality.
  5. Access default AIF360 datasets

    main

    AIF360 supports several default datasets, but the raw data files are not included in the toolkit installation. To use these datasets, you must download the raw files manually by following the specific instructions provided in each dataset's corresponding README file within the raw/ directory of the repository.

    Supported datasets include:

  6. Use the AIF360 Generic Processor in NiFi

    main

    The AIF360 Generic Processor takes a FlowFile as input and adds fairness metrics attributes to the FlowFile as output.

    Input Requirements:

    • The processor currently expects the FlowFile to be in headerless CSV format, using a comma as the separator.
  7. Install AIF360 via Manual Installation (Editable mode)

    main
    To install from the source repository (useful for developers or running local examples), clone the repo and install in editable mode. To run examples, you must also download datasets as described in aif360/data/README.md.
  8. Explore bias detection and mitigation with the Medical Expenditure tutorial

    main

    The Medical expenditure tutorial provides a comprehensive walkthrough for detecting and mitigating racial bias in care management scenarios. It is useful for learning how to use multiple tools in combination:

    • Fairness Metrics: disparate impact, average odds difference, statistical parity difference, equal opportunity difference, and Theil index.
    • Bias Mitigation Algorithms: reweighing, prejudice remover, and disparate impact remover.
    • Model Explanations: demonstrates how to generate explanations for model predictions using LIME.