Train/Test split for multiple Graphs (Node regression) #5275
sivaramkrishnan101
started this conversation in
General
Replies: 1 comment 1 reply
-
There does not exist a particular function for this, but you can easily shuffle and split by yourself data_list = [data_list[i] for i in torch.randperm(len(data_list)).tolist()]
train_data_list = data_list[:150]
test_data_list = data_list[150:] |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I am very new to Pytorch Geometric, which has been a pleasure to use.
Currently, I have 200 graphs, each with 5 nodes, each having 2 node features outputting a numeric label. The graphs were made using the NetworkX library.
This was converted to pytorch geometric objects using from_networkx
Code snippet(Here data_1 stores the first pytorch geometric object and so on)
for i in range(1,199):
globals()['data_'+str(i)] = from_networkx(Graphs[i],['pos_x','pos_y'])
Now, I'm not quite sure on how to perform a train/test split such that some nodes in a considered Graph go into the train while the rest go into the test set(Inductive based).
I have tried creating a dataset with these 199 pytorch geometric objects such that
data_list = data_list = [data_1, .... data_199]
However, I am unable to apply RandomNodeSplit on it as it has been converted to a list and limits functionality.
Please, I have been struggling with this for quite a while and any hints/ideas would be greatly appreciated.
Beta Was this translation helpful? Give feedback.
All reactions