Trusted-AI / AIF360

A comprehensive set of fairness metrics for datasets and machine learning models, explanations for these metrics, and algorithms to mitigate bias in datasets and models.
https://aif360.res.ibm.com/
Apache License 2.0
2.46k stars 840 forks source link

LFR bias mitigation method always returns a dataset with single class when passing multiclass dataset #440

Open pradeepdev-1995 opened 1 year ago

pradeepdev-1995 commented 1 year ago

I am trying to implement the LFR pre-processing bias mitigation in a multi-class classification dataset. The original dataset has 4 distinct classes as the target variable. Used the below code for LFR.

TR = LFR(unprivileged_groups=unprivileged_groups,
         privileged_groups=privileged_groups,
         k=10, Ax=0.1, Ay=1.0, Az=2.0,
         verbose=1
        )
TR = TR.fit(original_dataset, maxiter=5000, maxfun=5000)
dataset_transf_train = TR.transform(original_dataset)

print("dataset_transf_train")
print(dataset_transf_train.labels)

This code shows that the transformed dataset has always a single target column. Where have the other classes gone? Should I apply any tuning method for this?

Rajesh-Nair commented 1 year ago

Faced similar issue but when the threshold value is tuned, for a certain range LFR did work and brought the bias down.

Learning Fair Representations LFR_model = LFR(seed=1,unprivileged_groups=unprivileged_groups, privileged_groups=privileged_groups, k=3, verbose=0) dataset_transformed = LFR_model.fit_transform(dataset_original, maxiter=5000, maxfun=5000, threshold=0.25)