How to generate datasets for inductive learning? #3415
Answered
by
rusty1s
scottshufe
asked this question in
Q&A
Replies: 2 comments 2 replies
-
For datasets like cora I have mostly only seen examples of transductive learning (nodes in same graph are split into train/test. although this is not completely transductive as there is nothing stopping you from predicting on an unseen node) as done here. The approach you are suggesting sounds interesting, but because you are generating subgraphs, the neighborhood of a node might change, which might effect your prediction. |
Beta Was this translation helpful? Give feedback.
1 reply
-
train_mask = torch.rand(data.num_nodes) < 0.5
test_mask = ~train_mask
train_data = copy.copy(data)
train_data.edge_index, _ = subgraph(train_mask, data.edge_index, relabel_nodes=True)
train_data.x = data.x[train_mask]
test_data = copy.copy(data)
test_data.edge_index, _ = subgraph(test_mask, data.edge_index, relabel_nodes=True)
test_data.x = data.x[test_mask] |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
scottshufe
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, everyone. My question is how to generate datasets for inductive learning?
Using Cora dataset as an example, I want to use half of its nodes and their links for training, the rest for testing. I am not sure if this approach is correct:
Does anyone have better ideas?
Beta Was this translation helpful? Give feedback.
All reactions