@@ -108,28 +108,28 @@ def test_4_tensorflow_mnist(self):
108108 x_test_adv = ead .generate (self .x_test_mnist , ** params )
109109 expected_x_test_adv = np .asarray (
110110 [
111- 0.45704955 ,
112- 0.43627003 ,
113- 0.57238287 ,
111+ 0.45284095 ,
112+ 0.43225235 ,
113+ 0.577448 ,
114114 1.0 ,
115- 0.11541145 ,
116- 0.12619308 ,
117- 0.48318917 ,
118- 0.3457903 ,
119- 0.17863746 ,
120- 0.09060935 ,
115+ 0.16554962 ,
116+ 0.3587564 ,
117+ 0.19202651 ,
118+ 0.04293771 ,
121119 0.0 ,
122- 0.00963121 ,
120+ 0.25811037 ,
123121 0.0 ,
124- 0.04749763 ,
125- 0.4058206 ,
126- 0.17860745 ,
122+ 0.0290696 ,
127123 0.0 ,
128- 0.9153206 ,
129- 0.84564775 ,
130- 0.20603634 ,
131- 0.10586322 ,
132- 0.00947509 ,
124+ 0.136172 ,
125+ 0.6153389 ,
126+ 0.12244645 ,
127+ 0.0 ,
128+ 0.7586619 ,
129+ 0.8366919 ,
130+ 0.22206311 ,
131+ 0.12455986 ,
132+ 0.02862802 ,
133133 0.0 ,
134134 0.0 ,
135135 0.0 ,
@@ -213,28 +213,28 @@ def test_4_tensorflow_mnist(self):
213213 x_test_adv = ead_wob .generate (self .x_test_mnist , ** params )
214214 expected_x_test_adv = np .asarray (
215215 [
216- 0.3287169 ,
217- 0.31374657 ,
218- 0.42853343 ,
219- 0.8994576 ,
220- 0.19850709 ,
221- 0.11997936 ,
222- 0.5622535 ,
223- 0.43854535 ,
224- 0.19387433 ,
225- 0.12516324 ,
226- 0.0 ,
227- 0.10933565 ,
228- 0.02162433 ,
229- 0.07120894 ,
230- 0.95224255 ,
231- 0.3072921 ,
232- 0.48966524 ,
216+ 0.32568744 ,
217+ 0.31085464 ,
218+ 0.43235543 ,
233219 1.0 ,
234- 0.3814998 ,
235- 0.15782641 ,
236- 0.52283823 ,
237- 0.12852049 ,
220+ 0.2433605 ,
221+ 0.3411813 ,
222+ 0.49469775 ,
223+ 0.2603619 ,
224+ 0.0 ,
225+ 0.35584357 ,
226+ 0.0 ,
227+ 0.2046029 ,
228+ 0.0 ,
229+ 0.08249304 ,
230+ 1.0 ,
231+ 0.35813788 ,
232+ 0.62945133 ,
233+ 1.0 ,
234+ 0.32154015 ,
235+ 0.3497113 ,
236+ 0.7613426 ,
237+ 0.36533928 ,
238238 0.0 ,
239239 0.0 ,
240240 0.0 ,
@@ -296,34 +296,34 @@ def test_9a_keras_mnist(self):
296296 x_test_adv = ead .generate (self .x_test_mnist , y = y_target )
297297 expected_x_test_adv = np .asarray (
298298 [
299- 0.0 ,
300- 0.0 ,
301- 0.0 ,
302- 0.0 ,
303- 0.0 ,
304- 0.0 ,
305- 0.0 ,
306- 0.0 ,
307- 0.0 ,
308- 0.0 ,
309- 0.00183569 ,
310- 0.0 ,
311- 0.0 ,
312- 0.49765405 ,
313- 1.0 ,
314- 0.6467149 ,
315- 0.0033755 ,
316- 0.0052456 ,
317- 0.0 ,
318- 0.01104407 ,
319- 0.00495547 ,
320- 0.02747423 ,
321- 0.0 ,
322- 0.0 ,
323- 0.0 ,
324- 0.0 ,
325- 0.0 ,
326- 0.0 ,
299+ 0.0000000e00 ,
300+ 0.0000000e00 ,
301+ 0.0000000e00 ,
302+ 0.0000000e00 ,
303+ 0.0000000e00 ,
304+ 0.0000000e00 ,
305+ 0.0000000e00 ,
306+ 0.0000000e00 ,
307+ 0.0000000e00 ,
308+ 7.8193319e-04 ,
309+ 5.5843666e-03 ,
310+ 0.0000000e00 ,
311+ 0.0000000e00 ,
312+ 4.9869284e-01 ,
313+ 1.0000000e00 ,
314+ 6.4663666e-01 ,
315+ 3.4855194e-03 ,
316+ 3.5087438e-03 ,
317+ 0.0000000e00 ,
318+ 9.8862723e-03 ,
319+ 3.8835173e-03 ,
320+ 3.0151173e-02 ,
321+ 0.0000000e00 ,
322+ 0.0000000e00 ,
323+ 0.0000000e00 ,
324+ 0.0000000e00 ,
325+ 0.0000000e00 ,
326+ 0.0000000e00 ,
327327 ]
328328 )
329329 np .testing .assert_array_almost_equal (x_test_adv [2 , 14 , :, 0 ], expected_x_test_adv , decimal = 6 )
@@ -371,28 +371,28 @@ def test_6_pytorch_mnist(self):
371371 x_test_adv = ead .generate (x_test , ** params )
372372 expected_x_test_adv = np .asarray (
373373 [
374- 0.01678124 ,
374+ 0.01758931 ,
375375 0.0 ,
376376 0.0 ,
377377 0.0 ,
378378 0.0 ,
379379 0.0 ,
380380 0.0 ,
381381 0.0 ,
382- 0.00665895 ,
382+ 0.00698278 ,
383383 0.0 ,
384- 0.11374763 ,
385- 0.36250514 ,
386- 0.5472948 ,
387- 0.9308808 ,
384+ 0.11318438 ,
385+ 0.36223832 ,
386+ 0.54720753 ,
387+ 0.93125045 ,
388388 1.0 ,
389- 0.99920374 ,
390- 0.86274165 ,
391- 0.6346757 ,
392- 0.5597227 ,
393- 0.24191494 ,
389+ 0.9999359 ,
390+ 0.8638486 ,
391+ 0.6354147 ,
392+ 0.5600332 ,
393+ 0.24081531 ,
394394 0.25882354 ,
395- 0.0091916 ,
395+ 0.00899846 ,
396396 0.0 ,
397397 0.0 ,
398398 0.0 ,
@@ -429,7 +429,7 @@ def test_8_keras_iris_clipped(self):
429429 classifier = get_tabular_classifier_kr ()
430430 attack = ElasticNet (classifier , targeted = False , max_iter = 10 , verbose = False )
431431 x_test_adv = attack .generate (self .x_test_iris )
432- expected_x_test_adv = np .asarray ([0.860373 , 0.455002 , 0.654925 , 0.240258 ])
432+ expected_x_test_adv = np .asarray ([0.8670352 , 0.4624909 , 0.6453267 , 0.23096858 ])
433433 np .testing .assert_array_almost_equal (x_test_adv [0 , :], expected_x_test_adv , decimal = 6 )
434434 self .assertLessEqual (np .amax (x_test_adv ), 1.0 )
435435 self .assertGreaterEqual (np .amin (x_test_adv ), 0.0 )
@@ -498,7 +498,7 @@ def test_9_keras_iris_unbounded(self):
498498 classifier = KerasClassifier (model = classifier ._model , use_logits = False , channels_first = True )
499499 attack = ElasticNet (classifier , targeted = False , max_iter = 10 , verbose = False )
500500 x_test_adv = attack .generate (self .x_test_iris )
501- expected_x_test_adv = np .asarray ([0.860373 , 0.455002 , 0.654925 , 0.240258 ])
501+ expected_x_test_adv = np .asarray ([0.8670352 , 0.4624909 , 0.6453267 , 0.23096858 ])
502502 np .testing .assert_array_almost_equal (x_test_adv [0 , :], expected_x_test_adv , decimal = 6 )
503503 predictions_adv = np .argmax (classifier .predict (x_test_adv ), axis = 1 )
504504 np .testing .assert_array_equal (
@@ -564,7 +564,7 @@ def test_3_tensorflow_iris(self):
564564 # Test untargeted attack
565565 attack = ElasticNet (classifier , targeted = False , max_iter = 10 , verbose = False )
566566 x_test_adv = attack .generate (self .x_test_iris )
567- expected_x_test_adv = np .asarray ([0.852286 , 0.434626 , 0.703376 , 0.293738 ])
567+ expected_x_test_adv = np .asarray ([0.84810126 , 0.43320203 , 0.70404345 , 0.29160658 ])
568568 np .testing .assert_array_almost_equal (x_test_adv [0 , :], expected_x_test_adv , decimal = 6 )
569569 self .assertLessEqual (np .amax (x_test_adv ), 1.0 )
570570 self .assertGreaterEqual (np .amin (x_test_adv ), 0.0 )
@@ -629,7 +629,7 @@ def test_3_tensorflow_iris(self):
629629 targets = random_targets (self .y_test_iris , nb_classes = 3 )
630630 attack = ElasticNet (classifier , targeted = True , max_iter = 10 , verbose = False )
631631 x_test_adv = attack .generate (self .x_test_iris , ** {"y" : targets })
632- expected_x_test_adv = np .asarray ([0.892806 , 0.531875 , 0.501707 , 0.059951 ])
632+ expected_x_test_adv = np .asarray ([0.88713187 , 0.5239736 , 0.49900988 , 0.05677444 ])
633633 np .testing .assert_array_almost_equal (x_test_adv [0 , :], expected_x_test_adv , decimal = 6 )
634634 self .assertLessEqual (np .amax (x_test_adv ), 1.0 )
635635 self .assertGreaterEqual (np .amin (x_test_adv ), 0.0 )
@@ -699,7 +699,7 @@ def test_5_pytorch_iris(self):
699699 classifier = get_tabular_classifier_pt ()
700700 attack = ElasticNet (classifier , targeted = False , max_iter = 10 , verbose = False )
701701 x_test_adv = attack .generate (self .x_test_iris .astype (np .float32 ))
702- expected_x_test_adv = np .asarray ([0.852286 , 0.434626 , 0.703376 , 0.293738 ])
702+ expected_x_test_adv = np .asarray ([0.84810126 , 0.43320203 , 0.70404345 , 0.29160658 ])
703703 np .testing .assert_array_almost_equal (x_test_adv [0 , :], expected_x_test_adv , decimal = 6 )
704704 self .assertLessEqual (np .amax (x_test_adv ), 1.0 )
705705 self .assertGreaterEqual (np .amin (x_test_adv ), 0.0 )
0 commit comments