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

multiple edges modification #8

Open
cxw-droid opened this issue Sep 1, 2022 · 2 comments
Open

multiple edges modification #8

cxw-droid opened this issue Sep 1, 2022 · 2 comments

Comments

@cxw-droid
Copy link

Hi, it seems the code only modifies one edge per graph. Is there a simpler way to change the code to multiple edges modification? I have not found a parameter in the code to control the edge budget. Thanks.

@Hanjun-Dai
Copy link
Owner

When you construct the environment you have the choice of maximum number of edges to modify:

https://github.com/Hanjun-Dai/graph_adversarial_attack/blob/master/code/graph_attack/rl_common.py#L35

@cxw-droid
Copy link
Author

Thank you for the reply.

I tried to modify the code to n_edges=2 or n_edges=3 here:

env = GraphEdgeEnv(base_classifier, n_edges = 1)

I also add one line time_t = time_t % 2 before this line:
assert time_t >= 0 and time_t < self.num_steps

When modifying 2 edges, the results are similar to modifying 1 edge. When modifying 3 edges, the acc drops to about 0.61 then rises to 0.9, even worse than modifying only one edge. It seems more code modification is needed?

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

2 participants