## 5 Surrounding-Aware Individual Emotion Prediction Model
### Surrounding Attention Network  
Another important factor is the influence of the social network environment, that is, how neighbor individual emotional states influence each other. In this section, the surrounding attention network, a memory-based attention network similar to the time-evolving attention network, is used to explore the influence of neighboring individual emotional states. Given a specific user \(v_{i}\), the emotion time series set of their neighbors \(\hat{v}=\{\vartheta_{(1)},\vartheta_{(2)},\dots,\vartheta_{(n)}\}\) is denoted by \(\hat{X}=\{\hat{X}_{(1)},\hat{X}_{(2)},\dots,\hat{X}_{(n)}\}\). Then, the collection of neighbors' observed series \(\hat{X}^{{}^{\prime}}=\{\hat{X}^{{}^{\prime}}_{(1)},\hat{X}^{{}^{\prime}}_{(2 )},\dots,\hat{X}^{{}^{\prime}}_{(n)}\}\), and the set of time interval series of neighbors \(\hat{\Delta T}=\{\hat{\Delta T}_{(1)},\hat{\Delta T}_{(2)},\dots,\hat{\Delta T }_{(n)}\}\) are obtained. For each neighbor \(\vartheta_{(n)}\), a T-LSTM network encodes their individual emotion time series with the observed series \(\hat{X}^{{}^{\prime}}_{(n)}\) and the time interval series \(\hat{\Delta T}_{(n)}\) as the input data, and obtains the set of encoder's hidden states \(\hat{h}=\{\hat{h}_{(1)^{\prime}},\hat{h}_{(2)},\dots,\hat{h}_{(n)}\}\) by the means of following Equation (16). \[\hat{h}_{u(n)},\hat{\epsilon}_{u(n)}=T-LSTM(\hat{x}^{{}^{\prime}}_{u(n)}, \hat{\Delta t}_{u(n)},\hat{h}_{u-1(n)},\hat{\epsilon}_{u-1(n)}) \tag{16}\]  
where \(\hat{h}_{u(n)}\) and \(\hat{\epsilon}_{u(n)}\) are the hidden state and cell-adjusted state of user \(\hat{v_{n}}\), respectively. It is important that all parameters in the surrounding attention network are shared by all neighbors. In the encoding step, the set of neighbors' memory representations \(\hat{C}=\{\hat{C}_{(1)},\hat{C}_{(2)},\dots,\hat{C}_{(n)}\}\) is updated, the element \(\hat{C}_{(n)}\in\mathbb{R}^{Z\times D}\) is a fixed-size memory representation of the neighbor \(\vartheta_{(n)}\), where \(Z\) is the number of time-evolving context vectors, and \(D\) is the size of the cell states. First, a score vector \(\hat{\alpha}_{(n)}\) is obtained by predicting the \(Z\) scores at each encoding step. The memory representation \(\hat{C}_{(n)}\) in Equation (17) is then calculated as a weighted sum over a score vector \(\hat{\alpha}_{u(n)}\) (Equation (18)). \[\hat{C}_{z(n)}=\sum_{u=0}^{|U|}\hat{\alpha}_{zu(n)}\hat{h}_{u(n)} \tag{17}\]\[\hat{a}_{zu(n)}=softmax(\hat{h}_{u(n)}W_{\hat{a}}\circ l_{u}) \tag{18}\]  
where \(W_{\hat{a}}\in\mathbb{R}^{Z}\) denotes a parameter matrix, and \(l_{u}\) is a vector of position encodings that can make the learning attention context different. \(l_{u}\) was calculated using Equation (12). Note that in the surrounding attention network, \(W_{\hat{a}}\) is shared by all neighbors. The decoding phase of the surrounding attention network is aimed at obtaining the surrounding context vector \(\hat{\mathbf{a}}\). There are slight differences from the calculation of time-evolving context vector in the Section 5.3, the memory representations of the neighbors are used as input, rather than the fixed-size memory representation of a single user. Therefore, the neighbors' memory representations \(\hat{C}=\{\hat{C}_{(1)},\hat{C}_{(2)},\dots,\hat{C}_{(n)}\}\) are concatenated, called surrounding memory representation \(\widetilde{C}\). To compute the surrounding context vector \(\hat{\mathbf{a}}\), a score vector \(\hat{\beta}\in\mathbb{R}^{Z}\) is predicted at each decoding step similarly. The surrounding context vector, \(\hat{\mathbf{a}}\) (Equation (19)) is a linear combination of the rows in the surrounding memory representation \(\widetilde{C}\) weighted by using a Score vector \(\hat{\beta}\) in Equation (20). \[\hat{\mathbf{a}}=\sum_{z=0}^{Z}\widetilde{C}_{z}\hat{\beta}_{z} \tag{19}\]  
\[\hat{\beta}=softmax(\hat{h}^{*}W_{\beta}) \tag{20}\]  
where \(\hat{h}^{*}\) is the current hidden state of the decoder, and \(W_{\beta}\) is a learned parameter matrix.