-
Notifications
You must be signed in to change notification settings - Fork 851
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
Typo in grid_search_reduction.py causing AttributeError: 'GridSearchReduction' object has no attribute 'moment' #451
Comments
Hi there, Thanks for flagging this. Interesting, do you know if For example, in the code for GridSearchReduction in the sklearn-compatible version of AIF360, you can see the use of |
That's a good question. Based on my understanding, we want to check if the provided moment is one that is implemented as ClassificationMoment in fairlearn. In the above code sample, when I call self.model.moment_, I get the result An alternative way to checking
However, since this dict is only specified in fit(), it cannot be accessed via self.model at the moment. So, another fix could be to add this dict of accepted moments in the init() function of GridSearchReduction, and then check if the model moment is in this dict, similar to what lines 124-126 do in the sklearn-compatible version:
Compared to this, fixing the typo to self.model.moment_ seems the easier choice in my opinion. |
Thanks for the exploration! This makes sense to me, could you please open a PR with your changes to line 140 above and link this issue there? |
Linked to issue Trusted-AI#451 of AIF360: Trusted-AI#451 Signed-off-by: haas-christian <34253996+haas-christian@users.noreply.github.com>
Done! |
In the current version of GridSearchReduction, there's a typo in the predict() function that causes an AttributeError when trying to use a fitted GridSearchReduction model for predicting a new dataset.
Specifically, the typo is in line 140:
if isinstance(self.model.moment, red.ClassificationMoment):
Since the model does not have an attribute moment, it will cause the Attribute Error. Instead, the moment attribute of the model should be self.model.moment_ :
if isinstance(self.model.moment_, red.ClassificationMoment):
Here's an example that shows the described behavior:
The text was updated successfully, but these errors were encountered: