# Learning Embedding for Signed Network in Social Media with Hierarchical Graph Pooling
## 4 Proposed Signed Network Embedding with Hierarchical Graph Pooling
### The Objective Function  
This section describes the objective function as well as the training details of SHGP. Positive links, negative links, and no links are all represented as \(s=\{+,-,?\}\), where \"no links\" implies that there are no links between node \(v_{i}\) and \(v_{j}\). In the hidden space, we choose to reduce the distance between positive node pairs as much as possible while increasing the distance between negative node pairs. The optimization problem is then transformed into a three-classification problem. We utilize the node mini-batch training approach to build a collection of edge triples, which we then use to test our hypothesis \(\mathcal{T}\). \(\mathcal{T}\) consists of triplets of the form \(\big{(}v_{i},v_{j},s_{ij}\big{)}\), where \(s_{ij}\in s\) refers to which type of link exists between \(v_{i}\) and \(v_{j}\). We use one hot to encode the type triples of the edges \(s_{ij}\) as \(s_{ij}\in\{0,1\}\)S, and then the cross-entropy error over \(\mathcal{T}\) can be defined as follow:  
\[\mathcal{L}_{entropy}=\frac{1}{\mathcal{T}}\sum\
olimits_{(v_{i},v_{j},s_{ij} )\in\mathcal{T}}loss\big{(}h_{i},h_{j},s_{ij}\big{)} \tag{10}\]  
\[loss\big{(}h_{i},h_{j},s_{ij}\big{)}=-w_{s_{ij}}\sum\
olimits_{k=1}^{S}s_{ij }(k)log\frac{exp\big{(}[h_{i}\parallel h_{j}]\theta_{s}^{S}\big{)}}{\sum \
olimits_{s=1}^{S}exp\big{(}[h_{i}\parallel h_{j}]\theta_{s}^{S}\big{)}} \tag{11}\]  
where \(\theta_{*}^{S}\) denotes the parameters of the softmax regression classifier.  
We construct a distinct weight for each link type \(s_{ij}\in s\), depending on the amount of positive and negative connections in the signed networks, and produce \"no link\", as stated in [16]. This is undertaken because signed networks are sparse and contain an unbalance of positive and negative links.  
According to the extended structural balancing theory, nodes with positive links are close, nodes with negative links are far, and node pairs without ties are in the middle. The triad-based objective function can be mathematically defined as follows:  
\[\mathcal{L}_{pos}=\frac{1}{\mathcal{T}_{(+,?)}}\sum\
olimits_{(v_{i},v_{j},v_{ k})}max\Big{(}0,\Big{(}\parallel h_{i}-h_{j}\parallel_{2}^{2}-\parallel h_{i}-h_ {k}\parallel_{2}^{2}\Big{)}\Big{)} \tag{12}\]  
\[\mathcal{L}_{neg}=\frac{1}{\mathcal{T}_{(-,?)}}\sum\
olimits_{(v_{i},v_{i},v_{ k})}max\Big{(}0,\Big{(}\parallel h_{i}-h_{k}\parallel_{2}^{2}-\parallel h_{i}-h_ {j}\parallel_{2}^{2}\Big{)}\Big{)} \tag{13}\]  
where \(\mathcal{T}_{(+,?)}\) and \(\mathcal{T}_{(-,?)}\) are the sets for node pairs from \(\mathcal{T}\).  
Based on the objectives of the edge signed classification and structural balance theory, the overall objective function can be defined as:  
\[\mathcal{L}=\mathcal{L}_{entropy}+\lambda\big{[}\big{(}\mathcal{L}_{pos}+ \mathcal{L}_{neg}\big{)}+\mathcal{L}_{reg}\big{]} \tag{14}\]  
Figure 3: An illustration of the proposed signed graph pooling layer with k = 2. We consider four nodes from balanced node set, and each node has 3-dimension features. The yellow block is the trainable projection vector. After that, we can select the top two nodes. After the gate stage, we can achieve the new output.  
where \(\lambda\) denotes the weight of different loss functions, and \(\mathcal{L}_{reg}\) denotes the variable regularizer of our proposed framework.