DSE-MSU / DeepRobust

A pytorch adversarial library for attack and defense methods on images and graphs
MIT License
995 stars 192 forks source link

ModuleNotFoundError: No module named 'node2vec' #49

Closed EdisonLeeeee closed 3 years ago

EdisonLeeeee commented 3 years ago
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-1-ab061214f9c6> in <module>
      7 import torch.optim as optim
      8 from deeprobust.graph.utils import accuracy
----> 9 from deeprobust.graph.defense.pgd import PGD, prox_operators
     10 import warnings
     11 

~/DeepRobust/deeprobust/graph/defense/__init__.py in <module>
      4 from .prognn import ProGNN
      5 from .simpgcn import SimPGCN
----> 6 from .node_embedding import Node2Vec, DeepWalk
      7 import warnings
      8 try:

~/DeepRobust/deeprobust/graph/defense/node_embedding.py in <module>
     16 from sklearn.preprocessing import normalize
     17 from sklearn.metrics import f1_score, roc_auc_score, average_precision_score, accuracy_score
---> 18 from node2vec import Node2Vec as N2V
     19 
     20 class BaseEmbedding:

ModuleNotFoundError: No module named 'node2vec'

Hi, is there a missing file node2vec?

ChandlerBang commented 3 years ago

Hi, just “pip install node2vec”. See details in requirements.txt

EdisonLeeeee commented 3 years ago

Hi, Wei Jin.

Thanks, it works. The implementation of node2vec is much slower and the sp.csr_matrix needs to be transformed into nx.Graph. I think it's necessary to implement Node2Vec in deeprobust.

ChandlerBang commented 3 years ago

Yeah, I totally agree. The current model serves as a temporary solution and I shall implement it in the future. Currently I am working on adding graph classification and several other attack/defense methods.

Thank you for your suggestion.

EdisonLeeeee commented 3 years ago

I can help you implement this :), just wait a moment.

EdisonLeeeee commented 3 years ago

Kindly refer to https://github.com/DSE-MSU/DeepRobust/pull/51

ChandlerBang commented 3 years ago

Thank you so much!!!!