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

MetaFairClassifier not working with certain dataset loaders #454

Open
richeekAbacus opened this issue Jun 3, 2023 · 3 comments
Open

MetaFairClassifier not working with certain dataset loaders #454

richeekAbacus opened this issue Jun 3, 2023 · 3 comments

Comments

@richeekAbacus
Copy link

The example notebook https://github.com/Trusted-AI/AIF360/blob/master/examples/demo_meta_classifier.ipynb fails to run the MetaFairClassifier successfully.

I get errors like:

/opt/conda/envs/env/lib/python3.9/site-packages/aif360/algorithms/inprocessing/celisMeta/FalseDiscovery.py:31: RuntimeWarning: invalid value encountered in divide
  prob_y_1 = (prob_1_1 + prob_1_0) / total
/opt/conda/envs/env/lib/python3.9/site-packages/aif360/algorithms/inprocessing/celisMeta/FalseDiscovery.py:32: RuntimeWarning: invalid value encountered in divide
  prob_z_0 = (prob_m1_0 + prob_1_0) / total
/opt/conda/envs/env/lib/python3.9/site-packages/aif360/algorithms/inprocessing/celisMeta/FalseDiscovery.py:33: RuntimeWarning: invalid value encountered in divide
  prob_z_1 = (prob_m1_1 + prob_1_1) / total
/opt/conda/envs/env/lib/python3.9/site-packages/aif360/algorithms/inprocessing/celisMeta/FalseDiscovery.py:35: RuntimeWarning: invalid value encountered in divide
  probc_m1_0 = prob_m1_0 / total
/opt/conda/envs/env/lib/python3.9/site-packages/aif360/algorithms/inprocessing/celisMeta/FalseDiscovery.py:36: RuntimeWarning: invalid value encountered in divide
  probc_m1_1 = prob_m1_1 / total
Traceback (most recent call last):
  File "/home/richeek/NAS-Fairness-Tabular/baselines.py", line 333, in <module>
    main()
  File "/home/richeek/NAS-Fairness-Tabular/baselines.py", line 209, in main
    debias_model = MetaFairClassifier(tau=0.9, sensitive_attr=args.privilege_mode,
  File "/opt/conda/envs/env/lib/python3.9/site-packages/aif360/algorithms/transformer.py", line 27, in wrapper
    new_dataset = func(self, *args, **kwargs)
  File "/opt/conda/envs/env/lib/python3.9/site-packages/aif360/algorithms/inprocessing/meta_fair_classifier.py", line 66, in fit
    self.model = self.obj.getModel(self.tau, x_train, y_train,
  File "/opt/conda/envs/env/lib/python3.9/site-packages/aif360/algorithms/inprocessing/celisMeta/General.py", line 99, in getModel
    t = self.getValueForX(dist, a, b, params, z_1, X)
  File "/opt/conda/envs/env/lib/python3.9/site-packages/aif360/algorithms/inprocessing/celisMeta/FalseDiscovery.py", line 18, in getValueForX
    u_1, u_2, l_1, l_2 = params
TypeError: cannot unpack non-iterable NoneType object

I feel this is a dataset related issue, but I can't figure out why this is happening

@richeekAbacus richeekAbacus changed the title MetaFairClassifier MetaFairClassifier not working with certain dataset loaders Jun 3, 2023
@serbanstan
Copy link

Downgrading to scipy-1.5.4 may be a temporary fix. The problem comes from the computation of multivariate_normal.pdf, which in the newer version of scipy returns very small values compared to the older versions.

@boghrati
Copy link

boghrati commented Jan 3, 2024

Hi,
I encounter the same issue with metafair classifier as well. My code was correct about a year ago, but now, it raises an error. I tried downgrading scipy, but it didn't help. I was wondering if there is any solution for this error?
TypeError: cannot unpack non-iterable NoneType object

@team-daniel
Copy link

team-daniel commented Apr 16, 2024

Downgrading to scipy-1.5.4 may be a temporary fix. The problem comes from the computation of multivariate_normal.pdf, which in the newer version of scipy returns very small values compared to the older versions.

You have just saved hours of heartache 🥰 thank you so much! I downgraded to scipy==1.8.1 if anyone in the future sees this!

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

4 participants