automl-classroom / iML-ws21-ex08

0 stars 0 forks source link

epsilon value of 0.0 in test_create_adversarial() #4

Closed nc1m closed 2 years ago

nc1m commented 2 years ago

Hi,

my problem is when epsilon = 0.0 -> delta = 0.0 -> x == x+delta -> y does not change -> endless loop. Or did I get something wrong?

nc1m commented 2 years ago

I added

if  eps == 0.0:
    break

which solved the issue, but I'm still not sure if 0.0 is a valid epsilon value.

maxidl commented 2 years ago

Hi, based on the given equations, there is no need for any optimization loop (the while loop in your code). The gradient is only estimated once, and then different magnitudes of perturbations are applied, based on the different eps values. So, when eps=0.0, no perturbation is applied and the resulting image is equal to the input image, although it is technically an 'unsuccessful' attack. The create_adversarial method does not guarantee that all returned images are successful adversarials.

nc1m commented 2 years ago

Okay thanks for the answer. Should I remove the while loop, although all tests pass?

maxidl commented 2 years ago

If you keep it as it is, you will pass the exercise, so do not worry about it.