-
Notifications
You must be signed in to change notification settings - Fork 412
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
Binary group fairness metrics #1404
Conversation
for more information, see https://pre-commit.ci
hi @stancld or @lucadiliello could you pls assist here with this PR? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello, thanks for your contribution! I added some suggestions to improve code speed. Since I solved a similar problem when grouping metrics by indexes, if you need help feel free to ask!
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #1404 +/- ##
=======================================
Coverage 88% 88%
=======================================
Files 223 225 +2
Lines 11708 11860 +152
=======================================
+ Hits 10289 10466 +177
+ Misses 1419 1394 -25 |
I have added documentation. |
@Borda @justusschock Do you have any clue why our tests failing with some old configurations? 🤔 |
I think I remember this one, you are passing somewhere none instead of expected int:
I would suggest recreating this env and debugging locally... to do you you can use: |
Merge queue setting changed
Cool, thanks for the advice. I've setup the docker and will try to figure out what's going on there. |
Hey @stancld, doing the same currently :D Let me know if I can be of any help! It indeed seems to be some interplay with the fairlearn library. |
@Borda
cc: @AndresAlgaba (Btw, security support for python 3.7 ends in 3 months, so we can try to replace 3.7 support with newer 3.11 in general in the future.) |
Hi @AndresAlgaba, would you please check why |
@AndresAlgaba -- Sorry, actually found out one link for |
@AndresAlgaba thank you, and apology that it took so long... |
@Borda, my pleasure! And thanks to the entire team for all the help :D |
What does this PR do?
This PR initializes the addition of observational group fairness metrics. The general idea of these metrics is to compare the model's outputs across different groups created by the protected attribute(s) under evaluation.
As a first step, I implemented two common group fairness metrics, demographic parity and equal opportunity, for binary classification problems. For demographic parity, we compare the positivity rates and, for equal opportunity, the true positive rates. In the case of more than two groups, we use the largest disparity, i.e., dividing the lowest rate between the highest.
In this initial proposal, I build on the
stat_scores
and add some logic to compute the positivity and true positive rates for groups. There are still several issues, but I believe that this proposal allows for a more clear discussion. For example, I'm unsure whether the_binary_groups_stat_scores
should be part ofstat_scores
orgroup_fairness
. Overall, I tried to follow the style and logic of the other classification metrics as closely as possible.I will also add documentation and appropriate testing at a later stage when the big decisions on the design of the API for group fairness metrics are settled. There are also several potential extensions, such as including additional classification metrics for detecting discrimination and adding a similar logic to regression-based metrics.
I leave it as a draft for now. @Borda
Before submitting
PR review
Anyone in the community is free to review the PR once the tests have passed.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.
Did you have fun?
Make sure you had fun coding 🙃