pyg-team / pytorch_geometric

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

Loss function for graphs #1675

Open sydx opened 3 years ago

sydx commented 3 years ago

🚀 Feature

From what I've seen (please correct me if I'm wrong), pytorch_geometric assumes that the output of a neural network is a number rather than a graph. What if the output is another graph? Are there any means of computing errors/losses on graphs and backpropagating them? What would be a sensible error/loss on two graphs? (Perhaps something along the lines of http://www.xavierdupre.fr/app/mlstatpy/helpsphinx/c_graph/graph_distance.html?)

Motivation

Graph neural networks are frequently employed for graph classification problems. But what if the problem is graph modification, and the output of the neural network is another graph?

reshinthadithyan commented 3 years ago

Check onto recon_loss under autoencoder.py This accepts pos_edge_index(Nodes that are connected) and neg_edge_index(Nodes that shouldn't be connected). If you'll have pos_edge_index of Graph2 as the Target, You might be able to do what you intend to. @rusty1s ?

rusty1s commented 3 years ago

This is indeed a really tricky problem. The GraphVAE work tries to tackle this problem by a graph matching procedure. The advantage is that this is fully-differentiable, but kinda slow. IMO, a better way to create graphs is using auto-regressive methods such as GraphRNN.