Answers.Body: <blockquote>
  <p>I have looked into Graph Neural Network(GNN) but all of the tutorials I found, trained the model on a single large graph</p>
  </blockquote>
  <p>In that case, the tutorials were probably working on <strong>transductive prediction tasks</strong>. These are tasks were you have information on only a few nodes in a graph and want to infer all the missing pieces. An example for this kind of data is the <a href="https://relational.fit.cvut.cz/dataset/CORA" rel="nofollow noreferrer">cora dataset</a>.</p>
  <blockquote>
  <p>my dataset consists of thousands of smaller graphs like a typical machine learning dataset.</p>
  </blockquote>
  <p>This is then more related to <strong>inductive prediction tasks</strong>, as common for chemistry datasets were the task is to predict properties of different molecules. An example is the <a href="https://ogb.stanford.edu/docs/graphprop/#ogbg-mol" rel="nofollow noreferrer">Mol-HIV dataset</a>.</p>
  <blockquote>
  <p>Is GNN the right model for this kind of dataset? If not what should I look for?</p>
  </blockquote>
  <p>Yes, a GNN can be used for this - if you build your pipeline for inductive tasks you should have no problem applying GNNs to your kind of data.</p>
  <blockquote>
  <p>graphs will have different numbers of nodes and edges as they are produced from different code blocks. Also, the node types are not homogenous i.e., they have different features.</p>
  </blockquote>
  <p>This is exactly what GNNs good at. So, in order to work with your data you should lookup how to prepare your data for inductive tasks (Here is <a href="https://keras.io/examples/graph/mpnn-molecular-graphs/" rel="nofollow noreferrer">a keras guide on molecular data</a>) and how to setup a GNN for link prediction (like in <a href="https://docs.dgl.ai/tutorials/blitz/4_link_predict.html#sphx-glr-tutorials-blitz-4-link-predict-py" rel="nofollow noreferrer">this DGL guide</a>) and you should be good to go.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-09-05T16:24:01.330Z
Answers.Text: pardon my ignorance, the example you gave for the Mol-HIV dataset, the link shows it is in the category of Graph Property Prediction or graph classification. What I want to do is link prediction, which means I will train the model on graph A,B,C,D,E,F,G.... and test on other graphs to check if the model can predict if there should be an edge between two similar nodes (similar by the property)
  
  Any idea how I should approach this?
Answers.UserDisplayName: Masudul Hasan Masud
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-09-06T06:55:08.860Z
Answers.Text: Sure, what I mean is that you have to solve two independent problems: 1) Data loading when you have multiple Graphs (this has nothing to do with your model - its just your processing pipeline. That's where looking at something like MolHIV helps) and 2) Doing the link prediction. This has something to do with your model and how you use it. Here you can look at the cora link prediction example. I hope it's more clear now?
Answers.UserDisplayName: Chillston
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-09-05T09:02:37.517Z
Answers.LastActivityDate: 2022-09-05T09:02:37.517Z
Answers.UserDisplayName: Chillston
Body: <p>I am trying to figure out the right model/algorithm for a graph dataset to develop a machine learning pipeline. I have looked into Graph Neural Network(GNN) but all of the tutorials I found, trained the model on a single large graph where my dataset consists of thousands of smaller graphs like a typical machine learning dataset. Is GNN the right model for this kind of dataset? If not what should I look for?</p>
  <p>To give an idea about the dataset, I am not still sure about the representation but the dataset will describe the <a href="https://en.wikipedia.org/wiki/Abstract_syntax_tree" rel="nofollow noreferrer">AST</a> of different code snippets.</p>
  <p>Edit:</p>
  <ol>
  <li>graphs will have different numbers of nodes and edges as they are produced from different code blocks. Also, the node types are not homogenous i.e., they have different features.</li>
  <li>There are multiple use cases for the model, but primarily I am interested to develop a model that predicts link or edge between two similar node.</li>
  </ol>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-09-05T06:42:19.693Z
Comments.Text: It depends mainly on your end use case and the nature of the data. The questions to ask yourself are: Do all those graphs have the same number of nodes and edges between nodes? If so, you can approach the problem as a more traditional problem since you would have the possibility to convert it into a tabular one. On the other hand, what do you want to do with that model? It is not the same to make a model to classify or to do regression on each of the nodes of the network knowing a partial part of it than to do a classification or regression of the whole network.
Comments.UserDisplayName: Angelo
Tags: <graph-neural-networks><graphs>
Title: Model Suggestion for graph data
UserDisplayName: Masudul Hasan Masud
ThreadText: # Model Suggestion for graph data
  
  (Asked by: username_0 on 2022-09-04)
  
  I am trying to figure out the right model/algorithm for a graph dataset to develop a machine learning pipeline. I have looked into Graph Neural Network(GNN) but all of the tutorials I found, trained the model on a single large graph where my dataset consists of thousands of smaller graphs like a typical machine learning dataset. Is GNN the right model for this kind of dataset? If not what should I look for?
  
  To give an idea about the dataset, I am not still sure about the representation but the dataset will describe the [AST](https://en.wikipedia.org/wiki/Abstract_syntax_tree) of different code snippets.
  
  Edit:
  
  1. graphs will have different numbers of nodes and edges as they are produced from different code blocks. Also, the node types are not homogenous i.e., they have different features.
  2. There are multiple use cases for the model, but primarily I am interested to develop a model that predicts link or edge between two similar node.
  
  **Tags:** graph-neural-networks, graphs
  > **Comments:**
  > **username_1**: It depends mainly on your end use case and the nature of the data. The questions to ask yourself are: Do all those graphs have the same number of nodes and edges between nodes? If so, you can approach the problem as a more traditional problem since you would have the possibility to convert it into a tabular one. On the other hand, what do you want to do with that model? It is not the same to make a model to classify or to do regression on each of the nodes of the network knowing a partial part of it than to do a classification or regression of the whole network.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2022-09-05. Score: 0
  
  > I have looked into Graph Neural Network(GNN) but all of the tutorials I found, trained the model on a single large graph
  
  In that case, the tutorials were probably working on **transductive prediction tasks**. These are tasks were you have information on only a few nodes in a graph and want to infer all the missing pieces. An example for this kind of data is the [cora dataset](https://relational.fit.cvut.cz/dataset/CORA).
  
  > my dataset consists of thousands of smaller graphs like a typical machine learning dataset.
  
  This is then more related to **inductive prediction tasks**, as common for chemistry datasets were the task is to predict properties of different molecules. An example is the [Mol-HIV dataset](https://ogb.stanford.edu/docs/graphprop/#ogbg-mol).
  
  > Is GNN the right model for this kind of dataset? If not what should I look for?
  
  Yes, a GNN can be used for this - if you build your pipeline for inductive tasks you should have no problem applying GNNs to your kind of data.
  
  > graphs will have different numbers of nodes and edges as they are produced from different code blocks. Also, the node types are not homogenous i.e., they have different features.
  
  This is exactly what GNNs good at. So, in order to work with your data you should lookup how to prepare your data for inductive tasks (Here is [a keras guide on molecular data](https://keras.io/examples/graph/mpnn-molecular-graphs/)) and how to setup a GNN for link prediction (like in [this DGL guide](https://docs.dgl.ai/tutorials/blitz/4_link_predict.html#sphx-glr-tutorials-blitz-4-link-predict-py)) and you should be good to go.
  
  > **Comments:**
  > **username_0**: pardon my ignorance, the example you gave for the Mol-HIV dataset, the link shows it is in the category of Graph Property Prediction or graph classification. What I want to do is link prediction, which means I will train the model on graph A,B,C,D,E,F,G.... and test on other graphs to check if the model can predict if there should be an edge between two similar nodes (similar by the property)  Any idea how I should approach this?  
  > **username_2**: Sure, what I mean is that you have to solve two independent problems: 1) Data loading when you have multiple Graphs (this has nothing to do with your model - its just your processing pipeline. That's where looking at something like MolHIV helps) and 2) Doing the link prediction. This has something to do with your model and how you use it. Here you can look at the cora link prediction example. I hope it's more clear now?  
  
  ---
  
  