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

DOC simplify plot_grid_search_census example #1190

Open
romanlutz opened this issue Jan 20, 2023 · 3 comments
Open

DOC simplify plot_grid_search_census example #1190

romanlutz opened this issue Jan 20, 2023 · 3 comments

Comments

@romanlutz
Copy link
Member

Describe the issue linked to the documentation

The example at https://fairlearn.org/main/auto_examples/plot_grid_search_census.html is outright painful to read at the end, starting after

predictors = sweep.predictors_

and ending with the plot. We now have plot_model_comparison that can take care of all that. The filtering for non-dominated may require a little extra code, but we shouldn't have to mess around with moments like

error = ErrorRate()
error.load_data(X_train), pd.Series(Y_train), sensitive_features=A_train)
disparity = DemographicParity()
disparity.load_data(X_train), pd.Series(Y_train), sensitive_features=A_train)
errors.append(error.gamma(classifier)[0])
disparities.append(disparity.gamma(classifier).max()

Suggest a potential alternative/fix

Use

accuracy_score

and

make_derived_metric(metric=selection_rate, transform="difference")

to get the error and selection rate differences (called disparities above). Use plot_model_comparison rather than creating the plot from scratch.

@MiroDudik
Copy link
Member

don't use make_derived_metric, but instead use demographic_parity_difference.

@romanlutz
Copy link
Member Author

Sure. They are equivalent, though, right? I'm guessing you're pointing it out to make people aware of the shorthand?

@MiroDudik
Copy link
Member

i think it is simpler to use existing metrics when they are available. it's also more concise--more obvious what's going on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants