pyg-team / pytorch_geometric

Graph Neural Network Library for PyTorch
https://pyg.org
MIT License
21.4k stars 3.67k forks source link

prediction from edges #74

Closed danfeiX closed 2 years ago

danfeiX commented 5 years ago

First of all, thanks for the great library!

I'm currently trying to implement a network that can predict labels for both nodes and edges. This might require adding new nodes to the graph. Does the library happen to offer a function that automatically converts edges to additional nodes or does the nn package already support outputing from edge features? Thanks.

rusty1s commented 5 years ago

We currently do not offer an operator for your task. Can you point me to a specific paper or method that would fit your needs?

danfeiX commented 5 years ago

A lot of relationships prediction tasks in vision needs output from edge features. An example is scene graph generation

nitinkgp23 commented 5 years ago

Has this feature been implemented yet? If not, can you give hints on how to go ahead with this problem?

We could somehow convert the edges into some additional nodes and then do a node classification. If the library doesn't support it, is there any close mathematical operation that would possibly be useful here? I could try to implement the operation on my own.

rusty1s commented 5 years ago

There is now a line graph transform which could be useful for this.

yt2639 commented 5 years ago

Hi @rusty1s ! Thanks for providing this amazing tool for us. I am now also working on a task where I need to predict the value of edges (like regression problem). I got n nodes d node_features, and m edges (among those n nodes) k edge_features. I quickly went over a paper Neural Message Passing for Quantum Chemistry and then I used NNConv as conv.op and Set2Set as pooling.op. I am still not very clear how to do the edge prediction.

And, by

There is now a line graph transform which could be useful for this.

Do you mean this torch_geometric.transforms.line_graph? I am not very familiar with those functions and can you add one or two examples to this function (like what PyTorch did )? Also, the tutorial in Doc is kind of too short. I just very superficially understand how to use PyG actually. Can you also make more tutorial and examples on the doc?

Really appreciate your work!!

Many thanks!