# A Message Passing Approach to Biomedical Relation Classification for Drug-Drug Interactions
## 2 Materials and Methods
### GNN-Based Classification Module  
KGs are a complex and dynamic data structure where the notion of fixed ordering does not apply. However, by implementing a message passing framework, GNNs are able to better utilize the KG's underlying graph structure as well as any initially available data for its nodes, compared to other approaches [27]. Specifically, each layer first applies a transformation function on the node feature vectors. The generated messages from each node's neighbors, as well as its own message, are then aggregated to produce a new embedding that encodes additional semantic information provided by the defined relation types. These embeddings can finally be used to perform predictions for the nodes.  
Given a selected subgraph \(G\), the classification takes place on one of three types of nodes, namely the set \(V_{I}\). As a sentence defines a maximum number of pairs according to the contained drug mentions, applying a BERT-based LM for their embedding generation may not be ideal. Instead, word embeddings were generated at the token level, as well as aggregated for the entire sentence that contains them. However, utilizing a GNN allows for the feature generation for each Interaction node.  
The vector representation of these nodes is initialized with a null (zero) vector \(h^{0}_{v_{I}}=x_{v_{I}}=0\), indicating no initial characterization for the Interaction nodes. However, GNNs pay special attention to the current \(h^{I-1}_{v}\) representation of a node when generating \(h^{I}_{v}\) from layer \(I\). Therefore, when applying a GNN layer, its new embedding results exclusively from the topology of the graph around it, i.e., through transformation and aggregation of \(x_{v_{S}}\) and \(x_{v_{T}}\) from the one neighboring Sentence and the two Tokens nodes, respectively.  
As the subgraph \(G\) is a heterogeneous graph, the use of a Relational GNN (RGNN) is required. The management of the heterogeneity is based on the logic of parameter distribution according to the type \(r\) of the edge that connects to the Interaction node (i.e., relation-specific transformations) [28]. Therefore, the embedding results from the following equation:  
\[h^{1}_{vI}=agg\tau_{r\in R}\{GNN^{l=1:r}(h^{0}_{vI},\{h^{0}_{u},u\in N^{r}(v_{ I})\})\}, \tag{1}\]  
where \(agg\) is an aggregation function, \(R\) the set of edge types and \(N^{r}(v_{I})\) the set of neighbors of \(v_{I}\) according to the triplets \(<u,r,v_{I}>\).  
The modeling capability of GNNs is determined by the expressive power of the message aggregation functions, making the choice of the appropriate GNN architecture critical to the performance of this shallow network. Therefore, with the utilization of a Graph Isomorphism Network (GIN), the architecture's deep layers are encapsulated within the single layer GNN. Using the sum as the aggregator operation, the above relation is formulated as:  
\[h_{vI}^{1}=\sum_{r\in R}MLP^{l=1\
u}(h_{vI}^{0}+\sum_{u\in N^{T}(v_{l})}h_{u}^{0}) \tag{2}\]  
The architecture's main RGNN element is surrounded by MLP modules, which are defined according to the node classes. Specifically, through the integration of the \(MLP\) preprocessing layers, the initial representation of each node is obtained by \(h_{v_{k}}^{0}=MLP_{pre}^{k}(x_{v_{k}})\), \(k\in K\). Similarly, the final vector representation of the Interaction nodes is defined by \(z_{v_{l}}=MLP_{post}^{l}(h_{v_{l}}^{1})\).  
Conclusively, the system is now able to classify each node \(v_{l}\) into one of the \(|C|=5\) interaction classes. First, the probability distribution of the classes is calculated as \(y_{v_{l}}^{\prime}=softmax(z_{v_{l}}W^{T}+b)\), where \(W\) and \(b\) are the trainable weights and biases parameters, respectively. The dimensions of matrix \(W\) are \(|C|\times d_{GNN}\), with the hyperparameter \(d_{GNN}=\text{dim}\left(z_{v_{l}}\right)\) constituting the dimension of the vector space defined by the network. The final classification during the inference is obtained by \(c_{v_{l}}=argmax_{c\in C}\{y_{v_{l}}^{\prime}\}\).