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

Inductive Link Prediction graph copying #46

Open
drewdrewdrewdrew opened this issue Jul 15, 2022 · 0 comments
Open

Inductive Link Prediction graph copying #46

drewdrewdrewdrew opened this issue Jul 15, 2022 · 0 comments

Comments

@drewdrewdrewdrew
Copy link

drewdrewdrewdrew commented Jul 15, 2022

Hi, in the Inductive Link Prediction Split section of this colab notebook, I see we're making copies of the input graph to help set up the train / val / test splits.

This technique is echoed in this example as well but it seems to be more explicitly implemented to support learning on multiple graphs.

I'd like to use DeepSNAP's functionalities to manage train/val/test splits for edge prediction on a large graph (100MM+ nodes) and it seems strange/undesirable to have to create copies in this way. Is this truly the case or am I missing something? Does DeepSNAP allow inductive learning on single graphs?

import networkx as nx
from copy import deepcopy
from deepsnap.graph import Graph
from deepsnap.dataset import GraphDataset



run_transductive = False
n_copies_for_inductive = 10


myG = nx.complete_graph(50)
snap_graph = Graph(myG)


if not run_transductive:
    graphs = [copy.deepcopy(snap_graph) for _ in range(n_copies_for_inductive)]
else:
    graphs = [snap_graph]
    
    
dataset = GraphDataset(
    graphs,
    task='link_pred',
    edge_negative_sampling_ratio=1,
    edge_train_mode='disjoint'
)    

train, val, test = dataset.split(transductive=run_transductive, split_ratio=[0.85, 0.05, 0.1])
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

No branches or pull requests

1 participant