Skip to content

Inductive Link Prediction graph copying #46

Description

@drewdrewdrewdrew

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])

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions