46ad98c1b619502c926c657c1a4c4276d2fd1f79,art/defences/adversarial_trainer_unittest.py,TestAdversarialTrainer,test_shared_model_mnist,#TestAdversarialTrainer#,110

Before Change


        // Create and fit classifier
        params = {"epochs": 5, "batch_size": BATCH_SIZE}
        classifier = CNN(im_shape, dataset="mnist")
        classifier.compile({"loss": "categorical_crossentropy", "optimizer": "adam", "metrics": ["accuracy"]})
        classifier.fit(x_train, y_train, **params)

        // Create FGSM attacker

After Change


        adv = FastGradientMethod(classifier)
        x_adv = adv.generate(x_test)
        preds = classifier.predict(x_adv)
        acc = np.sum(np.argmax(preds, axis=1) == np.argmax(y_test, axis=1)) / y_test.shape[0]

        // Perform adversarial training
        adv_trainer = AdversarialTrainer(classifier, adv)
        adv_trainer.fit(x_train, y_train, **params)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: IBM/adversarial-robustness-toolbox
Commit Name: 46ad98c1b619502c926c657c1a4c4276d2fd1f79
Time: 2018-05-01
Author: Maria-Irina.Nicolae@ibm.com
File Name: art/defences/adversarial_trainer_unittest.py
Class Name: TestAdversarialTrainer
Method Name: test_shared_model_mnist


Project Name: yahoo/TensorFlowOnSpark
Commit Name: 981e4266d4ea816b08a762193bd52f40cd1a3242
Time: 2019-08-07
Author: leewyang@verizonmedia.com
File Name: examples/mnist/keras/mnist_inference.py
Class Name:
Method Name: inference


Project Name: tensorflow/models
Commit Name: 12714f88ace4f395c3fa61886c699348a4d7e7f7
Time: 2017-10-28
Author: rathodv@google.com
File Name: research/object_detection/meta_architectures/ssd_meta_arch.py
Class Name: SSDMetaArch
Method Name: loss