Trainable feature extractor

I have a heterogeneous graph and in my task, each node is a set of points (each node has a different number of points). So I need a trainable feature extractor to process the point set of each node and provide a generate a feature vector with a same length per each node.
my problem is that (1) because of having various number of points per each node, I can’t load my data in DGL graph at the first and (2) how can I add a trainable feature extractor per each note type to be trained with tho whole?

as a summmary:
node 1:
type: polyline
feature: [13, 10]

node 2:
type: polyline
feature: [17, 10]

and I don’t want to use a pretrained feature extractor

How can I handle that?

Is it possible to aggregate the sequence for every node with an LSTM before feeding it into a GNN?

Hey, thanks for your prompt reply,
It could be, but with 2 concerns:

(1) I need a trainable feature extractor (like LSTM you mentioned), so in dataloader how can I load my data into graph format while nodes with same types has various shapes?

(2) In my case, each node actually is a FC graph. I want to first get a trainable feature extractor to generate feature vector for them and second have a global graph on the feature vectors. So how can I load my data in graph format? (I have some edges in subgraphs and some edges on feature vector of subgraphs) and a I’m a little confused about how should I load my data in the dgl graph at first?

it could be like this modelling (the right side graph is not a FC one necessarily and it will be a heterograph)

Screenshot from 2022-11-10 09-29-36

You need to store the features outside the graph. Currently DGL graphs assume that the node features have the same shape.

This sounds like a “nested” graph. I think in this case you likely need to write your own Dataset and/or DataLoader object depending on how your data is organized. May I know how your data is organized so I could give more advices? Like. does each of your “inner” FC graph have features? Are different nodes with the same node type have different FC graphs or different “inner node features”?

Hi @BarclayII
Exactly, I have a nested graph

So each node is a FC graph and each inner node has a feature vector. the inner nodes within a FC graph have the same size features. BUT based on node type, the inner node feature vector has a different size

EX:
node type: A
It has a FC graph with 4 inner nodes and each inner node has a feature vector with size n.

node type: B
It has a FC graph with 7 inner nodes and each inner node has a feature vector with size m.

So, (“does each of your “inner” FC graph have features?”: yes)


Are different nodes with the same node type have different FC graphs? yes

EX:
node type: A
It has a FC graph with 4 inner nodes and each inner node has a feature vector with size n.

node type: A
It has a FC graph with 9 inner nodes and each inner node has a feature vector with size n.

BUT after processing subgraphs (the FC graph per each node) I’m gonna have a 128d feature vector for all the node types.

I would organize it into (1) the “outer” graph containing the N nodes each representing a smaller graph with n_1, n_2, …, n_N nodes, and (2) N smaller “inner” graphs with n_1, n_2, …, n_N nodes respectively. Then I will compute a representation with a GNN on the N smaller “inner” graphs first, getting the representations h_1, h_2, …, h_N. The last step is to assign h_1, …, h_N back to the “outer” graph and compute a final representation with another GNN.

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