Incorporating structural information in a Transformer?

For a Neural Machine Translation (NMT) task, my input data has relational information. This relation could be modelled using a graphical structure. So one approach could be to use Graph Neural Network (GNN) and use a Graph2Seq model. But I can't find a good generational model for GNN. Instead, I want to use Transformer. But then the challenge is how can I embed structural information there? Is there any open source artefact for Relational Transformer that I can use out …
Category: Data Science

Graph Neural Networks for Segmented Images - Which Nodes do I connect?

I'm facing an interesting problem involving medical images. We are set out to test an hypothesis if certain objects in an image affect the diagnosis of a patient. I would love to hear any comments regarding my pipeline but this is my current approach: Segment the image in order to obtain the object's regions. This would be done using off-the-shelf resnet and labeled data obtained from the manual annotation of the images in hand. Now, that I have the segmented …
Category: Data Science

What are the differences between Knowledge Graph Embeddings (KGE) and Graph Neural Network (GNN)

From page 3 of this paper Knowledge Graph Embeddings and Explainable AI, they mentioned as below: Note that knowledge graph embeddings are different from Graph Neural Networks (GNNs). KG embedding models are in general shallow and linear models and should be distinguished from GNNs [78], which are neural networks that take relational structures as inputs However, it's still vague to me. It seems that we can get embeddings from both of them. What are the difference? How should we choose …
Category: Data Science

Model stalls and learning slows down after the first epochs

I have an issue with a model that I'm working on, I cannot show you the model architecture because it's basically confidential research. The model includes Graph convolutional networks and Transformer encoders combined to process and classify both sequences and graphs, I have dropout and layernorm and skip connections everywhere. Optimizer : RAdam with a reducelronplateau scheduler The issue is that the model learns pretty fast in a natural progression in the first 10 to 15 epochs but tends to …
Category: Data Science

Can I use low dimensional node features in graph convolutional networks?

I am trying to understand how GCNs work. For example, the well known GraphSAGE algorithm considers a graph $G$ with node features $x_i$ of dimension $n$. Then it propagates the node features over the graph by message passing. In a basic implementation of GraphSAGE, message passing is implemented by first averaging over the neighbour features, which is then passed through a linear transformation $W_2$. Finally, the original node features are added multiplied by another linear transformation $W_1$: $$ x_i' = …
Category: Data Science

Graph Neural Network fails at generalizing on unseen graph topologies

I'm using PytorchGeometric to train a graph convolutional network for regression over nodes problem (the graph models physical phenomena in the network of sensors; the network of sensors is actually the network of measurements distributed across the power grid (powers, currents, voltages), and the goal of the GNN is to predict some unmeasured variables in the graph.). In the training dataset there graphs with different topologies (i.e. different edge_index tensors), and each of which has input and label tensors, which …
Category: Data Science

What is a good approach for embedding both textual and spatial features for document classification?

I am working on a document classifier that can perform the classification based on the document structure as well. My plan is to get the word embedding as well as the word coordinates and somehow combine the two features and pass it through a Graph Convolutional Network (GCN) to generate a graph embedding which I can then use to train a classifier. I was referencing this paper and they do data extraction by first getting the text embedding and image …
Category: Data Science

How to perform inductive train/test split for GraphSAGE classification

Let's say I have a network that consists of a single weakly connected component. From various papers I've seen that if you want to use inductive GNNs like GraphSAGE, it is advisable to split your train/test data into two separate graphs or components. Since I've seen that there are different approaches for node classification and link prediction tasks, I am specifically interested in node classification tasks, possible multiclass classification. So the train/test split graphs would need to ensure some sort …
Category: Data Science

Why is "Hidden State" at Node in Graph Neural Network Considered "Compressed" Representation?

I am reading article on Graph Neural Network (GNN) and it is mentioned: The memory stores the states of all the nodes, acting as a compressed representation of the node’s past interactions. Why is the hidden state or node's memory considered compressed representation of the node's interaction? Isnt compressed representation is what auto-encoders yield?
Category: Data Science

How to find union of nodes in rdflib knowledge graph

Little background on Work : I am working with ontologies and for my usecase I have to apply random walk on the ontology nodes/entities. In order to do the same I have written one function - that given a node it will output all its immediate neighbour nodes. Actual Problem : Recently I came across an ontology which along with normal nodes in the graph also has "union of other nodes" as an entity. But while going over the triple's …
Category: Data Science

How to correct a validation loss in a regression problem?

I've developed a graph neural network using PyTorch Geometric. My model looks like: class GCN(torch.nn.Module): def __init__(self): super().__init__() self.conv1 = GCNConv(3, 32) self.conv2 = GCNConv(32, 64) self.conv3 = GCNConv(64, 32) self.fc1 = Linear(32, 10) def forward(self, data): x, edge_index, edge_attr = data.x, data.edge_index, data.edge_attr x = F.elu(self.conv1(x, edge_index)) x = F.elu(self.conv2(x, edge_index)) x = F.elu(self.conv3(x, edge_index)) x = F.elu(self.fc1(x)) return x I've generated a train and validation dataset, with the following learning curves: I do not know what kind of …
Category: Data Science

Graph Classification via Random Forest

This is my first post here, just a brief presentation: my name is Gianmarco, I’m Medicinal Chemistry undergraduate student who is preparing his dissertation, my idea would be to create a classifier that can distinguish anticancer drugs as active or inactive and distinguish those active in three classes, describing the molecules as a graph. My supervisor suggested me to use the Random Forest classifier, to do this I need to convert my graph into a vector trying to keep as …
Category: Data Science

Understanding Node Embeddings

I have only just started to look into graph neural networks and I am a little confused on the node embedding process. Here is my understanding, please let me know if i misunderstood: Given unlabelled data, we try to construct a graph $G=(V,E)$ and generate a mask that contains important features of each node such as shape, size, intensity etc. Then let's say the aim is to try and classify the nodes. So, this is where we use node embedding, …
Category: Data Science

In the node2vec model derivation, what does it mean for node representations to be "Symmetric in Feature Space"?

The main derivation of the probabilistic model in Node2Vec goes as follows (paper available on ArXiv: https://arxiv.org/pdf/1607.00653.pdf): We formulate feature learning in networks as a maximum likelihood optimization problem. Let $G=(V, E)$ be a given network. Our analysis is general and applies to any (un)directed, (un)weighted network. Let $f: V \rightarrow \mathbb{R}^{d}$ be the mapping function from nodes to feature representaions we aim to learn for a downstream prediction task. Here $d$ is a parameter specifying the number of dimensions …
Category: Data Science

Are GNNs/GCNs viable for graphs with no node features, with only the unique node IDs? Are they different from DeepWalk at that point?

I started to dig into GNNs for the first time and I have trouble understanding its advantages over NLP inspired embedding methods like DeepWalk and node2vec. Do GNNs only shine with node features? Or can they handle IDs/giant one-hot vectors as well? Does the usual input for GNNs only consist of a vector of handcrafted features? Are GNNs used directly for tasks like link prediction or they are just embedding generators for other models?
Category: Data Science

How train - test split works for Graph Neural Networks

I have recently started studying GNN's. I have covered GCN and GraphSage so far. But I am confused regarding the process when testing occurs. Now suppose in the graph above I am using the nodes as train and test set as shown in the figure. Suppose I am using the GraphSage model for a supervised node-classification task , now during training I am providing the sub-graph with blue nodes and the weights(parameters) gets calculated using the neighbourhood information of the …
Category: Data Science

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.