Comments (4)
Thanks, it's clear and makes sense. Feel free to close this issue. Thank you again.
from graphcl.
@hyp1231 Thank you for your carefulness! You are right that the current version only contrasting with small one-hop subgraphs (similar to InfoGraph, global-local contasting), due to my typo. In my later version of the my internal code (will be released in the future), I fixed this bug (simply let idx_neigh=idx_neigh.union...
) and found that it did not have much influence on performance. Thus, for reproduce purpose it is suggested to stick to the current shape, but for development it is better to fix it.
A sample of the improved subgraph function:
import torch_geometric.utils as tg_utils
def subgraph(data, aug_ratio):
G = tg_utils.to_networkx(data)
node_num, _ = data.x.size()
_, edge_num = data.edge_index.size()
sub_num = int(node_num * (1-aug_ratio))
idx_sub = [np.random.randint(node_num, size=1)[0]]
idx_neigh = set([n for n in G.neighbors(idx_sub[-1])])
while len(idx_sub) <= sub_num:
if len(idx_neigh) == 0:
idx_unsub = list(set([n for n in range(node_num)]).difference(set(idx_sub)))
idx_neigh = set([np.random.choice(idx_unsub)])
sample_node = np.random.choice(list(idx_neigh))
idx_sub.append(sample_node)
idx_neigh = idx_neigh.union(set([n for n in G.neighbors(idx_sub[-1])])).difference(set(idx_sub))
idx_nondrop = idx_sub
idx_nondrop.sort()
edge_index, _ = tg_utils.subgraph(idx_nondrop, data.edge_index, relabel_nodes=True, num_nodes=node_num)
data.x = data.x[idx_nondrop]
data.edge_index = edge_index
data.__num_nodes__, _ = data.x.shape
return data
from graphcl.
@yyou1996 Thanks for your kind and quick response!
BTW, another concern is, whether controling the scale of subgraph has a slight influence to the performance. In the original version of the released code, we have sub_num = int(node_num * aug_ratio)
(which is more similar to the original one-hop InfoGraph), while in the sample code just pasted, we have sub_num = int(node_num * (1-aug_ratio))
instead.
GraphCL/transferLearning_MoleculeNet_PPI/bio/loader.py
Lines 288 to 292 in 7eefcc3
from graphcl.
According to my limited observation, I dont feel it affects too much on performance, compared with the augmentation type. Of course, we did not do explicit ablation on the augmentation strength. I feel type of aug represents more of the prior, rather than strength. Also, I am happy to hear some other opinions.
from graphcl.
Related Issues (20)
- Question about the loss function in the transferLearning_MoleculeNet_PPI/chem HOT 1
- About Unsupervised_Cora_Citeseer HOT 1
- Different result about Transfer Learning HOT 2
- ValueError: `MessagePassing.propagate` only supports `torch.LongTensor` of shape `[2, num_messages]` or `torch_sparse.SparseTensor` for argument `edge_index`. HOT 1
- Question about GraphCL HOT 1
- Question About Sungraph HOT 1
- Question about data augmentation HOT 1
- Question about Unsupervised_TU HOT 4
- Unsupervised learning with self created dataset HOT 1
- graph classification HOT 1
- 问题请教 HOT 1
- A question about Semisupervised_TU in pre_training HOT 1
- 运行过程未结束就‘Early stopping!’ HOT 1
- Question about Unsupervised_TU experiments details HOT 4
- Question about Unsupervised-TU ''test'' and ''val'' HOT 1
- How to use for Graph Clustering. HOT 1
- information about the datasets HOT 1
- Question about cortex_DIM in net_infomax.py of semisupervised_TU/finetuning HOT 2
- File "/home/test02/code/GraphCL-master/semisupervised_TU/pre-training/feature_expansion.py", line 27, in __init__ super(FeatureExpander, self).__init__('add', 'source_to_target') TypeError: __init__() takes from 1 to 2 positional arguments but 3 were given HOT 1
- Dateset Error HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from graphcl.