diff --git a/.gitignore b/.gitignore index ae0dd4328..3a3290772 100644 --- a/.gitignore +++ b/.gitignore @@ -66,6 +66,7 @@ instance/ # Sphinx documentation docs/_build/ docs/auto_examples/ +docs/sg_execution_times.rst # PyBuilder target/ diff --git a/docs/refs.bib b/docs/refs.bib index 3b26f6684..45bd93b8b 100644 --- a/docs/refs.bib +++ b/docs/refs.bib @@ -846,11 +846,3 @@ @misc{sykes2020boston title={- B 1000(Bk - 0.63)^2 where Bk is the proportion of blacks by town}, url={https://github.com/scikit-learn/scikit-learn/issues/16155} } - -@misc{carlisle2019racist, - author={M Carlisle}, - title={racist data destruction?}, - publisher={Medium}, - year={2019}, - url={https://medium.com/@docintangible/racist-data-destruction-113e3eff54a8} -} \ No newline at end of file diff --git a/examples/plot_grid_search_census.py b/examples/plot_grid_search_census.py index 7a26d188d..da9d2f807 100644 --- a/examples/plot_grid_search_census.py +++ b/examples/plot_grid_search_census.py @@ -189,7 +189,7 @@ def classifier(X): disparity = DemographicParity() disparity.load_data(X_train, pd.Series(Y_train), sensitive_features=A_train) - errors.append(error.gamma(classifier)[0]) + errors.append(error.gamma(classifier).iloc[0]) disparities.append(disparity.gamma(classifier).max()) all_results = pd.DataFrame( diff --git a/examples/plot_intersectional_bias.py b/examples/plot_intersectional_bias.py index a9bf34c9a..9079f0035 100644 --- a/examples/plot_intersectional_bias.py +++ b/examples/plot_intersectional_bias.py @@ -1212,7 +1212,7 @@ def intersectionalf(truelabels, predictions): test["Diagnosis"] = test["Diagnosis"].astype(int) # Create new intersect column for plotting -test["intersect"] = np.nan +test["intersect"] = "" test.loc[(test["Sex"] == "Male") & (test["Race"] == "White"), "intersect"] = "WhiteM" test.loc[(test["Sex"] == "Male") & (test["Race"] == "Black"), "intersect"] = "BlackM" test.loc[(test["Sex"] == "Male") & (test["Race"] == "Hispanic"), "intersect"] = "HispanicM" diff --git a/fairlearn/metrics/_plotter.py b/fairlearn/metrics/_plotter.py index 0080af085..c705a4765 100644 --- a/fairlearn/metrics/_plotter.py +++ b/fairlearn/metrics/_plotter.py @@ -263,16 +263,16 @@ def plot_metric_frame( for i in range(len(temp_axs[j].patches)): temp_axs[j].text( i, - df_all_bounds[metric][i][0] - 0.05 * y_range, - round(df_all_bounds[metric][i][0], ci_labels_precision), + df_all_bounds[metric].iloc[i][0] - 0.05 * y_range, + round(df_all_bounds[metric].iloc[i][0], ci_labels_precision), fontsize=ci_labels_fontsize, color=ci_labels_color, ha=ci_labels_ha, ) temp_axs[j].text( i, - df_all_bounds[metric][i][1] + 0.01 * y_range, - round(df_all_bounds[metric][i][1], ci_labels_precision), + df_all_bounds[metric].iloc[i][1] + 0.01 * y_range, + round(df_all_bounds[metric].iloc[i][1], ci_labels_precision), fontsize=ci_labels_fontsize, color=ci_labels_color, ha=ci_labels_ha, diff --git a/fairlearn/reductions/_moments/error_rate.py b/fairlearn/reductions/_moments/error_rate.py index ab390d5d4..35543238a 100644 --- a/fairlearn/reductions/_moments/error_rate.py +++ b/fairlearn/reductions/_moments/error_rate.py @@ -73,7 +73,7 @@ def load_data(self, X, y, *, sensitive_features, control_features=None): super().load_data(X, y_train, sensitive_features=sf_train) self.index = [_ALL] - def gamma(self, predictor): + def gamma(self, predictor) -> pd.Series: """Return the gamma values for the given predictor.""" pred = predictor(self.X) if isinstance(pred, np.ndarray):