@@ -766,8 +766,8 @@ def test_pre_training_bias(
766
766
"facet" : [{"name_or_index" : "F1" }],
767
767
"group_variable" : "F2" ,
768
768
"methods" : {
769
- ' report' : {' name' : ' report' , ' title' : ' Analysis Report' },
770
- "pre_training_bias" : {"methods" : "all" }
769
+ " report" : {" name" : " report" , " title" : " Analysis Report" },
770
+ "pre_training_bias" : {"methods" : "all" },
771
771
},
772
772
}
773
773
mock_method .assert_called_with (
@@ -832,8 +832,8 @@ def test_post_training_bias(
832
832
"facet" : [{"name_or_index" : "F1" }],
833
833
"group_variable" : "F2" ,
834
834
"methods" : {
835
- ' report' : {' name' : ' report' , ' title' : ' Analysis Report' },
836
- "post_training_bias" : {"methods" : "all" }
835
+ " report" : {" name" : " report" , " title" : " Analysis Report" },
836
+ "post_training_bias" : {"methods" : "all" },
837
837
},
838
838
"predictor" : {
839
839
"model_name" : "xgboost-model" ,
@@ -993,7 +993,7 @@ def _run_test_explain(
993
993
"top_k_features" : 10 ,
994
994
}
995
995
expected_analysis_config ["methods" ] = {
996
- ' report' : {' name' : ' report' , ' title' : ' Analysis Report' },
996
+ " report" : {" name" : " report" , " title" : " Analysis Report" },
997
997
** expected_explanation_configs ,
998
998
}
999
999
mock_method .assert_called_with (
@@ -1300,43 +1300,49 @@ def test_analysis_config_generator_for_explainability(data_config, model_config)
1300
1300
model_scores ,
1301
1301
SHAPConfig (),
1302
1302
)
1303
- expected = {'dataset_type' : 'text/csv' ,
1304
- 'headers' : ['Label' , 'F1' , 'F2' , 'F3' , 'F4' ],
1305
- 'joinsource_name_or_index' : 'F4' ,
1306
- 'label' : 'Label' ,
1307
- 'methods' : {
1308
- 'report' : {'name' : 'report' , 'title' : 'Analysis Report' },
1309
- 'shap' : {'save_local_shap_values' : True , 'use_logit' : False }
1310
- },
1311
- 'predictor' : {'initial_instance_count' : 1 ,
1312
- 'instance_type' : 'ml.c5.xlarge' ,
1313
- 'label_headers' : ['success' ],
1314
- 'model_name' : 'xgboost-model' ,
1315
- 'probability' : 'pr' }}
1303
+ expected = {
1304
+ "dataset_type" : "text/csv" ,
1305
+ "headers" : ["Label" , "F1" , "F2" , "F3" , "F4" ],
1306
+ "joinsource_name_or_index" : "F4" ,
1307
+ "label" : "Label" ,
1308
+ "methods" : {
1309
+ "report" : {"name" : "report" , "title" : "Analysis Report" },
1310
+ "shap" : {"save_local_shap_values" : True , "use_logit" : False },
1311
+ },
1312
+ "predictor" : {
1313
+ "initial_instance_count" : 1 ,
1314
+ "instance_type" : "ml.c5.xlarge" ,
1315
+ "label_headers" : ["success" ],
1316
+ "model_name" : "xgboost-model" ,
1317
+ "probability" : "pr" ,
1318
+ },
1319
+ }
1316
1320
assert actual == expected
1317
1321
1318
1322
1319
1323
def test_analysis_config_generator_for_bias_pre_training (data_config , data_bias_config ):
1320
1324
actual = _AnalysisConfigGenerator .bias_pre_training (
1321
- data_config ,
1322
- data_bias_config ,
1323
- methods = "all"
1325
+ data_config , data_bias_config , methods = "all"
1324
1326
)
1325
- expected = {'dataset_type' : 'text/csv' ,
1326
- 'facet' : [{'name_or_index' : 'F1' }],
1327
- 'group_variable' : 'F2' ,
1328
- 'headers' : ['Label' , 'F1' , 'F2' , 'F3' , 'F4' ],
1329
- 'joinsource_name_or_index' : 'F4' ,
1330
- 'label' : 'Label' ,
1331
- 'label_values_or_threshold' : [1 ],
1332
- 'methods' : {
1333
- 'report' : {'name' : 'report' , 'title' : 'Analysis Report' },
1334
- 'pre_training_bias' : {'methods' : 'all' }}
1335
- }
1327
+ expected = {
1328
+ "dataset_type" : "text/csv" ,
1329
+ "facet" : [{"name_or_index" : "F1" }],
1330
+ "group_variable" : "F2" ,
1331
+ "headers" : ["Label" , "F1" , "F2" , "F3" , "F4" ],
1332
+ "joinsource_name_or_index" : "F4" ,
1333
+ "label" : "Label" ,
1334
+ "label_values_or_threshold" : [1 ],
1335
+ "methods" : {
1336
+ "report" : {"name" : "report" , "title" : "Analysis Report" },
1337
+ "pre_training_bias" : {"methods" : "all" },
1338
+ },
1339
+ }
1336
1340
assert actual == expected
1337
1341
1338
1342
1339
- def test_analysis_config_generator_for_bias_post_training (data_config , data_bias_config , model_config ):
1343
+ def test_analysis_config_generator_for_bias_post_training (
1344
+ data_config , data_bias_config , model_config
1345
+ ):
1340
1346
model_predicted_label_config = ModelPredictedLabelConfig (
1341
1347
probability = "pr" ,
1342
1348
label_headers = ["success" ],
@@ -1348,22 +1354,26 @@ def test_analysis_config_generator_for_bias_post_training(data_config, data_bias
1348
1354
methods = "all" ,
1349
1355
model_config = model_config ,
1350
1356
)
1351
- expected = {'dataset_type' : 'text/csv' ,
1352
- 'facet' : [{'name_or_index' : 'F1' }],
1353
- 'group_variable' : 'F2' ,
1354
- 'headers' : ['Label' , 'F1' , 'F2' , 'F3' , 'F4' ],
1355
- 'joinsource_name_or_index' : 'F4' ,
1356
- 'label' : 'Label' ,
1357
- 'label_values_or_threshold' : [1 ],
1358
- 'methods' : {
1359
- 'report' : {'name' : 'report' , 'title' : 'Analysis Report' },
1360
- 'post_training_bias' : {'methods' : 'all' }
1361
- },
1362
- 'predictor' : {'initial_instance_count' : 1 ,
1363
- 'instance_type' : 'ml.c5.xlarge' ,
1364
- 'label_headers' : ['success' ],
1365
- 'model_name' : 'xgboost-model' ,
1366
- 'probability' : 'pr' }}
1357
+ expected = {
1358
+ "dataset_type" : "text/csv" ,
1359
+ "facet" : [{"name_or_index" : "F1" }],
1360
+ "group_variable" : "F2" ,
1361
+ "headers" : ["Label" , "F1" , "F2" , "F3" , "F4" ],
1362
+ "joinsource_name_or_index" : "F4" ,
1363
+ "label" : "Label" ,
1364
+ "label_values_or_threshold" : [1 ],
1365
+ "methods" : {
1366
+ "report" : {"name" : "report" , "title" : "Analysis Report" },
1367
+ "post_training_bias" : {"methods" : "all" },
1368
+ },
1369
+ "predictor" : {
1370
+ "initial_instance_count" : 1 ,
1371
+ "instance_type" : "ml.c5.xlarge" ,
1372
+ "label_headers" : ["success" ],
1373
+ "model_name" : "xgboost-model" ,
1374
+ "probability" : "pr" ,
1375
+ },
1376
+ }
1367
1377
assert actual == expected
1368
1378
1369
1379
@@ -1380,20 +1390,25 @@ def test_analysis_config_generator_for_bias(data_config, data_bias_config, model
1380
1390
pre_training_methods = "all" ,
1381
1391
post_training_methods = "all" ,
1382
1392
)
1383
- expected = {'dataset_type' : 'text/csv' ,
1384
- 'facet' : [{'name_or_index' : 'F1' }],
1385
- 'group_variable' : 'F2' ,
1386
- 'headers' : ['Label' , 'F1' , 'F2' , 'F3' , 'F4' ],
1387
- 'joinsource_name_or_index' : 'F4' ,
1388
- 'label' : 'Label' ,
1389
- 'label_values_or_threshold' : [1 ],
1390
- 'methods' : {
1391
- 'report' : {'name' : 'report' , 'title' : 'Analysis Report' },
1392
- 'post_training_bias' : {'methods' : 'all' },
1393
- 'pre_training_bias' : {'methods' : 'all' }},
1394
- 'predictor' : {'initial_instance_count' : 1 ,
1395
- 'instance_type' : 'ml.c5.xlarge' ,
1396
- 'label_headers' : ['success' ],
1397
- 'model_name' : 'xgboost-model' ,
1398
- 'probability' : 'pr' }}
1393
+ expected = {
1394
+ "dataset_type" : "text/csv" ,
1395
+ "facet" : [{"name_or_index" : "F1" }],
1396
+ "group_variable" : "F2" ,
1397
+ "headers" : ["Label" , "F1" , "F2" , "F3" , "F4" ],
1398
+ "joinsource_name_or_index" : "F4" ,
1399
+ "label" : "Label" ,
1400
+ "label_values_or_threshold" : [1 ],
1401
+ "methods" : {
1402
+ "report" : {"name" : "report" , "title" : "Analysis Report" },
1403
+ "post_training_bias" : {"methods" : "all" },
1404
+ "pre_training_bias" : {"methods" : "all" },
1405
+ },
1406
+ "predictor" : {
1407
+ "initial_instance_count" : 1 ,
1408
+ "instance_type" : "ml.c5.xlarge" ,
1409
+ "label_headers" : ["success" ],
1410
+ "model_name" : "xgboost-model" ,
1411
+ "probability" : "pr" ,
1412
+ },
1413
+ }
1399
1414
assert actual == expected
0 commit comments