|
593 | 593 | "source": [
|
594 | 594 | "from lale.lib.aif360 import fair_stratified_train_test_split\n",
|
595 | 595 | "train_X, test_X, train_y, test_y = fair_stratified_train_test_split(\n",
|
596 |
| - " all_X, all_y, **fairness_info, test_size=0.33)" |
| 596 | + " all_X, all_y, **fairness_info, test_size=0.33, random_state=42)" |
597 | 597 | ]
|
598 | 598 | },
|
599 | 599 | {
|
|
1093 | 1093 | "In the visualization, light blue indicates trainable operators\n",
|
1094 | 1094 | "and dark blue indicates that automation must make a choice before\n",
|
1095 | 1095 | "the operators can be trained. Compared to the earlier pipeline,\n",
|
1096 |
| - "we pass the preprocessing as an argument to `DisparateImpactRemover`,\n", |
| 1096 | + "we pass the data preparation sub-pipeline as an argument to `DisparateImpactRemover`,\n", |
1097 | 1097 | "since that fairness mitigator needs numerical data to work on."
|
1098 | 1098 | ]
|
1099 | 1099 | },
|
|
1120 | 1120 | "</a>\n",
|
1121 | 1121 | "</g>\n",
|
1122 | 1122 | "<g id=\"clust1\" class=\"cluster\"><title>cluster:disparate_impact_remover</title>\n",
|
1123 |
| - "<g id=\"a_clust1\"><a xlink:href=\"https://lale.readthedocs.io/en/latest/modules/lale.lib.aif360.disparate_impact_remover.html\" xlink:title=\"disparate_impact_remover = DisparateImpactRemover(favorable_labels=['good'], protected_attributes=[{'feature': 'personal_status', 'privileged_groups': ['male div/sep', 'male mar/wid', 'male single']}, {'feature': 'age', 'privileged_groups': [[26, 1000]]}], preprocessing=pipeline_0)\">\n", |
| 1123 | + "<g id=\"a_clust1\"><a xlink:href=\"https://lale.readthedocs.io/en/latest/modules/lale.lib.aif360.disparate_impact_remover.html\" xlink:title=\"disparate_impact_remover = DisparateImpactRemover(favorable_labels=['good'], protected_attributes=[{'feature': 'personal_status', 'privileged_groups': ['male div/sep', 'male mar/wid', 'male single']}, {'feature': 'age', 'privileged_groups': [[26, 1000]]}], preparation=pipeline_0)\">\n", |
1124 | 1124 | "<polygon fill=\"#b0e2ff\" stroke=\"black\" points=\"8,-59 8,-213 296.108,-213 296.108,-59 8,-59\"/>\n",
|
1125 | 1125 | "<text text-anchor=\"middle\" x=\"152.054\" y=\"-197.8\" font-family=\"Times,serif\" font-size=\"14.00\">DisparateImpactRemover</text>\n",
|
1126 | 1126 | "</a>\n",
|
|
1231 | 1231 | ],
|
1232 | 1232 | "source": [
|
1233 | 1233 | "di_remover = DisparateImpactRemover(\n",
|
1234 |
| - " **fairness_info, preprocessing=prep_to_numbers)\n", |
| 1234 | + " **fairness_info, preparation=prep_to_numbers)\n", |
1235 | 1235 | "planned_fairer = di_remover >> (LR | Tree | KNN)\n",
|
1236 | 1236 | "planned_fairer.visualize()"
|
1237 | 1237 | ]
|
|
1347 | 1347 | "</a>\n",
|
1348 | 1348 | "</g>\n",
|
1349 | 1349 | "<g id=\"clust1\" class=\"cluster\"><title>cluster:disparate_impact_remover</title>\n",
|
1350 |
| - "<g id=\"a_clust1\"><a xlink:href=\"https://lale.readthedocs.io/en/latest/modules/lale.lib.aif360.disparate_impact_remover.html\" xlink:title=\"disparate_impact_remover = DisparateImpactRemover(favorable_labels=['good'], protected_attributes=[{'feature': 'personal_status', 'privileged_groups': ['male div/sep', 'male mar/wid', 'male single']}, {'feature': 'age', 'privileged_groups': [[26, 1000]]}], preprocessing=pipeline_0, repair_level=0.8641...)\">\n", |
| 1350 | + "<g id=\"a_clust1\"><a xlink:href=\"https://lale.readthedocs.io/en/latest/modules/lale.lib.aif360.disparate_impact_remover.html\" xlink:title=\"disparate_impact_remover = DisparateImpactRemover(favorable_labels=['good'], protected_attributes=[{'feature': 'personal_status', 'privileged_groups': ['male div/sep', 'male mar/wid', 'male single']}, {'feature': 'age', 'privileged_groups': [[26, 1000]]}], preparation=pipeline_0, repair_level=0.8641...)\">\n", |
1351 | 1351 | "<polygon fill=\"white\" stroke=\"black\" points=\"8,-8 8,-162 296.108,-162 296.108,-8 8,-8\"/>\n",
|
1352 | 1352 | "<text text-anchor=\"middle\" x=\"152.054\" y=\"-146.8\" font-family=\"Times,serif\" font-size=\"14.00\">DisparateImpactRemover</text>\n",
|
1353 | 1353 | "</a>\n",
|
|
1472 | 1472 | " },\n",
|
1473 | 1473 | " {\"feature\": \"age\", \"privileged_groups\": [[26, 1000]]},\n",
|
1474 | 1474 | " ],\n",
|
1475 |
| - " preprocessing=((project >> one_hot_encoder) & project_0)\n", |
| 1475 | + " preparation=((project >> one_hot_encoder) & project_0)\n", |
1476 | 1476 | " >> ConcatFeatures(),\n",
|
1477 | 1477 | " repair_level=0.8641279154649505,\n",
|
1478 | 1478 | ")\n",
|
|
0 commit comments