Skip to content

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

@yuChen-XD

Description

@yuChen-XD

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions