fair_model

class fairdiverse.search.preprocessing_model.fair_model.PreprocessingFairnessIntervention(configs, dataset)[source]

Bases: ABC

Abstract base class for preprocessing fairness interventions.

This class serves as a base for various fairness intervention methods that preprocess datasets to reduce biases while maintaining data utility.

abstract fit(X_train, run)[source]

Train the fairness model using the given training dataset.

:param X_trainpandas.DataFrame

The training dataset.

:param runstr

The identifier for the training run when using k-fold.

:return : None

fit_transform(X_train, run)[source]

Learns the model from the training data and returns the data in the new space.

abstract transform(X, run, file_name=None)[source]

Apply the transformation to the dataset using the learned model.

:param Xpandas.DataFrame

The dataset to which the fairness transformation is applied.

:param runstr

The identifier for the transformation run.

:param file_namestr, optional

Name of the file to save the transformed dataset.

:returnpandas.DataFrame

The dataset with transformed fair columns.