Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to find statistical_parity_difference in Multi class classification dataset #431

Open
pradeepdev-1995 opened this issue Jan 17, 2023 · 0 comments

Comments

@pradeepdev-1995
Copy link

I have tried the following code for finding the statistical_parity_difference difference of a multiclass classification dataset

from aif360.datasets import StructuredDataset
from aif360.metrics import DatasetMetric
cols = ['one', 'sex', 'three','label']
labs = np.ones((4, 1))
d = {'one': [.1, .2,.3,.4],'sex': [0,1,1,0], 'three': [.5,.8,.9,1], 'label': [.1,.2,.3,.1]}
df = pd.DataFrame(data=d)
sd = StructuredDataset(df=df, label_names=['label'],protected_attribute_names=['sex'])
privileged_groups = [{'sex': 1}]
unprivileged_groups = [{'sex': 0}]
metric_orig_train = DatasetMetric(sd,unprivileged_groups=unprivileged_groups,
                                       privileged_groups=privileged_groups)
print("Difference in mean outcomes between unprivileged and privileged groups = %f" % metric_orig_train.mean_difference())

It shows the error like

AttributeError: 'DatasetMetric' object has no attribute 'mean_difference'

I know itis due to DatasetMetric class has no method named mean_difference. Then what is the other way to see the statistical_parity_difference in multiclass classification using AIF360?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant