How to manage string values of features in HeteroDGL?

Hello, I want to create my heterogeneous graph in DGL.
The node features have integer and string types. for example (age = 20 and name = “John”)
(The values are not known in advance. I want to have a way to encode any value for name for example)

g.nodes[‘x’].data[‘ID’] = torch.tensor([a])
g.nodes[‘x’].data[‘name’] = torch.tensor([c])

Can you help me how to store the feature values into tensors? How a and b should be created?

It’s not supported in DGL. Perhaps you need to manage such data by your own, or preprocess it into tensor to feed in DGL

“Strings” may have two use cases: free text, or categorized strings (which can only take a few possible values). For free text you can use BERT to preprocess them. For the latter you could simply encode them as one-hot vectors.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.