Skip to content

Fairlearn #6539

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

Merged
merged 63 commits into from
May 11, 2023
Merged

Fairlearn #6539

merged 63 commits into from
May 11, 2023

Conversation

LittleLittleCloud
Copy link
Contributor

@LittleLittleCloud LittleLittleCloud commented Jan 13, 2023

We are excited to review your PR.

So we can do the best job, please check:

  • There's a descriptive title that will make sense to other developers some time from now.
  • There's associated issues. All PR's should have issue(s) associated - unless a trivial self-evident change such as fixing a typo. You can use the format Fixes #nnnn in your description to cause GitHub to automatically close the issue(s) when your PR is merged.
  • Your change description explains what the change does, why you chose your approach, and anything else that reviewers should know.
  • You have included any necessary tests in the same PR.

Might be helpful to resolve #1912

Jordi Ramos and others added 30 commits June 13, 2022 14:07
Added `inPlace:true` to the append to fix the bug that no columns are added;

Added unit testing to test the basic funcitonality of Metrc.Regression.ByGroup()
Added MSE and MAE (MeanAbsoluteError), and included tests for MSE and RMS
RMS and MSE fully supported by Fairlearn.Metric.Regression now accross all three functions
created the moment class and utilityParity class. Initial commit
Passed the initial unit tests for Demographic Parity. Every class is made public which needs to be changed in the future. Utility Parity still needs to be changed for other parities to work
…yClassificationSearchSpaceGenerator

update
There is still a lot of development needed to be done with the moment class
…search

getting sensitive feature column names directly from a getter function, adjusted default value for the option to a random value
built the first prototype for the gridSearchTrialRunner. We have enabled a seperate training set for training and testing set for validating the result, which is a different approach from the original implementation.
Added a new feature so that users can look up row item by the name of the column instead of the raw row index
… fairlearn

In fairlearn AutoML, we have to add in a singleton to the serviceCollection called moment, which will be later extracted to calculate the fairness parity.
Added an if statement to output fairlearn metric if using fairlearn
the experiment is able to add a moment to its serviceCollection which is later used to calculate fairlearn parity.
Created a tuner so that we can go through the search space through the gridsearch algorithm
// get all the columns of the schema
DataViewSchema columns = _eval.Schema;

// TODO: is converting IDataview to DataFrame the best practice?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its not the best practice, especially when input files (depending on the trainer) can be streamed in and can be larger than the memory on the machine. Its probably fine to start out this way, but it will be something that is needed to change later.

using Microsoft.ML.SearchSpace;
using Microsoft.ML.SearchSpace.Option;

namespace Microsoft.ML.Fairlearn.reductions
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean to have the namespace be reductions with a lowercase r? Would be better to be a capital.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LittleLittleCloud looks like its still lowecase r. Is there a reason for it to be that way?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope there's no reason for that but a mistake. I thought I fixed it but maybe not. Let me check

Copy link
Member

@michaelgsharp michaelgsharp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly minor formatting changes, but the namespace needs to be addressed.

@ghost ghost added the needs-author-action label May 4, 2023
@ghost ghost removed the needs-author-action label May 8, 2023
@codecov
Copy link

codecov bot commented May 10, 2023

Codecov Report

Merging #6539 (dda3785) into main (247f3a0) will increase coverage by 0.19%.
The diff coverage is 82.51%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6539      +/-   ##
==========================================
+ Coverage   68.59%   68.78%   +0.19%     
==========================================
  Files        1201     1215      +14     
  Lines      250296   251523    +1227     
  Branches    26094    26227     +133     
==========================================
+ Hits       171681   173006    +1325     
+ Misses      71802    71705      -97     
+ Partials     6813     6812       -1     
Flag Coverage Δ
Debug 68.78% <82.51%> (+0.19%) ⬆️
production 63.30% <80.75%> (+0.22%) ⬆️
test 88.87% <87.01%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/Microsoft.ML.Fairlearn/AutoML/TunerFactory.cs 0.00% <0.00%> (ø)
...Microsoft.ML.AutoML.Tests/AutoMLExperimentTests.cs 83.93% <0.00%> (-4.93%) ⬇️
src/Microsoft.Data.Analysis/DataFrameRow.cs 66.66% <50.00%> (-3.71%) ⬇️
...t.ML.Fairlearn/AutoML/AutoMLExperimentExtension.cs 66.66% <66.66%> (ø)
src/Microsoft.ML.Fairlearn/Reductions/Moment.cs 68.18% <68.18%> (ø)
...Microsoft.ML.Fairlearn/Reductions/UtilityParity.cs 79.71% <79.71%> (ø)
...oft.ML.Fairlearn/Metrics/FairlearnMetricCatalog.cs 88.02% <88.02%> (ø)
src/Microsoft.ML.Fairlearn/FairlearnCatalog.cs 100.00% <100.00%> (ø)
src/Microsoft.ML.Fairlearn/MLContextExtension.cs 100.00% <100.00%> (ø)
...t.ML.Fairlearn/Reductions/GridSearchTrialRunner.cs 100.00% <100.00%> (ø)
... and 4 more

... and 44 files with indirect coverage changes

@LittleLittleCloud LittleLittleCloud merged commit 1dcae10 into dotnet:main May 11, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Jun 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add metadata of bias and fairness metrics to models
3 participants