Augment dim error
WxxShirley opened this issue · 4 comments
Hi,
thanks for your work on neural subgraph match. It runs quite well on my dataset.
However, I wanted to fix the augmentation step in ./common/feature_preprocess.py
. In detail, add features such as degree, clustering_coefficient, etc. How to correctly implement the FEATURE_AUGMENT
and FEATURE_AUGMENT_DIMS
?
Auctally, I set
FEATURE_AUGMENT
as['degree','betweenness_centrality']
and setFEATURE_AUGMENT_DIMS
as[1,1]
, it encounters error ......
So sorry for the late response. Great to hear the method works on your dataset!
The FEATURE_AUGMENT
and FEATURE_AUGMENT_DIMS
look good to me (although to be sure, degree
should instead be node_degree
? Also, it may be necessary to use higher values for the degree feature, as the degree is encoded via a one-hot encoding).
Additionally, to add new features, it is necessary to register the features: see the line at
. The functions above that line give examples for other features, where each function actually creates the feature by creating a new propertygraph.[feature_name]
which is a tensor of features, one row per node in the graph.oh, that's just a spelling error😅
If I set:
FEATURE_AUGMENT = ["node_degree", "node_clustering_coefficient"]
FEATURE_AUGMENT_DIMS = [1, 1]
there will be error like this:
Training: 0%| | 0/100 [00:00<?, ?it/s]Process Process-3:
Process Process-1:
Process Process-2:
Traceback (most recent call last):
Traceback (most recent call last):
·······
File "/Users/xxwu/Downloads/subgraph/common/models.py", line 170, in forward
x = self.pre_mp(x)
File "/opt/anaconda3/lib/python3.8/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
result = self.forward(*input, **kwargs)
File "/opt/anaconda3/lib/python3.8/site-packages/torch/nn/modules/container.py", line 117, in forward
input = module(input)
File "/opt/anaconda3/lib/python3.8/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
result = self.forward(*input, **kwargs)
File "/opt/anaconda3/lib/python3.8/site-packages/torch/nn/modules/linear.py", line 93, in forward
return F.linear(input, self.weight, self.bias)
File "/opt/anaconda3/lib/python3.8/site-packages/torch/nn/functional.py", line 1690, in linear
ret = torch.addmm(bias, input, weight.t())
RuntimeError: mat1 and mat2 shapes cannot be multiplied (527x2 and 3x64)
does it work if you set the corresponding dimension to a higher value
: does not work😅Does it work with just one feature but not the other
: only use"node_clustering_coefficient"
it worksAlso how are you creating the data (which data source class are you using)?
: build the data source with my own dataset..