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

Q attack #21

Merged
merged 5 commits into from
Oct 14, 2024
Merged

Q attack #21

merged 5 commits into from
Oct 14, 2024

Conversation

Jeratt
Copy link
Collaborator

@Jeratt Jeratt commented Oct 9, 2024

Add Q-Attack: evasion non-targeted attack, based on Genetic Algorithm.
Notes:

  1. Probably can be upgraded to poison attack: CDA algorithm can be surrogate not the same as GNN
  2. Not sure if everything correct for directed graphs - theory correctness for modularity ?
  3. NMI as second option for fitness (and probably other variations) can be implemented in future works

labeled_nodes = {n: labels.tolist()[n-1] for n in adj_list.keys()} # FIXME check order for labels and node id consistency

# Calculate modularity
Q = QAttacker.modularity(adj_list, labeled_nodes)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Почему обращение к статик методу не через self?

labeled_nodes = {n: labels.tolist()[n-1] for n in adj_list.keys()} # FIXME check order for labels and node id consistency

# Calculate modularity
Q = QAttacker.modularity(adj_list, labeled_nodes)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Почему обращение к статик методу не через self?

src/attacks/QAttack/qattack.py Show resolved Hide resolved
src/attacks/QAttack/qattack.py Show resolved Hide resolved
for node, neighs in adj_list.items():
if node not in non_oriented_adj_list.keys():
non_oriented_adj_list[node] = copy.deepcopy(adj_list[node])
for in_node in adj_list[node]:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Тут один и тот же for выполняется 2 раза. Поставь if перед циклом, чтобы не происходило дублирования кода.

@LukyanovKirillML LukyanovKirillML merged commit afa3b24 into develop Oct 14, 2024
2 checks passed
@Jeratt Jeratt deleted the Q-attack branch October 14, 2024 11:11
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

Successfully merging this pull request may close these issues.

2 participants