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

AdversarialFairnessRegressor - incorrect input size #1360

Open
parasurama opened this issue May 7, 2024 · 4 comments
Open

AdversarialFairnessRegressor - incorrect input size #1360

parasurama opened this issue May 7, 2024 · 4 comments

Comments

@parasurama
Copy link

Describe the bug

AdversarialFairnessRegressor is throwing an incorrect input size warning.
The input size is (batch_size, n_samples) rather than (batch_size, n_features)

Steps/Code to Reproduce

from fairlearn.adversarial import AdversarialFairnessRegressor
import numpy as np

X = np.random.rand(10000, 10)
y = np.random.rand(10000)
z = np.random.binomial(1, 0.5, 10000)


print(X.shape, y.shape, z.shape)

mitigator = AdversarialFairnessRegressor(backend="torch",
                                         progress_updates=0.5,
                                         batch_size=32)

mitigator.fit(X, y, sensitive_features=z)

Expected Results

Input size should be (batch_size, n_features), not (batch_size, n_samples)

Actual Results

UserWarning: Using a target size (torch.Size([32, 1])) that is different to the input size (torch.Size([32, 10000])). This will likely lead to incorrect results due to broadcasting. Please ensure they have the same size. 

Screenshots

Versions

  • OS: MacOS
  • Python version: 3.11.4
  • Fairlearn version:
  • fairlearn: 0.10.0
    Cython: None
    lightgbm: 4.3.0
    matplotlib: 3.7.1
    numpy: 1.26.4
    pandas: 2.2.2
    pip: 23.2.1
    pytorch: None
    scipy: 1.10.1
    setuptools: 69.5.1
    sklearn: None
    tensorflow: 2.16.1
@parasurama
Copy link
Author

Note that AdversarialFairnessClassifier doesn't throw this warning

@adrinjalali
Copy link
Member

@SeanMcCarren would you be able to have a look?

@parasurama
Copy link
Author

Looks like there is already an open pull request for this issue #1333

@SeanMcCarren
Copy link
Contributor

@SeanMcCarren would you be able to have a look?

Yes, had a look, indeed as @parasurama mentioned it's fixed by #1333

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

3 participants