-
Hi! I was thinking of using Without inductive learning and with only # NOTE: not all A entities are in our KG so there is an availability indicator
unique_kg_avail_bool = torch.zeros(kg_data.x_dict['A'].shape[0]).bool()
unique_kg_avail_bool[batch_As[batch_As < unique_kg_avail_bool.shape[0]]] = True
assert (batch_As < unique_kg_avail_bool.shape[0]).sum() == unique_kg_avail_bool.sum()
kg_loader = NeighborLoader(
kg_data,
# Sample `num_neighbors` for each node and each edge type for `num_layers` iterations
num_neighbors=[kg_sampling_num_neighbors] * num_layers,
batch_size=(batch_As < unique_kg_avail_bool.shape[0]).sum().item(),
input_nodes=('A', unique_kg_avail_bool),
)
kg_batch_data = next(iter(kg_loader))
kg_A_index_map = kg_batch_data['A']['n_id'] Now, I want to (1) extend the For (1), I am not sure what to do since For (2), I can think of doing this in a way that we first remove all attached edges to test A nodes (while keeping all test A nodes still in the graph to avoid the need of multiple times of reindexing), and then perform the regular |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
(1) You are right that we can currently only sample from a single node type. The current workaround is to create multiple |
Beta Was this translation helpful? Give feedback.
(1) You are right that we can currently only sample from a single node type. The current workaround is to create multiple
NeighborLoader
instances to achieve this :((2) One way to ensure that is to leverage our temporal sampling strategy, where nodes in the test nodes (their timestamps should be higher). Alternatively, you can use
subgraph
withrelabel_nodes=False
if you want to avoid the re-indexing.