aif360.algorithms

Base Class

class aif360.algorithms.Transformer(**kwargs)[source]

Abstract base class for transformers.

Transformers are an abstraction for any process which acts on a Dataset and returns a new, modified Dataset. This definition encompasses pre-processing, in-processing, and post-processing algorithms.

Initialize a Transformer object.

Algorithm-specific configuration parameters should be passed here.

fit(dataset)[source]

Train a model on the input.

Parameters:dataset (Dataset) – Input dataset.
Returns:Returns self.
Return type:Transformer
fit_predict(dataset)[source]

Train a model on the input and predict the labels.

Equivalent to calling fit(dataset) followed by predict(dataset).

Parameters:dataset (Dataset) – Input dataset.
Returns:Output dataset. metadata should reflect the details of this transformation.
Return type:Dataset
fit_transform(dataset)[source]

Train a model on the input and transform the dataset accordingly.

Equivalent to calling fit(dataset) followed by transform(dataset).

Parameters:dataset (Dataset) – Input dataset.
Returns:Output dataset. metadata should reflect the details of this transformation.
Return type:Dataset
predict(dataset)[source]

Return a new dataset with labels predicted by running this Transformer on the input.

Parameters:dataset (Dataset) – Input dataset.
Returns:Output dataset. metadata should reflect the details of this transformation.
Return type:Dataset
transform(dataset)[source]

Return a new dataset generated by running this Transformer on the input.

This function could return different dataset.features, dataset.labels, or both.

Parameters:dataset (Dataset) – Input dataset.
Returns:Output dataset. metadata should reflect the details of this transformation.
Return type:Dataset