Skip to content

Commit

Permalink
Score card add fairness for classification notebook
Browse files Browse the repository at this point in the history
  • Loading branch information
kicha0 committed Nov 2, 2022
1 parent 345364c commit 5f0121b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
" return X, y\n",
"\n",
"target_feature = 'Sold_HigherThan_Median'\n",
"categorical_features = []\n",
"categorical_features = [\"OverallQual\", \"OverallCond\"]\n",
"\n",
"all_data = pd.read_csv(data_path)\n",
"all_data = all_data.drop(['SalePrice','SalePriceK'], axis=1)\n",
Expand Down Expand Up @@ -660,6 +660,11 @@
" \"threshold\": \">=0.7\"\n",
" },\n",
" \"precision_score\": {}\n",
" },\n",
" \"Fairness\": {\n",
" \"metric\": [\"accuracy_score\"],\n",
" \"sensitive_features\": [\"OverallQual\", \"OverallCond\"],\n",
" \"fairness_evaluation_kind\": \"ratio\"\n",
" }\n",
"}\n",
"\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -357,11 +357,11 @@ def get_fairness_bar_plot(data):
]
x_data = [
100 * (get_metric(
"selection_rate",
data[c]["y_test"],
data[c]["y_pred"]),
data[c]["pos_label"]
)
metric="selection_rate",
y_test=data[c]["y_test"],
y_pred=data[c]["y_pred"],
pos_label=data[c]["pos_label"]
))
for c in data
]
x_data = [[x, 100 - x] for x in x_data]
Expand Down

0 comments on commit 5f0121b

Please sign in to comment.