---
abstract: 'Existing deep learning models may encounter great challenges in handling graph structured data. In this paper, we introduce a new deep learning model for graph data specifically, namely the *deep loopy neural network*. Significantly different from the previous deep models, inside the *deep loopy neural network*, there exist a large number of loops created by the extensive connections among nodes in the input graph data, which makes model learning an infeasible task. To resolve such a problem, in this paper, we will introduce a new learning algorithm for the *deep loopy neural network* specifically. Instead of learning the model variables based on the original model, in the proposed learning algorithm, errors will be back-propagated through the edges in a group of extracted spanning trees. Extensive numerical experiments have been done on several real-world graph datasets, and the experimental results demonstrate the effectiveness of both the proposed model and the learning algorithm in handling graph data.'
author:
- |
    Jiawei Zhang\
    $^\star$IFM Lab, Florida State University, FL, USA\
    jzhang@cs.fsu.edu
bibliography:
- 'reference.bib'
title: Deep Loopy Neural Network Model for Graph Structured Data Representation Learning
---

Introduction {#sec:intro}
============

Formally, a loopy neural network denotes a neural network model involving loops among neurons in its architecture. *Deep loopy neural network* is a novel learning model proposed for graph structured data specifically in this paper. Given a graph data $G = (\mathcal{V}, \mathcal{E})$ (where $\mathcal{V}$ and $\mathcal{E}$ denote the node and edge sets respectively), the architecture of *deep neural nets* constructed for $G$ can be described as follows:

(**Deep Loopy Neural Network**): Formally, we can represent a *deep loopy neural network* model constructed for network $G = (\mathcal{V}, \mathcal{E})$ as $\mathcal{G} = (\mathcal{N}, \mathcal{L})$, where $\mathcal{N}$ covers the set of neurons and $\mathcal{L}$ includes the connections among the neurons defined based on graph $G$.

More specifically, the neurons covered in set $\mathcal{N}$ can be categorized into several layers: (1) input layer $\mathcal{X}$, (2) hidden layers $\mathcal{H} = \bigcup_{l=1}^k \mathcal{H}^{(l)}$, and (3) output layer $\mathcal{Y}$, where $\mathcal{X} = \{{\mathbf}{x}_i\}_{v_i \in \mathcal{V}}$, $\mathcal{H}^{(l)} = \{{\mathbf}{h}_i^{(l)}\}_{v_i \in \mathcal{V}}, \forall l \in \{1, 2, \cdots, k\}$, $\mathcal{Y} = \{{\mathbf}{y}_i\}_{v_i \in \mathcal{V}}$ and $k$ denotes the hidden layer depth. Vector ${\mathbf}{x}_{i} \in \mathbb{R}^n$, ${\mathbf}{h}_i^{(l)} \in \mathbb{R}^{m^{(l)}}$ and ${\mathbf}{y}_{i} \in \mathbb{R}^d$ denote the feature, hidden state (at layer $l$) and label vectors of node $v_i \in \mathcal{V}$ in the input graph respectively. Meanwhile, the connections among the neurons in $\mathcal{L}$ can be divided into (1) intra-layer neuron connections $\mathcal{L}_{a}$ (which connect neurons within the same layers), and (2) inter-layer neuron connections $\mathcal{L}_{e}$ (which connect neurons across layers), where $\mathcal{L}_{a} = \bigcup_{l=1}^k \{({\mathbf}{h}^{(l)}_i, {\mathbf}{h}^{(l)}_j)\}_{(v_i, v_j) \in \mathcal{E}}$ and $\mathcal{L}_{e} = \mathcal{L}_{x,h_1}  \cup \mathcal{L}_{h_1,h_2} \cup \cdots \cup \mathcal{L}_{h_k,y}$. In the notation, $\mathcal{L}_{x,h_1}$ covers the connections between neurons in the input layer and the first hidden layer, and so forth for the other neuron connection sets.

In Figure \[fig:framework\], we show an example of a *deep loopy neural network* model constructed for the input graph as shown in the left plot. In the example, the input graph can be represented as $G = (\mathcal{V}, \mathcal{E})$, where $\mathcal{V} = \{v_1, v_2, \cdots, v_6\}$ and $\mathcal{E} = \{(v_1, v_2), (v_1, v_3), (v_1, v_4), (v_2, v_3),(v_3, v_4),(v_4, v_5),(v_5, v_6)\}$. The constructed *deep loopy neural network* model involves $k$ layers and the intra-layer neuron connections mainly exist in these hidden layers respectively.

Formally, given the node input feature vector ${\mathbf}{x}_i$ for node $v_i$, we can represents its hidden states at different hidden layers and the output label as follows: $$\begin{cases}
{\mathbf}{h}^{(1)}_i &= \sigma \big({\mathbf}{W}^{x} {\mathbf}{x}_i + {\mathbf}{b}^{x}  + \sum_{v_j \in \Gamma(v_i)} ({\mathbf}{W}^{h_1}  {\mathbf}{h}_j + {\mathbf}{b}^{h_1} ) \big),\\
&\cdots\\
{\mathbf}{h}^{(k)}_i &= \sigma \big({\mathbf}{W}^{h_{k-1}, h_k} {\mathbf}{h}^{(k-1)}_i + {\mathbf}{b}^{h_{k-1}, h_k} + \sum_{v_j \in \Gamma(v_i)} ({\mathbf}{W}^{h_k} {\mathbf}{h}_j + {\mathbf}{b}^{h_k} ) \big),\\
{{\mathbf}{y}}_i &= \sigma({\mathbf}{W}^{y} {\mathbf}{h}^{(k)}_i + {\mathbf}{b}^{y}),
\end{cases}$$ where set $\Gamma(v_i) = \{v_j | v_j \in \mathcal{V} \land (v_i, v_j) \in \mathcal{E}\}$ denotes the neighbors of node $v_i$ in the input graph.

Compared against the true label vector of nodes in the network, e.g., $\hat{{\mathbf}{y}}_i$ for $v_i \in \mathcal{V}$, we can represent the introduced loss by the model on the input graph as $$E(G) = \sum_{v_i \in \mathcal{V}} E(v_i) = \sum_{v_i \in \mathcal{V}} loss( \hat{{\mathbf}{y}}_i, {{\mathbf}{y}}_i ),$$ where different loss functions can be adopted here, e.g., *mean square loss* or *cross-entropy loss*.

By minimizing the loss function, we will be able to learn the variables involved in the model. By this context so far, most of the deep neural network model training is based on the error back propagation algorithm. However, applying the error back propagation algorithm to train the *deep loopy neural network* model will encounter great challenges due to the extensive variable dependence relationships created by the loops, which will be illustrated in great detail later.

![image](./framework.pdf){width="100.00000%"}

The following part of this paper is organized as follows. In Section \[sec:relatedwork\], we will introduce the existing related works to this paper. We will analyze the challenges in learning *deep loop neural networks* with error back-propagation algorithm in Section \[sec:analysis\], and a new learning algorithm will be introduced in Section \[sec:method\]. Extensive numerical experiments will be provided to evaluate the model performance in Section \[sec:experiment\], and finally we will conclude this paper in Section \[sec:conclusion\].

Related Works {#sec:relatedwork}
=============

Two research topics are closely related to this paper, including deep learning and network representation learning, and we will provide a brief overview of the existing papers published on these two topics as follows.

**Deep Learning Research and Applications**: The essence of deep learning is to compute hierarchical features or representations of the observational data [@GBC16; @LBH15]. With the surge of deep learning research and applications in recent years, lots of research works have appeared to apply the deep learning methods, like deep belief network [@HOT06], deep Boltzmann machine [@SH09], deep neural network [@J02; @KSH12] and deep autoencoder model [@VLLBM10], in various applications, like speech and audio processing [@DHK13; @HDYDMJSVNSK12], language modeling and processing [@ASKR12; @MH09], information retrieval [@H12; @SH09], objective recognition and computer vision [@LBH15], as well as multimodal and multi-task learning [@WBU10; @WBU11].

**Network Embedding**: Network embedding has become a very hot research problem recently, which can project a graph-structured data to the feature vector representations. In graphs, the relation can be treated as a translation of the entities, and many translation based embedding models have been proposed, like TransE [@BUGWY13], TransH [@WZFC14] and TransR [@LLSLZ15]. In recent years, many network embedding works based on random walk model and deep learning models have been introduced, like Deepwalk [@PAS14], LINE [@TQWZYM15], node2vec [@GL16], HNE [@CHTQAH15] and DNE [@WCZ16]. Perozzi et al. extends the word2vec model [@MSCCD13] to the network scenario and introduce the Deepwalk algorithm [@PAS14]. Tang et al. [@TQWZYM15] propose to embed the networks with LINE algorithm, which can preserve both the local and global network structures. Grover et al. [@GL16] introduce a flexible notion of a node’s network neighborhood and design a biased random walk procedure to sample the neighbors. Chang et al. [@CHTQAH15] learn the embedding of networks involving text and image information. Chen et al. [@CS16] introduce a task guided embedding model to learn the representations for the author identification problem.

Learning Challenges Analysis of Deep Loopy Neural Network {#sec:analysis}
=========================================================

In this part, we will analyze the challenges in training the *deep loop neural network* with traditional error back propagation algorithm. To simplify the settings, we assume the *deep loop neural network* has only one hidden layer, i.e., $k=1$. According to the definition of the *deep loopy neural network* model provided in Section \[sec:intro\], we can represent the inferred labels for graph nodes, e.g., $v_i \in \mathcal{V}$, as vector ${{\mathbf}{y}}_i = [{y}_{i,1}, {y}_{i,2}, \cdots, {y}_{i,d}]^\top$, and its $j_{th}$ entry ${\mathbf}{y}_{i}(j)$ (or ${y}_{i,j}$) can be denoted as @size[9.5]{}@mathfonts $$\begin{cases}
{\mathbf}{y}_{i}(j) &\hspace{-10pt}= \sigma \big( \sum_{e = 1}^{m} {\mathbf}{W}^{y}(e, j) \cdot {\mathbf}{h}_{i}(e) + {\mathbf}{b}^{y}(j) \big),\\
 {\mathbf}{h}_{i}(e) &\hspace{-10pt}= \sigma \big( \sum_{c = 1}^n {\mathbf}{W}^{x}(c,e) \cdot {\mathbf}{x}_i(c) + {\mathbf}{b}^{x}(e) + \sum_{v_p \in \Gamma(v_i)} \sum_{f = 1}^m {\mathbf}{W}^h(f,e) \cdot {\mathbf}{h}_p(f) + {\mathbf}{b}^h(e) \big).
\end{cases}$$

Here, we will use the *mean square error* as an example of the loss function, and the loss introduced by the model for node $v_i \in \mathcal{V}$ compared with the ground truth label $\hat{{\mathbf}{y}}_i$ can be represented as $$E(v_i) = \frac{1}{2} \left\| {\mathbf}{y}_i - \hat{{\mathbf}{y}}_i \right\|_2^2 = \frac{1}{2} \sum_{j = 1}^d \left({\mathbf}{y}_i(j) - \hat{{\mathbf}{y}}_i(j) \right)^2.$$

Learning Output Layer Variables
-------------------------------

The variables involved in the *deep loopy neural network* model can be learned by error back propagation algorithm. For instance, here we will use SGD as the optimization algorithm. Given the node $v_i$ and its introduced error function $E(v_i)$, we can represent the updating equation for the variables in the output layer, e.g., ${\mathbf}{W}^y(e,j)$ and ${\mathbf}{b}^y(j)$, as follows: $$\begin{cases}
{\mathbf}{W}^y_{\tau}(e,j) &= {\mathbf}{W}^y_{\tau-1}(e,j) - \eta^w_{\tau} \cdot \frac{\partial E(v_i)}{\partial {\mathbf}{W}^y_{\tau-1}(e,j)}  ,\\
{\mathbf}{b}^y_{\tau}(j) &= {\mathbf}{b}^y_{\tau-1}(j) - \eta^b_{\tau} \cdot \frac{\partial E(v_i)}{\partial {\mathbf}{b}^y_{\tau-1}(j) } .
\end{cases}$$ where $\eta^w_{\tau}$ and $\eta^b_{\tau}$ denote the learning rates in updating ${\mathbf}{W}^y$ and ${\mathbf}{b}^y$ at iteration $\tau$ respectively.

According to the derivative chain rule, we can represent the partial derivative terms $\frac{\partial E(v_i)}{\partial {\mathbf}{W}^y_{\tau-1}(e,j)}$ and $\frac{\partial E(v_i)}{\partial {\mathbf}{b}^y_(j) }$ as follows respectively: $$\begin{cases}
\frac{\partial E(v_i)}{\partial {\mathbf}{W}^y(e,j)} &=  \frac{\partial E(v_i)}{\partial {\mathbf}{y}_i(j)} \cdot \frac{\partial {\mathbf}{y}_i(j)}{\partial {\mathbf}{z}^h_i(j)} \cdot \frac{\partial {\mathbf}{z}^h_i(j)}{\partial  {\mathbf}{W}^y(e,j)}= \big( {\mathbf}{y}_i(j) - \hat{{\mathbf}{y}}_i(j) \big) \cdot {\mathbf}{y}_i(j) \big( 1- {\mathbf}{y}_i(j) \big) \cdot {\mathbf}{h}_i(e),\vspace{5pt}\\
\frac{\partial E(v_i)}{\partial {\mathbf}{b}^y(j) } &=  \frac{\partial E(v_i)}{\partial {\mathbf}{y}_i(j)} \cdot \frac{\partial {\mathbf}{y}_i(j)}{\partial {\mathbf}{z}^h_i(j)} \cdot \frac{\partial {\mathbf}{z}^h_i(j)}{\partial  {\mathbf}{b}^y(j) }= \big( {\mathbf}{y}_i(j) - \hat{{\mathbf}{y}}_i(j) \big) \cdot {\mathbf}{y}_i(j) \big( 1- {\mathbf}{y}_i(j) \big) \cdot 1,
\end{cases}$$ where term ${\mathbf}{z}^h_i(j) = \sum_{e = 1}^{m} {\mathbf}{W}^{y}(e, j) \cdot {\mathbf}{h}_{i}(e) + {\mathbf}{b}^{y}(j)$.

Learning Hidden Layer and Input Layer Variables
-----------------------------------------------

Meanwhile, when updating the variables in the hidden and output layers, we will encounter great challenges in computing the partial derivatives of the error function regarding these variables. Given two connected nodes $v_i, v_j \in \mathcal{V}$, where $(v_i, v_j) \in \mathcal{E}$, from the graph, we have the representation of their hidden state vectors ${\mathbf}{h}_i$ and ${\mathbf}{h}_j$ as follows: $$\begin{aligned}
{\mathbf}{h}_i &=  \sigma \big({\mathbf}{W}^x {\mathbf}{x}_i + {\mathbf}{b}^x + {\mathbf}{W}^h {\mathbf}{h}_j + {\mathbf}{b}^h + \sum_{v_k \in \Gamma(v_i) \setminus \{v_j\}} ({\mathbf}{W}^h {\mathbf}{h}_{k} + {\mathbf}{b}^h) \big),\\
{\mathbf}{h}_j &=   \sigma \big({\mathbf}{W}^x {\mathbf}{x}_j + {\mathbf}{b}^x + {\mathbf}{W}^h {\mathbf}{h}_i + {\mathbf}{b}^h + \sum_{v_k' \in \Gamma(v_j) \setminus \{v_i\}} ({\mathbf}{W}^h {\mathbf}{h}_{k'} + {\mathbf}{b}^h) \big).\end{aligned}$$ We can observe that ${\mathbf}{h}_i$ and ${\mathbf}{h}_j$ co-rely on each other in the computation, whose representation will be involved in an infinite recursive definition. When we compute the partial derivative of error function regarding variable ${\mathbf}{W}^x$, ${\mathbf}{b}^x$ or ${\mathbf}{W}^h$, ${\mathbf}{b}^h$, we will have an infinite partial derivative sequence involving ${\mathbf}{h}_i$ and ${\mathbf}{h}_j$ according to the chair rule. The problem will be much more serious for connected graphs, as illustrated by the following theorem.

\[theo:dependency\] Let $G$ denote the input graph. If graph $G$ is connected (i.e., there exist a path connecting any pairs of nodes in the graph), for any node $v_i$ in the graph, its hidden state vector ${\mathbf}{h}_i$ will be involved in the hidden state representation of all the other nodes in the graph.

The Theorem can be proved via contradiction.

Here, we assume hidden state vector ${\mathbf}{h}_i$ is not involved in the hidden representation of a certain node $v_j$, i.e., ${\mathbf}{h}_j$. Formally, given the neighbor set $\Gamma(v_j)$ of node $v_j$ in the network, we know that vector ${\mathbf}{h}_j$ is defined based on the hidden state vectors $\{{\mathbf}{h}_k\}_{v_k \in \Gamma(v_i)}$. Therefore, we can assert that vector ${\mathbf}{h}_i$ should also not be involved in the representation of all the nodes in $\Gamma(v_j)$. Viewed in this perspective, we can also show that ${\mathbf}{h}_i$ is not involved in the hidden state representations of the 2-hop neighbors of node $v_j$, as well as the 3-hop, and so forth.

Considering that graph $G$ is connected, we know there should exist a path of length $p$ connecting $v_j$ with $v_i$, i.e., $v_i$ will be a $p$-hop neighbor of node $v_j$, which will contract the claim ${\mathbf}{h}_i$ is not involved in the hidden state representations of the $p$-hop neighbors of node $v_j$. Therefore, the assumption we make at the beginning doesn’t hold and we will prove the theorem.

According to the above theorem, when we try to compute the derivative of the error function regarding variable ${\mathbf}{W}^x$, we will have $$\frac{\partial E(v_i)}{\partial {\mathbf}{W}^x} = \frac{\partial E(v_i)}{\partial {\mathbf}{y}_i} \cdot \frac{\partial {\mathbf}{y}_i}{\partial {\mathbf}{z}^h_i} \cdot \frac{\partial {\mathbf}{z}^h_i} {\partial {\mathbf}{h}_i} \cdot \bigg( \frac{\partial {\mathbf}{h}_i} {\partial {\mathbf}{W}^x} + \sum_{v_j \in \mathcal{V}} \frac{\partial {\mathbf}{h}_i} {\partial {\mathbf}{h}_j} \cdot  \Big( \frac{\partial {\mathbf}{h}_j} {\partial {\mathbf}{W}^x}  + \sum_{v_k \in \mathcal{V}} \frac{\partial {\mathbf}{h}_j} {\partial {\mathbf}{h}_k} \cdot \big( \cdots  \big)  \Big) \bigg)$$ Due to the recursive definition of the hidden state vector $\{{\mathbf}{h}_i\}_{v_i \in \mathcal{V}}$ in the network, the partial derivative of term $\frac{\partial E(v_i)}{\partial {\mathbf}{W}^x}$ will be impossible to compute mathematically. The partial derivative sequence will extend to an infinite length according to Theorem \[theo:dependency\]. Similar phenomena can be observed when computing the partial derivative of the error function regarding variables ${\mathbf}{b}^x$ or ${\mathbf}{W}^h$, ${\mathbf}{b}^h$.

Proposed Method {#sec:method}
===============

To resolve the challenges introduced in the previous section, in this part, we will propose an approximation algorithm to learn the *deep loopy neural network* model. Given the complete model architecture (which is also in a graph shape), to differentiate it from the input graph data, we will name it as the *model graph* formally, the neuron vectored involved in which are called the neuron nodes by default. From the *model graph*, we propose to extract a set of tree structured model diagrams rooted at certain neuron states in the model graph. Model learning will be mainly performed on these extracted rooted trees instead.

g-Hop Model Subgraph and Rooted Spanning Tree Extraction
--------------------------------------------------------

Given the *deep loopy neural network* model graph, involving the input, output and hidden state variables and the projections parameterized by the variables to be learned, we propose to extract a set of *g-hop subgraph* (*g-subgraph*) around certain target neuron node from it, where all the neuron nodes involved are within $g$ hops from the target neuron node.

(**g-hop subgraph**): Given the *deep loopy neural network* model graph $\mathcal{G} = (\mathcal{N}, \mathcal{L})$ and a target neuron node, e.g., ${{\mathbf}{n}}\in \mathcal{N}$, we can represent the extracted *g-subgraph* rooted at ${{\mathbf}{n}}$ as $\mathcal{G}_{{\mathbf}{n}} = (\mathcal{N}_{{\mathbf}{n}}, \mathcal{L}_{{\mathbf}{n}})$, where $\mathcal{N}_{{\mathbf}{n}} \subset \mathcal{N}$ and $\mathcal{L}_{{\mathbf}{n}} \subset \mathcal{L}$. For all the nodes in set $\mathcal{N}_{{\mathbf}{n}}$, formed by links in $\mathcal{L}_{{\mathbf}{y}_i}$, there exist a directed path of length less than $g$ connecting the neuron node ${{\mathbf}{n}}$ with them.

![image](./subgraph_tree.pdf){width="100.00000%"}

For instance, from the *deep loopy neural network* model graph (with $1$ hidden layer) as shown in the left plot of Figure \[fig:example\], we can extract a *3-subgraph* rooted at neuron node ${\mathbf}{y}_1$ as shown in the central plot. In the sub-graph, it contains the feature, label and hidden state vectors of nodes $v_2, v_3, v_4$ as well as the hidden state vector of $v_5$, whose feature and label vectors are not included since they are 4-hops away from ${\mathbf}{h}_1$.

In the model graph, the link direction denote the forward propagation direction. In the model learning process, the error information will propagate from the output layer, i.e., the label neuron nodes, backward to the hidden state and input neuron nodes along the reversed direction of these links. For instance, given the target node ${\mathbf}{y}_1$, its error can be propagated to ${\mathbf}{h}_1, {\mathbf}{h}_2, \cdots, {\mathbf}{h}_5$ and ${\mathbf}{x}_1, {\mathbf}{x}_2, {\mathbf}{x}_3, {\mathbf}{x}_4$, but cannot reach ${\mathbf}{y}_2$, ${\mathbf}{y}_3$ and ${\mathbf}{y}_4$. Meanwhile, to resolve the recursive partial derivative problem introduced in the previous section, in this paper, we propose to further extract a *g-hop rooted spanning tree* (*g-tree*) from the *g-subgraph*. The extracted *g-tree* will be acyclic and all the involved links are from the children nodes to the parent nodes only.

(**g-hop rooted spanning tree**): Given the extracted *g-subgraph* around the target neuron node ${\mathbf}{n}$, i.e., $\mathcal{G}_{{\mathbf}{n}} = (\mathcal{N}_{{\mathbf}{n}}, \mathcal{L}_{{\mathbf}{n}})$, we can represent its *g-tree* as $\mathcal{T}_{{\mathbf}{n}} = (\mathcal{S}_{{\mathbf}{n}}, \mathcal{R}_{{\mathbf}{n}}, {\mathbf}{n})$, where ${\mathbf}{n}$ is the root, sets $\mathcal{S}_{{\mathbf}{n}} \subset \mathcal{N}_{{\mathbf}{n}}$ and $\mathcal{R}_{{\mathbf}{n}} \subset \mathcal{L}_{{\mathbf}{n}}$. All the links in $\mathcal{P}_{{\mathbf}{n}}$ are pointing from the children nodes to the parent nodes.

For instance, in the right plot of Figure \[fig:example\], we display an example of the extracted *3-tree* rooted at neuron node ${\mathbf}{y}_1$. From the plot, we observe that all the label vectors are removed, since there exist no directed edges from them to the root node. Among all the nodes, ${\mathbf}{h}_1$ is $1$-hop away from ${\mathbf}{y}_1$, ${\mathbf}{x}_1$, ${\mathbf}{h}_2$, ${\mathbf}{h}_3$ and ${\mathbf}{h}_4$ are $2$-hop away from ${\mathbf}{y}_1$, and all the remaining nodes are $3$ hops away from ${\mathbf}{h}_1$. Given any two pair of connected nodes in the *3-tree*, e.g., ${\mathbf}{x_1}$ and ${\mathbf}{y}_1$ (or ${\mathbf}{h}_4$ and ${\mathbf}{h}_5$), the edges connecting them clearly indicate the variables to be learned via error back propagation across them. When learning the *loopy neural network*, instead of using the whole network, we propose to back propagate the errors from the root, e.g., ${\mathbf}{y}_1$, to the remaining nodes in the extracted *3-tree*.

Given $g = \infty$, the learning process based on *g-tree* will be identical as learning based on the original network. Meanwhile, in the case when $g$ is a finite number and $g \ge \mbox{diameter}(\mathcal{G})$, the *g-tree* of any nodes will actually cover all the neuron nodes and variables to be learned.

The proof to the above theorem will not be introduced here due to the limited space. Generally, larger $g$ can preserve more complete network structure information. However, on the other hand, as $g$ increases, the paths involved in the *g-tree* from the leaf node to the root node will also be longer, which may lead to the gradient vanishing/exploding problem as well [@PMB13].

Rooted Spanning Tree based Learning Algorithm for Loopy Neural Network Model
----------------------------------------------------------------------------

Based on the extracted *g-tree*, the *deep loopy neural network* model can be effectively trained, and in this section we will introduce the general learning algorithm in detail. Formally, let $\mathcal{T}_{{\mathbf}{n}} = (\mathcal{S}_{{\mathbf}{n}}, \mathcal{R}_{{\mathbf}{n}}, {\mathbf}{n})$ denote an extracted spanning tree rooted at neuron node ${\mathbf}{n}$. Based on the errors computed on node ${\mathbf}{n}$ (if ${\mathbf}{n}$ is in the output layer) or the errors propagated to ${\mathbf}{n}$, we can further back propagate the errors to the remaining nodes in $\mathcal{S}_{{\mathbf}{n}} \setminus \{{\mathbf}{n}\}$.

Formally, from the spanning tree $\mathcal{T}_{{\mathbf}{n}} = (\mathcal{S}_{{\mathbf}{n}}, \mathcal{R}_{{\mathbf}{n}}, {\mathbf}{n})$, we can define the set of variables involved as $\mathcal{W}$, which can be indicated by the links in set $\mathcal{R}_{{\mathbf}{n}}$. For instance, given the *3-tree* as shown in Figure \[fig:example\], we know that there exist three types of variables involved in the tree diagram, where the variable set $\mathcal{W} = \{{\mathbf}{W}^x, {\mathbf}{b}^x, {\mathbf}{W}^y, {\mathbf}{b}^y, {\mathbf}{W}^h, {\mathbf}{b}^h\}$. For the spanning trees extracted from deeper neural network models, the variable type set will be much larger. Meanwhile, given a random node ${\mathbf}{m} \in \mathcal{S}_{{\mathbf}{n}}$, we will use notation $\mathcal{T}_{{\mathbf}{n}}({\mathbf}{m})$ to denote a subtree of $\mathcal{T}_{{\mathbf}{n}}$ rooted at ${\mathbf}{m}$, and notation $\Gamma({\mathbf}{m})$ to represent the children neuron nodes of ${\mathbf}{m}$ in $\mathcal{T}_{{\mathbf}{n}}$. Furthermore, for simplicity, we will use notation ${\mathbf}{W} \in \mathcal{T}$ to denote that variable ${\mathbf}{W} \in \mathcal{W}$ is involved in the tree or sub-tree $\mathcal{T}$.

Given the spanning tree $\mathcal{T}_{{\mathbf}{n}}$ together with the errors $E({\mathbf}{n})$ computed at ${\mathbf}{n}$ (or propagated to ${\mathbf}{n}$), regarding a variable ${\mathbf}{W} \in \mathcal{W}$, we can first define a basic learning operation between neuron nodes ${\mathbf}{x}, {\mathbf}{y} \in \mathcal{S}_{{\mathbf}{n}}$ (where ${\mathbf}{y} \in \Gamma({\mathbf}{x})$) as follows: $$\mbox{\textsc{Prop}}({\mathbf}{x}, {\mathbf}{y}; {\mathbf}{W}) = 
\begin{cases} 
\mathbbm{1}\big({\mathbf}{W} \in \mathcal{T}_{{\mathbf}{n}}({\mathbf}{m})\big) \frac{\partial {\mathbf}{x}}{\partial {\mathbf}{W}}, & \mbox{ if ${\mathbf}{y}$ is a leaf node};\\
\mathbbm{1}\big({\mathbf}{W} \in \mathcal{T}_{{\mathbf}{n}}({\mathbf}{m})\big) \frac{\partial {\mathbf}{x}}{\partial {\mathbf}{y}} \cdot \Big( \sum_{{\mathbf}{z} \in \Gamma({\mathbf}{y})} \mbox{\textsc{Prop}}({\mathbf}{y}, {\mathbf}{z}; {\mathbf}{W}) \Big), & \mbox{ otherwise}.
\end{cases}$$

Based on the above operation, we can represent the partial derivative of the error function $E({\mathbf}{n})$ regarding variable ${\mathbf}{W}$ as: $$\begin{aligned}
\frac{\partial E({\mathbf}{n})}{\partial {\mathbf}{W}} = \frac{\partial E({\mathbf}{n})}{\partial {\mathbf}{n}} \cdot \big(\sum_{{\mathbf}{m} \in \Gamma({\mathbf}{n})} \mbox{\textsc{Prop}}({\mathbf}{n}, {\mathbf}{m}; {\mathbf}{W})  \big)\end{aligned}$$

Formally, given a $g$-hop rooted spanning tree $\mathcal{T}_{{\mathbf}{n}}$, the $\mbox{\textsc{Prop}}({\mathbf}{x}, {\mathbf}{y}; {\mathbf}{W})$ operation will be called at most $\frac{ (d_{\max} + 1)^{k+1} - d_{\max} - 1}{d_{\max}}$ times in computing the partial derivative term $\frac{\partial E({\mathbf}{n})}{\partial {\mathbf}{W}}$, where $d_{\max}$ denotes the largest node degree in the original input graph data $G$.

Operation $\mbox{\textsc{Prop}}({\mathbf}{x}, {\mathbf}{y}; {\mathbf}{W})$ will be called for each node in the spanning tree $\mathcal{T}_{{\mathbf}{n}}$ except the root node. Formally, given a max node degree $d_{\max}$ in the original graph, the largest number of children node connected to a random neuron node in the spanning tree will be $d_{\max} + 1$ ($+1$ because of the connection from the lower layer neuron node). The maximum number of nodes (except the root node) in the spanning tree of depth $g$ can be denoted as the sum $$(d_{\max} + 1) + (d_{\max} + 1)^2 +  (d_{\max} + 1)^3 + \cdots + (d_{\max} + 1)^g,$$ which equals to $\frac{ (d_{\max} + 1)^{g+1} - d_{\max} - 1}{d_{\max}}$ as indicated in the theorem.

Considering that in the model, the hidden neuron nodes are computed based on the lower-level neurons and they don’t have input representations. To make the model learnable, as indicated by the bottom gray layer below the *g-tree* in Figure \[fig:example\], we propose to append the input feature representations to the *g-tree* leaf nodes, based on which we will be able to compute the node hidden states. The learning process will involve several epochs until convergence, where each epoch will enumerate all the nodes in the graph once. To further boost the convergence rate, several latest optimization algorithms, e.g., Adam [@KB14], can be adopted to replace traditional SGD in updating the model variables.

Numerical Experiments {#sec:experiment}
=====================

To test the effectiveness of the proposed *deep loopy neural network* and the learning algorithm, extensive numerical experiments have been done on several frequently used graph benchmark datasets, including two social networks: Foursquare and Twitter, as well as two knowledge graphs: Douban and IMDB, which will be introduced in this section.

  ------------------------------------------------------------------------- ----------------------- ------------------------- ------------------------- --------------------
                                                                                                                                                        
                             (lr)[2-5]{} methods                                    [MSE]{}                  [MAE]{}                   [LRS]{}           [[ avg. rank]{}]{}
        [[[<span style="font-variant:small-caps;">LNN</span>]{}]{}]{}        **0.035**$\pm$**0.0**   **0.067**$\pm$**0.001**   **0.102**$\pm$**0.002**        [ (1)]{}
   [[<span style="font-variant:small-caps;">DeepWalk</span>]{}]{} [@PAS14]       0.05$\pm$0.0             0.097$\pm$0.0            0.129$\pm$0.003            [ (7)]{}
   [[<span style="font-variant:small-caps;">WalkLets</span>]{}]{} [@PKS16]      0.046$\pm$0.001          0.087$\pm$0.001           0.108$\pm$0.001            [ (2)]{}
   [[<span style="font-variant:small-caps;">LINE</span>]{}]{} [@TQWZYM15]        0.048$\pm$0.0           0.091$\pm$0.001           0.12$\pm$0.003             [ (6)]{}
     [[<span style="font-variant:small-caps;">HPE</span>]{}]{} [@CTLY16]        0.046$\pm$0.001          0.077$\pm$0.001           0.111$\pm$0.002            [ (2)]{}
    [[<span style="font-variant:small-caps;">App</span>]{}]{} [@ZLLLG17]         0.05$\pm$0.0             0.099$\pm$0.0            0.127$\pm$0.002            [ (8)]{}
     [[<span style="font-variant:small-caps;">MF</span>]{}]{} [@CHHH11]          0.045$\pm$0.0           0.089$\pm$0.001       **0.102**$\pm$**0.001**        [ (4)]{}
     [[<span style="font-variant:small-caps;">Bpr</span>]{}]{} [@RFGS09]         0.046$\pm$0.0            0.089$\pm$0.0            0.114$\pm$0.002            [ (5)]{}
  ------------------------------------------------------------------------- ----------------------- ------------------------- ------------------------- --------------------

\[tab:douban\_result\]

  ------------------------------------------------------------------------- ----------------------- ------------------------- ------------------------- --------------------
                                                                                                                                                        
                             (lr)[2-5]{} methods                                    [MSE]{}                  [MAE]{}                   [LRS]{}           [[ avg. rank]{}]{}
        [[[<span style="font-variant:small-caps;">LNN</span>]{}]{}]{}        **0.046**$\pm$**0.0**   **0.090**$\pm$**0.001**   **0.116**$\pm$**0.002**        [ (1)]{}
   [[<span style="font-variant:small-caps;">DeepWalk</span>]{}]{} [@PAS14]       0.065$\pm$0.0           0.128$\pm$0.001           0.187$\pm$0.002            [ (7)]{}
   [[<span style="font-variant:small-caps;">WalkLets</span>]{}]{} [@PKS16]       0.057$\pm$0.0           0.112$\pm$0.001           0.139$\pm$0.003            [ (3)]{}
   [[<span style="font-variant:small-caps;">LINE</span>]{}]{} [@TQWZYM15]        0.061$\pm$0.0           0.121$\pm$0.001           0.169$\pm$0.004            [ (6)]{}
     [[<span style="font-variant:small-caps;">HPE</span>]{}]{} [@CTLY16]         0.055$\pm$0.0           0.107$\pm$0.001           0.127$\pm$0.003            [ (2)]{}
    [[<span style="font-variant:small-caps;">App</span>]{}]{} [@ZLLLG17]         0.066$\pm$0.0           0.13$\pm$0.001            0.193$\pm$0.002            [ (7)]{}
     [[<span style="font-variant:small-caps;">MF</span>]{}]{} [@CHHH11]          0.055$\pm$0.0           0.112$\pm$0.001           0.129$\pm$0.003            [ (3)]{}
     [[<span style="font-variant:small-caps;">Bpr</span>]{}]{} [@RFGS09]         0.058$\pm$0.0            0.117$\pm$0.0            0.157$\pm$0.002            [ (5)]{}
  ------------------------------------------------------------------------- ----------------------- ------------------------- ------------------------- --------------------

\[tab:imdb\_result\]

Experimental Settings
---------------------

The basic statistics information about the graph datasets used in the experiments are as follows:

-   *Douban*: Number of Nodes: $11,297$; Number of Links: $753,940$.

-   *IMDB*: Number of Nodes: $13,896$; Number of Links: $1,404,202$.

-   *Foursquare*: Number of Nodes: $5,392$; Number of Links: $111,852$.

-   *Twitter*: Number of Nodes: $5,120$; Number of Links: $261,151$.

Both Foursquare and Twitter are online social networks. The nodes and links involved in Foursquare and Twitter denote the users and their friendships respectively. Douban and IMDB are two movie knowledge graphs, where the nodes denote the movies. Based on the movie cast information, we construct the connections among the movies, where two movies can be linked if they share a common cast member. Besides the network structure information, a group of node attributes can also be collected for users and movies, which cover the user and movie basic profile information respectively. Based on the attribute information, a set of features can be extracted as the node input feature information. In the experiments, we use the movie genre and user hometown state as the labels. These labeled nodes are partitioned into training and testing sets via $5$-fold cross validation: $4$-fold for training, and $1$-fold for testing.

Meanwhile, to demonstrate the advantages of the learned *deep loopy neural network* against the other existing network embedding models, many baseline methods are compared with *deep loopy neural network* in the experiments. The baseline methods cover the state-of-the-art methods on graph data representation learning published in recent years, which include [[<span style="font-variant:small-caps;">DeepWalk</span>]{}]{} [@PAS14], [[<span style="font-variant:small-caps;">WalkLets</span>]{}]{} [@PKS16], [[<span style="font-variant:small-caps;">LINE</span>]{}]{} (Large-scale Information Network Embedding) [@TQWZYM15], [[<span style="font-variant:small-caps;">HPE</span>]{}]{} (Heterogeneous Preference Embedding) [@CTLY16], [[<span style="font-variant:small-caps;">App</span>]{}]{} (Asymmetric Proximity Preserving graph embedding) [@ZLLLG17], [[<span style="font-variant:small-caps;">MF</span>]{}]{} (Matrix Factorization) [@CHHH11] and [[<span style="font-variant:small-caps;">Bpr</span>]{}]{} (Bayesian Personalized Ranking) [@RFGS09]. For these network representation baseline methods, based on the learned representation features, we will further train a MLP (multiple layer perceptron) as the classifier. By comparing the inference results by the models on the testing set with the ground truth label vectors, we will use MSE (mean square error), MAE (mean absolute error) and LRS (label ranking loss) as the evaluation metrics. Detailed experimental results will be provided in the following subsection.

  ------------------------------------------------------------------------- ------------------------- ------------------------- ------------------------- --------------------
                                                                                                                                                          
                             (lr)[2-5]{} methods                                     [MSE]{}                   [MAE]{}                   [LRS]{}           [[ avg. rank]{}]{}
        [[[<span style="font-variant:small-caps;">LNN</span>]{}]{}]{}            0.002$\pm$0.001       **0.003**$\pm$**0.001**   **0.121**$\pm$**0.001**        [ (1)]{}
   [[<span style="font-variant:small-caps;">DeepWalk</span>]{}]{} [@PAS14]       0.002$\pm$0.001           0.004$\pm$0.001           0.149$\pm$0.007            [ (3)]{}
   [[<span style="font-variant:small-caps;">WalkLets</span>]{}]{} [@PKS16]   **0.001**$\pm$**0.001**       0.004$\pm$0.001          0.216$\pm$0.0016            [ (3)]{}
   [[<span style="font-variant:small-caps;">LINE</span>]{}]{} [@TQWZYM15]        0.002$\pm$0.001       **0.003**$\pm$**0.001**      0.309$\pm$0.0017            [ (6)]{}
     [[<span style="font-variant:small-caps;">HPE</span>]{}]{} [@CTLY16]     **0.001**$\pm$**0.001**   **0.003**$\pm$**0.001**      0.246$\pm$0.0016            [ (2)]{}
    [[<span style="font-variant:small-caps;">App</span>]{}]{} [@ZLLLG17]         0.002$\pm$0.001           0.012$\pm$0.001           0.145$\pm$0.001            [ (5)]{}
     [[<span style="font-variant:small-caps;">MF</span>]{}]{} [@CHHH11]          0.002$\pm$0.001           0.013$\pm$0.001           0.173$\pm$0.006            [ (7)]{}
     [[<span style="font-variant:small-caps;">Bpr</span>]{}]{} [@RFGS09]         0.002$\pm$0.001           0.021$\pm$0.001           0.235$\pm$0.023            [ (8)]{}
  ------------------------------------------------------------------------- ------------------------- ------------------------- ------------------------- --------------------

\[tab:foursquare\_result\]

  ------------------------------------------------------------------------- ----------------- ------------------------- -------------------------- --------------------
                                                                                                                                                   
                             (lr)[2-5]{} methods                                 [MSE]{}               [MAE]{}                   [LRS]{}            [[ avg. rank]{}]{}
        [[[<span style="font-variant:small-caps;">LNN</span>]{}]{}]{}        0.001$\pm$0.001   **0.002**$\pm$**0.001**   **0.276**$\pm$**0.0013**        [ (1)]{}
   [[<span style="font-variant:small-caps;">DeepWalk</span>]{}]{} [@PAS14]   0.001$\pm$0.001       0.003$\pm$0.001            0.31$\pm$0.028             [ (3)]{}
   [[<span style="font-variant:small-caps;">WalkLets</span>]{}]{} [@PKS16]   0.001$\pm$0.001       0.003$\pm$0.001           0.309$\pm$0.006             [ (2)]{}
   [[<span style="font-variant:small-caps;">LINE</span>]{}]{} [@TQWZYM15]    0.001$\pm$0.001       0.003$\pm$0.001           0.455$\pm$0.008             [ (6)]{}
     [[<span style="font-variant:small-caps;">HPE</span>]{}]{} [@CTLY16]     0.001$\pm$0.001       0.003$\pm$0.001           0.351$\pm$0.001             [ (4)]{}
    [[<span style="font-variant:small-caps;">App</span>]{}]{} [@ZLLLG17]      0.001$\pm$0.0         0.015$\pm$0.0            0.308$\pm$0.0018            [ (5)]{}
     [[<span style="font-variant:small-caps;">MF</span>]{}]{} [@CHHH11]      0.001$\pm$0.001       0.013$\pm$0.001           0.341$\pm$0.0017            [ (7)]{}
     [[<span style="font-variant:small-caps;">Bpr</span>]{}]{} [@RFGS09]     0.002$\pm$0.001       0.023$\pm$0.001           0.374$\pm$0.0015            [ (8)]{}
  ------------------------------------------------------------------------- ----------------- ------------------------- -------------------------- --------------------

\[tab:twitter\_result\]

Experimental Results
--------------------

The results achieved by the comparison methods on these $4$ different graph datasets are provided in Tables \[tab:douban\_result\]-\[tab:twitter\_result\]. The best results are presented in a bolded font, and the blue numbers in the table denote the relative rankings of the methods regarding certain evaluation metrics. Compared with the baseline methods, *deep loopy neural network* can achieve the best performance than the baseline methods. For instance in Table \[tab:douban\_result\], the MSE obtained by *deep loopy neural network* is $0.035$, which about $7.8\%$ lower than the MSE obtained by the $2nd$ best method, i.e., [[<span style="font-variant:small-caps;">MF</span>]{}]{}; and $30\%$ lower than that of [[<span style="font-variant:small-caps;">App</span>]{}]{}. Similar results can be observed for the MAE and LRS metrics. At the right hand side of the tables, we illustrate the average ranking positions achieved by the methods based on these $3$ different evaluation metrics. According to the *avg. rank* shown in Tables \[tab:douban\_result\], \[tab:imdb\_result\] and \[tab:twitter\_result\], [[<span style="font-variant:small-caps;">LNN</span>]{}]{} can achieve the best performance consistently for all the metrics based on the Douban, IMDB, Foursquare and Twitter datasets. Although in Table \[tab:foursquare\_result\], the *deep loopy neural network* model loses to [[<span style="font-variant:small-caps;">HPE</span>]{}]{} and [[<span style="font-variant:small-caps;">Bpr</span>]{}]{} regarding the MSE metric, but for the other two metrics, it still outperforms all the baseline methods with significant advantages according to the results.

Conclusion {#sec:conclusion}
==========

In this paper, we have introduced the *deep loopy neural network* model, which is a new deep learning model proposed for the graph structured data specifically. Due to the extensive connections among nodes in the input graph data, the constructed *deep loopy neural network* model is very challenging to learn with the traditional error back-propagation algorithm. To resolve such a problem, we propose to extract a set of *k-hop subgraph* and *k-hop rooted spanning tree* from the model architecture, via which the errors can be effectively propagated throughout the model architecture. Extensive experiments have been done on several different categories of graph datasets, and the numerical experiment results demonstrate the effectiveness of both the proposed *deep loopy neural network* model and the introduced learning algorithm.
