Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question about PGD graph global attack with CE/CW loss #149

Open
yuChen-XD opened this issue Nov 4, 2023 · 0 comments
Open

Question about PGD graph global attack with CE/CW loss #149

yuChen-XD opened this issue Nov 4, 2023 · 0 comments

Comments

@yuChen-XD
Copy link

Hi,
I have a doubt about the [test_pgd.py] (

# model.attack(features, adj, labels, idx_train, perturbations, epochs=args.epochs)
# Here for the labels we need to replace it with predicted ones
fake_labels = target_gcn.predict(features.to(device), adj.to(device))
fake_labels = torch.argmax(fake_labels, 1).cpu()
# Besides, we need to add the idx into the whole process
idx_fake = np.concatenate([idx_train,idx_test])
model.attack(features, adj, fake_labels, idx_fake, perturbations, epochs=args.epochs)
).
When I use the CE loss, I get basically the same result as you showed in the previous issues, as shown below.

=== testing GCN on clean graph ===
Test set results: loss= 0.8108 accuracy= 0.8180
=== setup attack model ===
100%|██████████| 100/100 [01:35<00:00, 1.05it/s]
=== testing GCN on Evasion attack ===
Test set results: loss= 1.0158 accuracy= 0.7250
=== testing GCN on Poisoning attack ===
Test set results: loss= 0.9889 accuracy= 0.7320

However, when I replace the loss type in line87 to 'CW', the result, shown below, is not as the same level as the origin paper. I think the CW loss should have a similar ASR as the CE loss.

=== testing GCN on clean graph ===
Test set results: loss= 0.8108 accuracy= 0.8180
=== setup attack model ===
100%|██████████| 100/100 [01:28<00:00, 1.13it/s]
=== testing GCN on Evasion attack ===
Test set results: loss= 0.9067 accuracy= 0.7750
=== testing GCN on Poisoning attack ===
Test set results: loss= 0.9512 accuracy= 0.7450

Do you get this difference when you test the PGD method?
Thanks for your help in advance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant