Created
September 28, 2019 12:43
-
-
Save ptyshevs/3e7ad55995f21f33be957316cb4e741a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def fitness_similarity(X): | |
""" Maximize adv_target probability while MSE from adv_sample """ | |
y = model.predict(pt.Tensor(X).unsqueeze(1)).detach().numpy() | |
y_target = y[:, adv_target] | |
mse = np.sqrt(np.power(X - adv_sample, 2).mean(axis=1).mean(axis=1)) | |
return y_target - mse |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment