9bc56cc177b7997d6b4a30d204a08ef95a03a343,art/attacks/virtual_adversarial.py,VirtualAdversarialMethod,generate,#VirtualAdversarialMethod#Any#,33

Before Change


            for _ in range(self.max_iter):
                d = self.finite_diff * self._normalize(d)
                e = self.finite_diff * self._normalize(e)
                preds_new = self.classifier.predict(np.stack((val + d, val + e)))

                // Compute KL divergence between logits
                from scipy.stats import entropy
                kl_div1 = entropy(preds[ind], preds_new[0])
                kl_div2 = entropy(preds[ind], preds_new[1])
                d = (kl_div1 - kl_div2) / np.abs(d - e)

            // Apply perturbation and clip
            val = np.clip(val + self.eps * self._normalize(d), clip_min, clip_max)
            x_adv[ind] = val

After Change


                
                // TODO remove for loop
                d_new = d
                for i in range(*dims):
                    d[i] += self.finite_diff
                    preds_new = self.classifier.predict((val + d)[None, ...], logits=False)
                    kl_div2 = entropy(preds[ind], preds_new[0])                    
                    d_new[i] = (kl_div2-kl_div1)/self.finite_diff
                    d[i] -= self.finite_diff
                d = d_new

            // Apply perturbation and clip
            val = np.clip(val + self.eps * self._normalize(d), clip_min, clip_max)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 8

Instances


Project Name: IBM/adversarial-robustness-toolbox
Commit Name: 9bc56cc177b7997d6b4a30d204a08ef95a03a343
Time: 2018-05-09
Author: Maria-Irina.Nicolae@ibm.com
File Name: art/attacks/virtual_adversarial.py
Class Name: VirtualAdversarialMethod
Method Name: generate


Project Name: IBM/adversarial-robustness-toolbox
Commit Name: 557622faca0328c0303b824006c5fe11cc87cca1
Time: 2018-05-09
Author: mathsinn@ie.ibm.com
File Name: art/attacks/virtual_adversarial.py
Class Name: VirtualAdversarialMethod
Method Name: generate


Project Name: IBM/adversarial-robustness-toolbox
Commit Name: 9bc56cc177b7997d6b4a30d204a08ef95a03a343
Time: 2018-05-09
Author: Maria-Irina.Nicolae@ibm.com
File Name: art/attacks/virtual_adversarial.py
Class Name: VirtualAdversarialMethod
Method Name: generate


Project Name: shubhomoydas/ad_examples
Commit Name: 562508c5edf9988078f3ca4300e1d6be569a4b8f
Time: 2018-04-01
Author: smd.shubhomoydas@gmail.com
File Name: python/timeseries/timeseries_customRNN.py
Class Name: TsRNNCustom
Method Name: train