|
519 | 519 | "id": "7e9ca225",
|
520 | 520 | "metadata": {},
|
521 | 521 | "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" |
523 | 535 | ]
|
524 | 536 | },
|
525 | 537 | {
|
526 | 538 | "cell_type": "code",
|
527 |
| - "execution_count": 18, |
| 539 | + "execution_count": 22, |
528 | 540 | "id": "50814c63",
|
529 | 541 | "metadata": {},
|
530 | 542 | "outputs": [],
|
|
533 | 545 | "\n",
|
534 | 546 | "score = average_odds_difference(test=bias,\n",
|
535 | 547 | " 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" |
539 | 551 | ]
|
540 | 552 | },
|
541 | 553 | {
|
542 | 554 | "cell_type": "code",
|
543 |
| - "execution_count": 19, |
| 555 | + "execution_count": 23, |
544 | 556 | "id": "cedbd492",
|
545 | 557 | "metadata": {},
|
546 | 558 | "outputs": [
|
|
557 | 569 | ]
|
558 | 570 | },
|
559 | 571 | {
|
560 |
| - "cell_type": "code", |
561 |
| - "execution_count": 20, |
562 |
| - "id": "00232e97", |
| 572 | + "cell_type": "markdown", |
| 573 | + "id": "3568343c-523d-4a37-b534-e7ae2bf01406", |
563 | 574 | "metadata": {},
|
564 |
| - "outputs": [ |
565 |
| - { |
566 |
| - "name": "stdout", |
567 |
| - "output_type": "stream", |
568 |
| - "text": [ |
569 |
| - "0.12220095246218571\n" |
570 |
| - ] |
571 |
| - } |
572 |
| - ], |
573 | 575 | "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." |
580 | 577 | ]
|
581 | 578 | },
|
582 |
| - { |
583 |
| - "cell_type": "code", |
584 |
| - "execution_count": null, |
585 |
| - "id": "0e7d4026", |
586 |
| - "metadata": {}, |
587 |
| - "outputs": [], |
588 |
| - "source": [] |
589 |
| - }, |
590 | 579 | {
|
591 | 580 | "cell_type": "markdown",
|
592 | 581 | "id": "74cf44c7",
|
|
0 commit comments