Answers.Body: <p>It's perfectly reasonable to apply 'traditional' Deep Learning approaches to try and learn an adjacency matrix (a matrix is just a vector of vectors, which can be flattened into a single output vector) but you might need a lot of training data as N gets larger.</p>
  
  <p>Your outputs could certainly have the form of an adjacency matrix, as you describe. Whether it's more useful to have 'boolean' (either 0 or 1)
  or 'probabalistic' entries in the matrix depends both on the data and the specifics of your end application.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-03-22T10:44:57.730Z
Answers.Text: And dealing with the variable input and output sizes would be done using some sort of RNN?
Answers.UserDisplayName: basti123
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-03-24T12:18:03.500Z
Answers.Text: It's not clear that variable sizes are needed: just fix large enough N.
Answers.UserDisplayName: NietzscheanAI
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-07-21T11:12:16.747Z
Answers.Text: N can easily be as large as 800 or 1200 or so. There must be a more efficient approach.
Answers.UserDisplayName: basti123
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-07-22T11:13:42.640Z
Answers.Text: That's not large as far as deep learning is concerned.
Answers.UserDisplayName: NietzscheanAI
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-03-22T00:00:32.967Z
Answers.LastActivityDate: 2020-03-22T00:00:32.967Z
Answers.UserDisplayName: NietzscheanAI
Body: <p>I have a dataset and want to be able to construct a graph from it in a supervised fashion.</p>
  
  <p>Let's assume I have a dataset with <em>N</em> nodes, each node has e.g. 10 features. Out of these N nodes, I want to learn a graph, i.e. an <span class="math-container">$N \times N$</span> adjacency matrix. So, I start with <span class="math-container">$N$</span> nodes and all I know is a 10-dimensional feature vector for each node. I have no knowledge about the relation between these nodes and want to figure it out.</p>
  
  <p>Here is an example for <span class="math-container">$N=6$</span>, but in practice <span class="math-container">$N$</span> is not fixed.
  <a href="https://i.sstatic.net/rsIhj.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/rsIhj.png" alt="enter image description here"></a></p>
  
  <p>So the output I would like to get here is a <span class="math-container">$6\times6$</span> adjacency matrix, representing the relations between the nodes (undirected).</p>
  
  <p><strong>Note</strong>: <em>N</em> is arbitrary and not fixed. So an algorithm should be able to perform on any given <em>N</em>.</p>
  
  <p>My dataset is labeled. For the training dataset, I have the desired adjacency matrix for each collection of input nodes, which is filled with <span class="math-container">$0$</span>s and <span class="math-container">$1$</span>s. </p>
  
  <p>However, the output of the algorithm could also be an adjacency matrix filled with non-integer numbers in <span class="math-container">$[0,1]$</span>, giving some kind of probability of the nodes being connected (preferably close to <span class="math-container">$0$</span> or <span class="math-container">$1$</span> of course). So I could easily give a number as the label for each node. In the above example, the labels for the three connected nodes could be class <span class="math-container">$1$</span>, and so on. </p>
  
  <p>Is there any kind of supervised learning algorithm (e.g. some sort of graph neural network) that can perform these tasks?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-03-21T16:50:19.997Z
Comments.Text: Now, I cannot answer your question, but I can provide you some information about the application of deep learning to graphs. This is often called "geometric deep learning". And, yes, there are "graph neural networks". You may search for them on the web. There should already exist models for your use case. If you find a solution, feel free to provide an answer below to your own question for future readers ;)
Comments.UserDisplayName: nbro
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-03-21T16:54:41.720Z
Comments.Text: Thanks a lot! I have already tried to search the web for this of course but I could not find any useful information, probably also partly due to the fact that I do not know the right terminology in this field. That's why I posted my question here.
Comments.UserDisplayName: basti123
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-03-21T20:53:20.720Z
Comments.Text: See if this paper [Junction Tree Variational Autoencoder for Molecular Graph Generation](https://arxiv.org/abs/1802.04364) can be useful. I had read it several months ago and I even gave a presentation, but I forgot the details, but I remember that it was about generating graphs.
Comments.UserDisplayName: nbro
Tags: <neural-networks><deep-learning><supervised-learning><geometric-deep-learning><graphs>
Title: How can I learn a graph given nodes with features in a supervised fashion?
UserDisplayName: basti123
ThreadText: # How can I learn a graph given nodes with features in a supervised fashion?
  
  (Asked by: username_0 on 2020-03-21)
  
  I have a dataset and want to be able to construct a graph from it in a supervised fashion.
  
  Let's assume I have a dataset with *N* nodes, each node has e.g. 10 features. Out of these N nodes, I want to learn a graph, i.e. an $N \times N$ adjacency matrix. So, I start with $N$ nodes and all I know is a 10-dimensional feature vector for each node. I have no knowledge about the relation between these nodes and want to figure it out.
  
  Here is an example for $N=6$, but in practice $N$ is not fixed.
  [![enter image description here](https://i.sstatic.net/rsIhj.png)](https://i.sstatic.net/rsIhj.png)
  
  So the output I would like to get here is a $6\times6$ adjacency matrix, representing the relations between the nodes (undirected).
  
  **Note**: *N* is arbitrary and not fixed. So an algorithm should be able to perform on any given *N*.
  
  My dataset is labeled. For the training dataset, I have the desired adjacency matrix for each collection of input nodes, which is filled with $0$s and $1$s.
  
  However, the output of the algorithm could also be an adjacency matrix filled with non-integer numbers in $[0,1]$, giving some kind of probability of the nodes being connected (preferably close to $0$ or $1$ of course). So I could easily give a number as the label for each node. In the above example, the labels for the three connected nodes could be class $1$, and so on.
  
  Is there any kind of supervised learning algorithm (e.g. some sort of graph neural network) that can perform these tasks?
  
  **Tags:** neural-networks, deep-learning, supervised-learning, geometric-deep-learning, graphs
  > **Comments:**
  > **username_1**: Now, I cannot answer your question, but I can provide you some information about the application of deep learning to graphs. This is often called "geometric deep learning". And, yes, there are "graph neural networks". You may search for them on the web. There should already exist models for your use case. If you find a solution, feel free to provide an answer below to your own question for future readers ;)  
  > **username_0**: Thanks a lot! I have already tried to search the web for this of course but I could not find any useful information, probably also partly due to the fact that I do not know the right terminology in this field. That's why I posted my question here.  
  > **username_1**: See if this paper [Junction Tree Variational Autoencoder for Molecular Graph Generation](https://arxiv.org/abs/1802.04364) can be useful. I had read it several months ago and I even gave a presentation, but I forgot the details, but I remember that it was about generating graphs.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2020-03-22. Score: 2
  
  It's perfectly reasonable to apply 'traditional' Deep Learning approaches to try and learn an adjacency matrix (a matrix is just a vector of vectors, which can be flattened into a single output vector) but you might need a lot of training data as N gets larger.
  
  Your outputs could certainly have the form of an adjacency matrix, as you describe. Whether it's more useful to have 'boolean' (either 0 or 1)
  or 'probabalistic' entries in the matrix depends both on the data and the specifics of your end application.
  
  > **Comments:**
  > **username_0**: And dealing with the variable input and output sizes would be done using some sort of RNN?  
  > **username_2**: It's not clear that variable sizes are needed: just fix large enough N.  
  > **username_0**: N can easily be as large as 800 or 1200 or so. There must be a more efficient approach.  
  > **username_2**: That's not large as far as deep learning is concerned.  
  
  ---
  
  