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

mitigation methods with image/multi-dimension data #1352

Open
nina-weng opened this issue Feb 12, 2024 · 2 comments
Open

mitigation methods with image/multi-dimension data #1352

nina-weng opened this issue Feb 12, 2024 · 2 comments

Comments

@nina-weng
Copy link

nina-weng commented Feb 12, 2024

I am trying to use the fairlearn bias mitigation methods with multi-dimension data like images. To my understanding, the postprocessing methods like ThresholdOptimizer, should not be constraint by the type of classifiers. However, when I try to implement the ThresholdOptimizer with input X (shape:[BS, C, W, H]), it keeps giving me error like:

ValueError: Found array with dim 4. None expected <= 2.

Which, if I understand correctly, suggests that X should only have a dim <=2.

I try to wrapped the clf model based on sklearn estimator, but it does not help as well.

I was wondering, how could I solve this issue?


version
scikit-learn 1.3.0


The error is coming from this line
if not allow_nd and array.ndim >= 3: raise ValueError( "Found array with dim %d. %s expected <= 2." % (array.ndim, estimator_name) )
in sklearn/utils/validation.py:953.
I belive that in fairlearn/utils/_input_validation.py:89:
X, y = check_X_y(X, y, dtype=None, force_all_finite=False), we should add allow_nd = True.

@alliesaizan
Copy link
Contributor

Hi @nina-weng! More information would help us troubleshoot. Can you please post a screenshot of the code you are working with here, including the parts with the unmitigated estimator and the issue with Threshold Optimizer?

@adrinjalali
Copy link
Member

I think I agree with @nina-weng here.

@nina-weng could you please open a PR to fix the issue?

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