Based on the article https://docs.dgl.ai/en/latest/guide/training-link.html, I created a simple link prediction program. Heterogeneous graph, two types of nodes (user, product).
In all DGL documentation, the characteristics are given as follows:
hetero_graph.nodes ['user']. data ['feature'] = torch.randn (n_users, n_hetero_features) hetero_graph.nodes ['item']. data ['feature'] = torch.randn (n_items, n_hetero_features)
What should I do when the feature vector is different for the user and the product? For example, a product has 10 features (price, category, promotion) and the user has only 2 (gender, country). Of course, the data is numerical.
Can I somehow process before network training? Eg dimension reduction?
Do I have to extend or change the model? I am using the model from the DGL documentation:
class Model(nn.Module): def __init__(self, in_features, hidden_features, out_features): super().__init__() self.sage = SAGE(in_features, hidden_features, out_features) self.pred = DotProductPredictor() def forward(self, g, neg_g, x): h = self.sage(g, x) return self.pred(g, h), self.pred(neg_g, h)
Thanks in advance for your answer