aif360.datasets.BinaryLabelDataset

class aif360.datasets.BinaryLabelDataset(favorable_label=1.0, unfavorable_label=0.0, **kwargs)[source]

Base class for all structured datasets with binary labels.

Parameters:
  • favorable_label (float) – Label value which is considered favorable (i.e. “positive”).

  • unfavorable_label (float) – Label value which is considered unfavorable (i.e. “negative”).

  • **kwargs – StructuredDataset arguments.

Methods

align_datasets

Align the other dataset features, labels and protected_attributes to this dataset.

convert_to_dataframe

Convert the StructuredDataset to a pandas.DataFrame.

copy

Convenience method to return a copy of this dataset.

export_dataset

Export the dataset and supporting attributes TODO: The preferred file format is HDF

import_dataset

Import the dataset and supporting attributes TODO: The preferred file format is HDF

split

Split this dataset into multiple partitions.

subset

Subset of dataset based on position :param indexes: iterable which contains row indexes

temporarily_ignore

Temporarily add the fields provided to ignore_fields.

validate_dataset

Error checking and type validation.

__init__(favorable_label=1.0, unfavorable_label=0.0, **kwargs)[source]
Parameters:
  • favorable_label (float) – Label value which is considered favorable (i.e. “positive”).

  • unfavorable_label (float) – Label value which is considered unfavorable (i.e. “negative”).

  • **kwargs – StructuredDataset arguments.

validate_dataset()[source]

Error checking and type validation.

Raises:
  • ValueErrorlabels must be shape [n, 1].

  • ValueErrorfavorable_label and unfavorable_label must be the only values present in labels.