Learn R Programming

AI Fairness 360 (AIF360) R Package

Overview

The AI Fairness 360 toolkit is an open-source library to help detect and mitigate bias in machine learning models. The AI Fairness 360 R package includes a comprehensive set of metrics for datasets and models to test for biases, explanations for these metrics, and algorithms to mitigate bias in datasets and models.

Installation

This package is currently under CRAN review.

You can install the development version from GitHub with:

# install.packages("devtools")
devtools::install_github("IBM/AIF360/aif360/aif360-r") 

Then, use the install_aif360() function to install AIF360:

library(aif360)
install_aif360()

Getting Started

load_aif360_lib()
# load a toy dataset
data <- data.frame("feature1" = c(0,0,1,1,1,1,0,1,1,0), 
                   "feature2" = c(0,1,0,1,1,0,0,0,0,1),
+                  "label" = c(1,0,0,1,0,0,1,0,1,1))
# format the dataset
formatted_dataset <- aif360::aif_dataset(data_path = data, 
                                          favor_label = 0, 
                                          unfavor_label = 1, 
                                          unprivileged_protected_attribute = 0, 
                                          privileged_protected_attribute = 1, 
                                          target_column = "label", 
                                          protected_attribute = "feature1")

Contributing

If you’d like to contribute to the development of aif360, please read these guidelines.

Please note that the aif360 project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

Copy Link

Version

Install

install.packages('aif360')

Monthly Downloads

19

Version

0.1.0

License

Apache License (>= 2.0)

Issues

Pull Requests

Stars

Forks

Maintainer

Saishruthi Swaminathan

Last Published

June 23rd, 2020

Functions in aif360 (0.1.0)

compas_dataset

Compas Dataset
disparate_impact_remover

Disparate Impact Remover
reweighing

Reweighing
prejudice_remover

Prejudice Remover
reject_option_classification

Reject option classification
load_aif360_lib

load functions
aif_dataset

AIF360 dataset
bank_dataset

Bank Dataset
classification_metric

Classification Metric
adversarial_debiasing

Adversarial Debiasing
german_dataset

German Dataset
adult_dataset

Adult Census Income Dataset
binary_label_dataset_metric

Binary Label Dataset Metric
install_aif360

Install aif360 and its dependencies