f8a5a458ff6a35e91ae9d705160d73cdcc8adf97,test.py,,,#,13

Before Change


for eps in range(1, 11):
    X = np.load(ADV_PATH + "eps%.2f_train.npy" % (eps/10))

    scores = model.evaluate(X, Y_train, verbose=args.verbose)
    v_print("\naccuracy on train adversarial with  %.2f eps: %.2f%%" % (eps/10, scores[1] * 100))

    X = np.load(ADV_PATH + "eps%.2f_test.npy" % (eps/10))

After Change


// get adversarial examples
ADV_PATH = os.path.join(DATA_PATH, "adversarial", "mnist")

for filepath in get_npy_files(ADV_PATH):

    X = np.load(filepath)
    Y = Y_train if "_train" in filepath else Y_test

    scores = model.evaluate(X, Y, verbose=args.verbose)
    v_print("\naccuracy on %s: %.2f%%" % (filepath, scores[1] * 100))
    results[filepath] = scores[1]*100

with open(os.path.join(MODEL_PATH, "accuracies.json"), "w") as json_file:
    json.dump(results, json_file)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: IBM/adversarial-robustness-toolbox
Commit Name: f8a5a458ff6a35e91ae9d705160d73cdcc8adf97
Time: 2017-05-31
Author: valentina.zantedeschi@ibm.com
File Name: test.py
Class Name:
Method Name:


Project Name: eth-cscs/reframe
Commit Name: e3f9de083ed935a54ecb97665e9fb01de976cded
Time: 2020-12-14
Author: jgp@cscs.ch
File Name: cscs-checks/microbenchmarks/gpu/gpu_burn/gpu_burn_test.py
Class Name: GpuBurnTest
Method Name: report_smallest_node


Project Name: google/unrestricted-adversarial-examples
Commit Name: 34a4b8afe99b1d7e193db54fdafc011fa7c1658f
Time: 2018-08-16
Author: nottombrown@gmail.com
File Name: unrestricted_advex/eval_kit/eval_with_attacks.py
Class Name:
Method Name: main