|
24 | 24 | ModelPredictedLabelConfig,
|
25 | 25 | SHAPConfig,
|
26 | 26 | )
|
27 |
| -from sagemaker import image_uris |
| 27 | +from sagemaker import image_uris, Processor |
28 | 28 |
|
29 | 29 | JOB_NAME_PREFIX = "my-prefix"
|
30 | 30 | TIMESTAMP = "2021-06-17-22-29-54-685"
|
@@ -499,6 +499,59 @@ def test_post_training_bias(
|
499 | 499 | )
|
500 | 500 |
|
501 | 501 |
|
| 502 | +@patch.object(Processor, "run") |
| 503 | +def test_run_on_s3_analysis_config_file( |
| 504 | + processor_run, sagemaker_session, clarify_processor, data_config |
| 505 | +): |
| 506 | + analysis_config = { |
| 507 | + "methods": {"post_training_bias": {"methods": "all"}}, |
| 508 | + } |
| 509 | + with patch("sagemaker.clarify._upload_analysis_config", return_value=None) as mock_method: |
| 510 | + clarify_processor._run( |
| 511 | + data_config, |
| 512 | + analysis_config, |
| 513 | + True, |
| 514 | + True, |
| 515 | + "test", |
| 516 | + None, |
| 517 | + {"ExperimentName": "AnExperiment"}, |
| 518 | + ) |
| 519 | + analysis_config_file = mock_method.call_args[0][0] |
| 520 | + mock_method.assert_called_with( |
| 521 | + analysis_config_file, data_config.s3_output_path, sagemaker_session, None |
| 522 | + ) |
| 523 | + |
| 524 | + data_config_with_analysis_config_output = DataConfig( |
| 525 | + s3_data_input_path="s3://input/train.csv", |
| 526 | + s3_output_path="s3://output/analysis_test_result", |
| 527 | + s3_analysis_config_output_path="s3://analysis_config_output", |
| 528 | + label="Label", |
| 529 | + headers=[ |
| 530 | + "Label", |
| 531 | + "F1", |
| 532 | + "F2", |
| 533 | + "F3", |
| 534 | + ], |
| 535 | + dataset_type="text/csv", |
| 536 | + ) |
| 537 | + clarify_processor._run( |
| 538 | + data_config_with_analysis_config_output, |
| 539 | + analysis_config, |
| 540 | + True, |
| 541 | + True, |
| 542 | + "test", |
| 543 | + None, |
| 544 | + {"ExperimentName": "AnExperiment"}, |
| 545 | + ) |
| 546 | + analysis_config_file = mock_method.call_args[0][0] |
| 547 | + mock_method.assert_called_with( |
| 548 | + analysis_config_file, |
| 549 | + data_config_with_analysis_config_output.s3_analysis_config_output_path, |
| 550 | + sagemaker_session, |
| 551 | + None, |
| 552 | + ) |
| 553 | + |
| 554 | + |
502 | 555 | def _run_test_shap(
|
503 | 556 | name_from_base,
|
504 | 557 | clarify_processor,
|
|
0 commit comments