muhanzhang / IGMC

Inductive graph-based matrix completion (IGMC) from "M. Zhang and Y. Chen, Inductive Matrix Completion Based on Graph Neural Networks, ICLR 2020 spotlight".
MIT License
351 stars 83 forks source link

Not able to reproduce results #2

Closed vascobailao closed 4 years ago

vascobailao commented 4 years ago
Traceback (most recent call last):
  File "Main.py", line 338, in <module>
    multiply_by=multiply_by)
  File "/Users/vasfern/Downloads/IGMC-master/models.py", line 146, in __init__
    super(IGMC, self).__init__(dataset, GCNConv, latent_dim, regression, adj_dropout, force_undirected)
  File "/Users/vasfern/Downloads/IGMC-master/models.py", line 20, in __init__
    self.convs.append(gconv(dataset.num_features, latent_dim[0]))
  File "/Users/vasfern/Downloads/IGMC-master/.venv/lib/python3.6/site-packages/torch_geometric/data/dataset.py", line 117, in num_features
    return self.num_node_features
  File "/Users/vasfern/Downloads/IGMC-master/.venv/lib/python3.6/site-packages/torch_geometric/data/dataset.py", line 112, in num_node_features
    return self[0].num_node_features
  File "/Users/vasfern/Downloads/IGMC-master/.venv/lib/python3.6/site-packages/torch_geometric/data/dataset.py", line 188, in __getitem__
    data = self.get(self.indices()[idx])
TypeError: 'tuple' object is not callable
muhanzhang commented 4 years ago

Hi, which PyG version did you use? I originally thought this might be caused by that you are using the latest PyG version. But I have tested with PyG 1.4.2 + PyTorch 1.4 + Python 3.8, and it worked fine. Also, which command did you execute?

muhanzhang commented 4 years ago

Hi, I have found the reason. So you have used the "--dynamic-dataset" option. This option instantiates a MyDynamicDataset object defined in util_functions.py. The latest Pytorch_Geometric changes some of its Dataset class functions (the self.indices() had the same name as one of MyDaynamicDataset's attributes). Now I have fixed this issue by renaming this attribute. Please pull the latest changes and try again and it should work!

Lim-Sung-Jun commented 3 years ago

I have a problem, train_graph does not make num_features used on "self.convs.append(gconv(dataset.num_features, latent_dim[0]))" (maybe...?)

the code is on GNN class

I'm using the latest pyG version now because the pyG 1.4.2 version is not available.

could you give me some advice?

Traceback (most recent call last): File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/pydevd.py", line 1448, in _exec pydev_imports.execfile(file, globals, locals) # execute the script File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) File "/Users/limsungjun/projects/IGMC/Main.py", line 431, in model = IGMC( File "/Users/limsungjun/projects/IGMC/models.py", line 177, in init super(IGMC, self).init( File "/Users/limsungjun/projects/IGMC/models.py", line 22, in init self.convs.append(gconv(dataset.num_features, latent_dim[0])) File "/opt/anaconda3/envs/igmc/lib/python3.8/site-packages/torch_geometric/data/dataset.py", line 111, in num_features return self.num_node_features File "/opt/anaconda3/envs/igmc/lib/python3.8/site-packages/torch_geometric/data/dataset.py", line 102, in num_node_features data = self[0] File "/opt/anaconda3/envs/igmc/lib/python3.8/site-packages/torch_geometric/data/dataset.py", line 193, in getitem data = self.get(self.indices()[idx]) File "/opt/anaconda3/envs/igmc/lib/python3.8/site-packages/torch_geometric/data/dataset.py", line 89, in indices return range(self.len()) if self._indices is None else self._indices File "/opt/anaconda3/envs/igmc/lib/python3.8/site-packages/torch_geometric/data/dataset.py", line 61, in len raise NotImplementedError

I solved this problem

1) num_features -> num_node_features 2) len() -> len()

muhanzhang commented 3 years ago

@Lim-Sung-Jun Sorry I did not get you. Could you restate your question and provide instructions for reproducing the bug?

Lim-Sung-Jun commented 3 years ago

@Lim-Sung-Jun Sorry I did not get you. Could you restate your question and provide instructions for reproducing the bug?

I solved this problem, thank you for your attention!

Alizah-Masood commented 3 years ago

@Lim-Sung-Jun Sorry I did not get you. Could you restate your question and provide instructions for reproducing the bug?

I solved this problem, thank you for your attention!

Hi, I'm having the same issue. Can you please specify how exactly you solved this problem?

YangTakeshi commented 3 years ago

@Lim-Sung-Jun Sorry I did not get you. Could you restate your question and provide instructions for reproducing the bug?

I solved this problem, thank you for your attention!

Hi, I'm having the same issue. Can you please specify how exactly you solved this problem?

  1. File "/IGMC/models.py", line 22: Change "num_features" to "num_node_features"
  2. .File "/IGMC/utilfunctions.py", line 135: Change "def __len_\(self)" to "def len(self)" Then, you will solve this problem.
Alizah-Masood commented 3 years ago

Thanks. I did figure it out.

@Lim-Sung-Jun Sorry I did not get you. Could you restate your question and provide instructions for reproducing the bug?

I solved this problem, thank you for your attention!

Hi, I'm having the same issue. Can you please specify how exactly you solved this problem?

  1. File "/IGMC/models.py", line 22: Change "num_features" to "num_node_features"
  2. .File "/IGMC/util_functions.py", line 135: Change "def len(self)" to "def len(self)" Then, you will solve this problem.

Thanks! I did figure it out.