Is there a way to split the graph based on an edge feature #7366
Unanswered
ntquanghai
asked this question in
Q&A
Replies: 1 comment
-
Currently, this needs to be manually defined by the user. We don't offer such a functionality besides random splitting. This should be quite straightforward, as you can simply sort edges/nodes by time, and then split them manually by a pre-defined ratio, e.g.: perm = edge_time.argsort()
train_perm = perm[:perm.numel() * 0.8]
val_perm = perm[perm.numel() * 0.8:perm.numel() * 0.9]
test_perm = perm[perm.numel() * 0.9:]
train_edge_index = edge_index[:, train_perm]
... Hope this helps. |
Beta Was this translation helpful? Give feedback.
0 replies
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.
-
I came across a tutorial which can randomly split the graph into training, testing and validation sets by using the RandomLinkSplit class. I was wondering if there was a similar class, similar to this which is able to split the data based on a condition, or a based on an edge feature (For example, split the data based on "year")? I opted to find a similar implementation since I do need the edge_label and edge_label_index produced by this. Below is the tutorial code:
Beta Was this translation helpful? Give feedback.
All reactions