Skip to content

Commit 787ba73

Browse files
committed
FP-test-set notebook
1 parent 6bcf692 commit 787ba73

File tree

5 files changed

+9506
-7243
lines changed

5 files changed

+9506
-7243
lines changed

notebooks/unsupervised bias detection tool/COMPAS_FP.ipynb

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@
597597
},
598598
{
599599
"cell_type": "code",
600-
"execution_count": 5,
600+
"execution_count": 6,
601601
"metadata": {},
602602
"outputs": [
603603
{
@@ -694,7 +694,7 @@
694694
"4 0.0 1.0 5.0 0.0 0.0 0.0 0.0"
695695
]
696696
},
697-
"execution_count": 5,
697+
"execution_count": 6,
698698
"metadata": {},
699699
"output_type": "execute_result"
700700
}
@@ -710,7 +710,7 @@
710710
},
711711
{
712712
"cell_type": "code",
713-
"execution_count": 6,
713+
"execution_count": 7,
714714
"metadata": {},
715715
"outputs": [
716716
{
@@ -726,7 +726,7 @@
726726
"dtype: object"
727727
]
728728
},
729-
"execution_count": 6,
729+
"execution_count": 7,
730730
"metadata": {},
731731
"output_type": "execute_result"
732732
}
@@ -737,7 +737,7 @@
737737
},
738738
{
739739
"cell_type": "code",
740-
"execution_count": 7,
740+
"execution_count": null,
741741
"metadata": {},
742742
"outputs": [
743743
{
@@ -750,7 +750,8 @@
750750
],
751751
"source": [
752752
"# Create a dataframe from filtered_df except the bias metric column\n",
753-
"df_no_bias_metric = filtered_df.drop(columns=[\"false_positive\"])\n",
753+
"bias_metric = \"false_positive\"\n",
754+
"df_no_bias_metric = filtered_df.drop(columns=[bias_metric])\n",
754755
"if df_no_bias_metric.dtypes.nunique() == 1:\n",
755756
" print('consistent data')\n",
756757
"else:\n",
@@ -766,7 +767,7 @@
766767
},
767768
{
768769
"cell_type": "code",
769-
"execution_count": 8,
770+
"execution_count": 9,
770771
"metadata": {},
771772
"outputs": [
772773
{
@@ -786,7 +787,7 @@
786787
},
787788
{
788789
"cell_type": "code",
789-
"execution_count": 9,
790+
"execution_count": 10,
790791
"metadata": {},
791792
"outputs": [
792793
{
@@ -844,7 +845,7 @@
844845
},
845846
{
846847
"cell_type": "code",
847-
"execution_count": 10,
848+
"execution_count": null,
848849
"metadata": {},
849850
"outputs": [
850851
{
@@ -858,7 +859,6 @@
858859
],
859860
"source": [
860861
"# split the data into training and testing sets\n",
861-
"bias_metric = \"false_positive\"\n",
862862
"train_df, test_df = train_test_split(filtered_df, test_size=0.2, random_state=42)\n",
863863
"X_train = train_df.drop(columns=[bias_metric])\n",
864864
"\n",
@@ -896,7 +896,7 @@
896896
},
897897
{
898898
"cell_type": "code",
899-
"execution_count": 11,
899+
"execution_count": 12,
900900
"metadata": {},
901901
"outputs": [
902902
{
@@ -1331,7 +1331,7 @@
13311331
"BiasAwareHierarchicalKModes(bahc_max_iter=20, bahc_min_cluster_size=57.71)"
13321332
]
13331333
},
1334-
"execution_count": 11,
1334+
"execution_count": 12,
13351335
"metadata": {},
13361336
"output_type": "execute_result"
13371337
}
@@ -1344,7 +1344,7 @@
13441344
},
13451345
{
13461346
"cell_type": "code",
1347-
"execution_count": 12,
1347+
"execution_count": 13,
13481348
"metadata": {},
13491349
"outputs": [
13501350
{
@@ -1353,7 +1353,7 @@
13531353
"5"
13541354
]
13551355
},
1356-
"execution_count": 12,
1356+
"execution_count": 13,
13571357
"metadata": {},
13581358
"output_type": "execute_result"
13591359
}
@@ -1365,7 +1365,7 @@
13651365
},
13661366
{
13671367
"cell_type": "code",
1368-
"execution_count": 13,
1368+
"execution_count": 14,
13691369
"metadata": {},
13701370
"outputs": [
13711371
{
@@ -1374,7 +1374,7 @@
13741374
"array([ 0.05290941, -0.02457072, -0.04827102, -0.04888889, -0.05093596])"
13751375
]
13761376
},
1377-
"execution_count": 13,
1377+
"execution_count": 14,
13781378
"metadata": {},
13791379
"output_type": "execute_result"
13801380
}
@@ -1386,7 +1386,7 @@
13861386
},
13871387
{
13881388
"cell_type": "code",
1389-
"execution_count": 14,
1389+
"execution_count": 15,
13901390
"metadata": {},
13911391
"outputs": [
13921392
{
@@ -1417,7 +1417,7 @@
14171417
},
14181418
{
14191419
"cell_type": "code",
1420-
"execution_count": 15,
1420+
"execution_count": 16,
14211421
"metadata": {},
14221422
"outputs": [
14231423
{
@@ -1426,7 +1426,7 @@
14261426
"array([0, 0, 4, ..., 0, 0, 1], dtype=uint32)"
14271427
]
14281428
},
1429-
"execution_count": 15,
1429+
"execution_count": 16,
14301430
"metadata": {},
14311431
"output_type": "execute_result"
14321432
}
@@ -1439,7 +1439,7 @@
14391439
},
14401440
{
14411441
"cell_type": "code",
1442-
"execution_count": 16,
1442+
"execution_count": 17,
14431443
"metadata": {},
14441444
"outputs": [
14451445
{
@@ -1618,7 +1618,7 @@
16181618
"[1443 rows x 7 columns]"
16191619
]
16201620
},
1621-
"execution_count": 16,
1621+
"execution_count": 17,
16221622
"metadata": {},
16231623
"output_type": "execute_result"
16241624
}
@@ -1642,7 +1642,7 @@
16421642
},
16431643
{
16441644
"cell_type": "code",
1645-
"execution_count": 17,
1645+
"execution_count": 18,
16461646
"metadata": {},
16471647
"outputs": [
16481648
{
@@ -1752,7 +1752,7 @@
17521752
"4 0 0 0 "
17531753
]
17541754
},
1755-
"execution_count": 17,
1755+
"execution_count": 18,
17561756
"metadata": {},
17571757
"output_type": "execute_result"
17581758
}
@@ -1776,7 +1776,7 @@
17761776
},
17771777
{
17781778
"cell_type": "code",
1779-
"execution_count": 18,
1779+
"execution_count": 19,
17801780
"metadata": {},
17811781
"outputs": [],
17821782
"source": [
@@ -1787,7 +1787,7 @@
17871787
},
17881788
{
17891789
"cell_type": "code",
1790-
"execution_count": 19,
1790+
"execution_count": 20,
17911791
"metadata": {},
17921792
"outputs": [
17931793
{
@@ -1842,7 +1842,7 @@
18421842
},
18431843
{
18441844
"cell_type": "code",
1845-
"execution_count": 20,
1845+
"execution_count": 21,
18461846
"metadata": {},
18471847
"outputs": [
18481848
{
@@ -1906,7 +1906,7 @@
19061906
},
19071907
{
19081908
"cell_type": "code",
1909-
"execution_count": 33,
1909+
"execution_count": 22,
19101910
"metadata": {
19111911
"vscode": {
19121912
"languageId": "ruby"
@@ -1970,7 +1970,7 @@
19701970
},
19711971
{
19721972
"cell_type": "code",
1973-
"execution_count": 32,
1973+
"execution_count": 23,
19741974
"metadata": {
19751975
"vscode": {
19761976
"languageId": "ruby"

0 commit comments

Comments
 (0)