fairlearn/fairlearn

DOC simplify plot_grid_search_census example

Open

#1.190 geöffnet am 20. Jan. 2023

Auf GitHub ansehen
 (4 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)Python (504 Forks)auto 404
documentationhelp wanted

Repository-Metriken

Stars
 (2.254 Stars)
PR-Merge-Metriken
 (PR-Metriken ausstehend)

Beschreibung

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.

Contributor Guide