298178ce60c17dce5044964e2221461b94f499a4,tests/attacks/inference/test_membership_inference.py,,test_black_box_image,#Any#Any#,91
Before Change
for classifier in classifier_list:
attack = MembershipInferenceBlackBox(classifier)
// train attack model using only attack_train_ratio of data
attack.fit(x_train[:attack_train_size], y_train[:attack_train_size],
x_test[:attack_test_size], y_test[:attack_test_size])
// infer attacked feature on remainder of data
inferred_train = attack.infer(x_train[attack_train_size:], y_train[attack_train_size:])
inferred_test = attack.infer(x_test[attack_test_size:], y_test[attack_test_size:])
// check accuracy
train_pos = sum(inferred_train) / len(inferred_train)
test_pos = sum(inferred_test) / len(inferred_test)
assert (train_pos > test_pos or
train_pos == pytest.approx(test_pos, abs=0.03) or
test_pos == 1)
After Change
for classifier in classifier_list:
attack = MembershipInferenceBlackBox(classifier)
backend_check_membership_accuracy(attack, get_default_mnist_subset, attack_train_ratio, 0.03)
@pytest.mark.parametrize("model_type", ["nn", "rf", "gb"])
def test_black_box_tabular(model_type, get_tabular_classifier_list, get_iris_dataset):
In pattern: SUPERPATTERN
Frequency: 4
Non-data size: 31
Instances
Project Name: IBM/adversarial-robustness-toolbox
Commit Name: 298178ce60c17dce5044964e2221461b94f499a4
Time: 2020-08-25
Author: abigailt@il.ibm.com
File Name: tests/attacks/inference/test_membership_inference.py
Class Name:
Method Name: test_black_box_image
Project Name: IBM/adversarial-robustness-toolbox
Commit Name: 298178ce60c17dce5044964e2221461b94f499a4
Time: 2020-08-25
Author: abigailt@il.ibm.com
File Name: tests/attacks/inference/test_membership_inference.py
Class Name:
Method Name: test_black_box_image
Project Name: IBM/adversarial-robustness-toolbox
Commit Name: 298178ce60c17dce5044964e2221461b94f499a4
Time: 2020-08-25
Author: abigailt@il.ibm.com
File Name: tests/attacks/inference/test_membership_inference.py
Class Name:
Method Name: test_black_box_tabular_gb
Project Name: IBM/adversarial-robustness-toolbox
Commit Name: 298178ce60c17dce5044964e2221461b94f499a4
Time: 2020-08-25
Author: abigailt@il.ibm.com
File Name: tests/attacks/inference/test_membership_inference.py
Class Name:
Method Name: test_black_box_tabular_rf
Project Name: IBM/adversarial-robustness-toolbox
Commit Name: 298178ce60c17dce5044964e2221461b94f499a4
Time: 2020-08-25
Author: abigailt@il.ibm.com
File Name: tests/attacks/inference/test_membership_inference.py
Class Name:
Method Name: test_black_box_with_model