cleaned up for submission
This commit is contained in:
@@ -32,7 +32,7 @@ class UnlearningAttack:
|
||||
if model1.__class__.__name__ == "WF_Module":
|
||||
gate = torch.full((data.size(0),), target_class, device=device)
|
||||
p1 = torch.softmax(model1(data, target_class_indices=gate), dim=1)
|
||||
|
||||
|
||||
else: # its a normal nn.Module
|
||||
p1 = torch.softmax(model1(data), dim=1)
|
||||
p2 = torch.softmax(model2(data), dim=1)
|
||||
@@ -43,12 +43,14 @@ class UnlearningAttack:
|
||||
|
||||
|
||||
def calculate_a_dist(self, latent1, latent2):
|
||||
|
||||
|
||||
accuracy_score = self._comput_adversarial_accuracy(latent1, latent2, axis=0)
|
||||
epsilon = 1 - accuracy_score
|
||||
|
||||
return 2.0 * np.abs(0.5 - epsilon)
|
||||
|
||||
|
||||
|
||||
def _extract_attack_features(self, target_model, loader, device, target_class):
|
||||
|
||||
target_model.eval()
|
||||
|
||||
Reference in New Issue
Block a user