Heterogenous graph #4608
Unanswered
negarmaleki96
asked this question in
Q&A
Replies: 1 comment 2 replies
-
The idea here is that you group all your features of a single node type into one feature matrix, e.g., via: data["post"].x = torch.cat([data["post"].otype, data["post"].created, ...], dim=-1) |
Beta Was this translation helpful? Give feedback.
2 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.
-
Hi all,
I am building a heterogeneous graph. I have 3 different node types with 9 additional features within each. Also, I have 3 different edge types with two features within each. I want to implement GNN models on my graph after creating it. My problem is that in the GNN models, they can get only one feature of the graph; for example, in the following code, the model gets x_dict which is common among all the nodes in the heterogeneous graph, but in my case, since I have 9 different features, how should I give it to the model?
class HGT(torch.nn.Module):
def init(self, hidden_channels, out_channels, num_heads, num_layers):
super().init()
model = HGT(hidden_channels=64, out_channels=dataset.num_classes,
num_heads=2, num_layers=2)
My graph is like this:
HeteroData(
post={
otype=[147, 1],
created=[147, 1],
last_payout=[147, 1],
payout=[147, 1],
net_rshares=[147, 1],
abs_rshares=[147, 1],
vote_rshares=[147, 1],
author_rewards=[147, 1],
author_reputation=[147, 1]
},
user={ otype=[8394, 1] },
comment={
otype=[446, 1],
created=[446, 1],
last_payout=[446, 1],
payout=[446, 1],
net_rshares=[446, 1],
abs_rshares=[446, 1],
vote_rshares=[446, 1],
author_rewards=[446, 1],
author_reputation=[446, 1]
},
(user, authored, post)={
edge_index=[2, 514],
edge_attr={
otype=[514, 1],
time=[514, 1]
}
},
(user, vote, post)={
edge_index=[2, 13572],
edge_attr={
otype=[13572, 1],
time=[13572, 1]
}
},
(post, reply, comment)={
edge_index=[2, 446],
edge_attr={
otype=[446, 1],
time=[446, 1]
}
}
)
Beta Was this translation helpful? Give feedback.
All reactions