@@ -766,8 +766,8 @@ def test_pre_training_bias(
766766 "facet" : [{"name_or_index" : "F1" }],
767767 "group_variable" : "F2" ,
768768 "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" },
771771 },
772772 }
773773 mock_method .assert_called_with (
@@ -832,8 +832,8 @@ def test_post_training_bias(
832832 "facet" : [{"name_or_index" : "F1" }],
833833 "group_variable" : "F2" ,
834834 "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" },
837837 },
838838 "predictor" : {
839839 "model_name" : "xgboost-model" ,
@@ -993,7 +993,7 @@ def _run_test_explain(
993993 "top_k_features" : 10 ,
994994 }
995995 expected_analysis_config ["methods" ] = {
996- ' report' : {' name' : ' report' , ' title' : ' Analysis Report' },
996+ " report" : {" name" : " report" , " title" : " Analysis Report" },
997997 ** expected_explanation_configs ,
998998 }
999999 mock_method .assert_called_with (
@@ -1300,43 +1300,49 @@ def test_analysis_config_generator_for_explainability(data_config, model_config)
13001300 model_scores ,
13011301 SHAPConfig (),
13021302 )
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+ }
13161320 assert actual == expected
13171321
13181322
13191323def test_analysis_config_generator_for_bias_pre_training (data_config , data_bias_config ):
13201324 actual = _AnalysisConfigGenerator .bias_pre_training (
1321- data_config ,
1322- data_bias_config ,
1323- methods = "all"
1325+ data_config , data_bias_config , methods = "all"
13241326 )
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+ }
13361340 assert actual == expected
13371341
13381342
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+ ):
13401346 model_predicted_label_config = ModelPredictedLabelConfig (
13411347 probability = "pr" ,
13421348 label_headers = ["success" ],
@@ -1348,22 +1354,26 @@ def test_analysis_config_generator_for_bias_post_training(data_config, data_bias
13481354 methods = "all" ,
13491355 model_config = model_config ,
13501356 )
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+ }
13671377 assert actual == expected
13681378
13691379
@@ -1380,20 +1390,25 @@ def test_analysis_config_generator_for_bias(data_config, data_bias_config, model
13801390 pre_training_methods = "all" ,
13811391 post_training_methods = "all" ,
13821392 )
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+ }
13991414 assert actual == expected
0 commit comments