fairlearn/fairlearn

DOC simplify plot_grid_search_census example

Open

#1,190 opened on 2023年1月20日

GitHub で見る
 (4 comments) (0 reactions) (0 assignees)Python (504 forks)auto 404
documentationhelp wanted

Repository metrics

Stars
 (2,254 stars)
PR merge metrics
 (PR metrics pending)

説明

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.

コントリビューターガイド