0
$\begingroup$

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 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.
$\endgroup$
1
  • $\begingroup$ 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. $\endgroup$
    – Angelo
    Commented Sep 5, 2022 at 6:42

1 Answer 1

0
$\begingroup$

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.

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.

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) and how to setup a GNN for link prediction (like in this DGL guide) and you should be good to go.

$\endgroup$
2
  • $\begingroup$ 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? $\endgroup$ Commented Sep 5, 2022 at 16:24
  • $\begingroup$ 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? $\endgroup$
    – Chillston
    Commented Sep 6, 2022 at 6:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .