Skip to content

Commit 9f8a784

Browse files
committed
Add AOD explanation
1 parent deba7a7 commit 9f8a784

File tree

1 file changed

+21
-32
lines changed

1 file changed

+21
-32
lines changed

examples/Group fairness metrics.ipynb

Lines changed: 21 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -519,12 +519,24 @@
519519
"id": "7e9ca225",
520520
"metadata": {},
521521
"source": [
522-
"# Average Odds Difference"
522+
"## Average Odds Difference\n",
523+
"\n",
524+
"_Average Odds Difference_ measures the difference between the True Positive Rates ($TPR$) for the privileged and unprivileged groups, and the False Positive Rates ($FPR$) for the same groups. Formally, the definition is:\n",
525+
"\n",
526+
"$$\n",
527+
"AOD=\\dfrac{(FPR_{u}-FPR_{p})+(TPR_{u}-TPR_{p})}{2}\n",
528+
"$$\n",
529+
"\n",
530+
"Typically:\n",
531+
"\n",
532+
"- A fair model will have $AOD=0$\n",
533+
"- A positive value indicates the model benefits the unprivileged group\n",
534+
"- A negative value indicates the model benefits the privileged group"
523535
]
524536
},
525537
{
526538
"cell_type": "code",
527-
"execution_count": 18,
539+
"execution_count": 22,
528540
"id": "50814c63",
529541
"metadata": {},
530542
"outputs": [],
@@ -533,14 +545,14 @@
533545
"\n",
534546
"score = average_odds_difference(test=bias,\n",
535547
" truth=nobias,\n",
536-
" privilege_columns=[2],\n",
537-
" privilege_values=[1],\n",
538-
" positive_class=[1])"
548+
" privilege_columns=[\"gender\"],\n",
549+
" privilege_values=[1], # privileged gender value, gender = 1\n",
550+
" positive_class=[1]) # positive class, income = 1"
539551
]
540552
},
541553
{
542554
"cell_type": "code",
543-
"execution_count": 19,
555+
"execution_count": 23,
544556
"id": "cedbd492",
545557
"metadata": {},
546558
"outputs": [
@@ -557,36 +569,13 @@
557569
]
558570
},
559571
{
560-
"cell_type": "code",
561-
"execution_count": 20,
562-
"id": "00232e97",
572+
"cell_type": "markdown",
573+
"id": "3568343c-523d-4a37-b534-e7ae2bf01406",
563574
"metadata": {},
564-
"outputs": [
565-
{
566-
"name": "stdout",
567-
"output_type": "stream",
568-
"text": [
569-
"0.12220095246218571\n"
570-
]
571-
}
572-
],
573575
"source": [
574-
"score = average_odds_difference(test=bias,\n",
575-
" truth=nobias,\n",
576-
" privilege_columns=[2],\n",
577-
" privilege_values=[0],\n",
578-
" positive_class=[1])\n",
579-
"print(score)"
576+
"As we can see, the $AOD$ indicates that the privileged group (`gender = 1`) is at an advantage in this model."
580577
]
581578
},
582-
{
583-
"cell_type": "code",
584-
"execution_count": null,
585-
"id": "0e7d4026",
586-
"metadata": {},
587-
"outputs": [],
588-
"source": []
589-
},
590579
{
591580
"cell_type": "markdown",
592581
"id": "74cf44c7",

0 commit comments

Comments
 (0)