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

ValueError: at least one array or dtype is required #283

Open bhavyaghai opened 2 years ago

bhavyaghai commented 2 years ago

Hi, I am facing ValueError while fitting GerryFairClassifier on the German dataset. See this code:

dataset = GermanDataset() inp = GerryFairClassifier() inp.fit(dataset)

On executing the above code, I get the error 'ValueError: at least one array or dtype is required'. Am I doing something wrong? PS: The above code runs fine for Compas, Adult and Bank datasets.

bhavyaghai commented 2 years ago

I guess one reason for this error might be due to the default labels. German datasets has default labels values [1,2] which is different from all other datasets [0,1]. I tried to hack this issue as following:

dataset = GermanDataset() dataset.labels = (dataset.labels-1.0).astype('float64') dataset.favorable_label = 1.0 dataset.unfavorable_label = 0.0 inp = GerryFairClassifier() inp.fit(dataset)

The above code produces no error. Not sure if this is the proper solution.