Code Monkey home page Code Monkey logo

Comments (6)

danielzuegner avatar danielzuegner commented on May 27, 2024

Hi,

Yes, that should do the job. Good luck and let me know if you have further questions!

Daniel

from gnn-meta-attack.

padulafacundo avatar padulafacundo commented on May 27, 2024

Thanks!

I actually do have a couple of other questions:

  • Can the algorithm perturb a selfloop?
  • Is it possible for the algorithm to pick the same edge more than once?
  • How should I read the content of self.adjacency_meta_update after the graph has been perturbed?

Let me know if you want me to open a separate issue for this or reach you some other way.
Thanks again!

from gnn-meta-attack.

danielzuegner avatar danielzuegner commented on May 27, 2024

Can the algorithm perturb a selfloop?

No, since the self-loop is being added in a "hard-coded" way by the GCN preprocessing. However you can change that in the code if you like.

Is it possible for the algorithm to pick the same edge more than once?

Technically that's possible, though unlikely, I guess. You could set the meta-gradients of the entries that were previously selected to 0 if you want that.

How should I read the content of self.adjacency_meta_update after the graph has been perturbed?

I'm honestly not sure whether there is anything to read from self.adjacency_meta_update. If you want the perturbed edges, you can look at the nonzero entries in self.adjacency_changes.

Does that help?

from gnn-meta-attack.

padulafacundo avatar padulafacundo commented on May 27, 2024

Technically that's possible, though unlikely, I guess. You could set the meta-gradients of the entries that were previously selected to 0 if you want that.

I don't really want to perturb the same edge twice, just checking if it's possible because I suspect it might happening to me 😅

I'm honestly not sure whether there is anything to read from self.adjacency_meta_update. If you want the perturbed edges, you can look at the nonzero entries in self.adjacency_changes.

Isn't self.adjacency_meta_update supposed to have the updated content of self.adjacency_changes?

# Add the change to the perturbations.
self.adjacency_meta_update = tf.scatter_add(self.adjacency_changes,
                                            indices=adj_argmax_combined,
                                            updates=-2 * tf.gather(
                                                 tf.reshape(self.modified_adjacency, [-1]),
                                                 adj_argmax_combined) + 1)

How do I interpret self.adjacency_changes? A 0 if the edge hasn't been perturbed and a 1 if it has (regardless if the edge has been 'added' or 'removed') ?
What if an edge has been perturbed twice? Will the entry in self.adjacency_changes be a 1 or a 0 (because it went from 0 to 1 and from 1 to 0) ?

Does that help?

Yes! Thanks!

from gnn-meta-attack.

danielzuegner avatar danielzuegner commented on May 27, 2024

Hi,

as far as I remember, tf.scatter_add is the operation that directly modifies the target tensor, i.e. in this case self.adjacency_changes. self.adjacency_changes is a [N*N] tensor that contains 1 for edge insertions, -1 for edge deletions, and 0 else. This is then added to the original adjacency matrix to obtain the perturbed adjacency matrix. If an edge is modified twice, it is set back to its original state. If you don't want that you can manually set to zero the gradients corresponding to the already modified indices.

I hope that helps.

Best,

Daniel

from gnn-meta-attack.

padulafacundo avatar padulafacundo commented on May 27, 2024

That really helps! Thank you very much!

from gnn-meta-attack.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.