## 5 Surrounding-Aware Individual Emotion Prediction Model
### Surrounding Attention Network
In particular, for some emotion vectors, the actual emotion vector is used as the next input data, if not missing data; otherwise, the decoder's estimate will be used as the next input data. For the missing emotion vector, the proposed model directly considers the estimated value of the decoder as an alternative value. Well-trained models can be used to predict individual emotions. Similar to the learning stage, the user's original individual emotion time series and the neighboring individual emotion time series are processed into the encoder, and obtain the surrounding memory representation and the individual memory representation. In the decoding stage, when an element is not missing, the original individual emotion vector is given; otherwise, the estimated vector is given in order to use as much information as possible from the original emotion time series. Algorithm 3 summarizes the training and prediction algorithms for SAEP. ```
0: Social network \(G=(V,E)\), The set of emotion time series \(X=\{X_{1},X_{2},\ldots,X_{n}\}\), Number of time-evolving context vector \(Z\), Dimensionality of the cell states \(D\), The number of samples in each batch, The number of epoch
0:Emotion label
1: Initializing the network structure parameters;
2:for numbers of training epochs do
3:for numbers of iteration times do
4: draw a mini-batch of sequences X and their corresponding neighbors' context sequence sets \(\hat{X}\);
5: //forward pass to encoder network
6: Compute surrounding context vector \(\hat{\mathbf{a}}\);
7: Compute time-evolving context vector \(\mathbf{a}\);
8: Concatenate surrounding context and time-evolving context by using Equation (22);
9: Predict emotion by using Equation (23);
10: Compute the loss function \(\mathcal{L}\) according to Equation (24). 11: //backward pass
12: Compute gradients;
13: Update parameters;
14:endfor
15:endfor
16:for user \(v_{i}\) in \(G\)do
17: Compute surrounding context vector \(\hat{\mathbf{a}}\);
18: Compute time-evolving context vector \(\mathbf{a}\);
19: Concatenate surrounding context and time-evolving context by using Equation (22);
20: Predict emotion by using Equation (23);
21:endfor
```

**Algorithm 3** Training and prediction algorithm for SAEP

## 6 Experiments

### Dataset Description

Experiments on two real-world social network datasets (i.e., **Twitter** ([[https://archive.org/details/twitter-iran](https://archive.org/details/twitter-iran)]([https://archive.org/details/twitter-iran](https://archive.org/details/twitter-iran)), accessed on 10 October 2021) and **Microblog**) were conducted to evaluate the performance of the proposed model. All the datasets and codes are publicly available online ([[https://github.com/Geoyk96/SAEP](https://github.com/Geoyk96/SAEP)]([https://github.com/Geoyk96/SAEP](https://github.com/Geoyk96/SAEP)), accessed on 10 October 2021). The statistics of the two datasets are shown in Table 1 ( \(|V|\) and \(|E|\) indicate the number of vertices and edges in graph \(G=(V,E)\), while \(PN\) is the total number of ordinal posts and \(RN\) is the total number of reposts). * **Twitter**: This dataset sample from 1 November 2015 to 5 March 2016, in which the entire time period has been divided into several time slices in day. For each time slice, the last post from the user within that time (the user's emotion is influenced by the neighbor and the time-evolving) is saved. In this dataset, the emotion time series size of each user was \(125\times 6\). Because users' post time is irregular, it causes the emotion time series to be missing. The missing data rate of this dataset was 46.70%. * **Microblog**: The Microblog API is used to randomly download a dataset from Microblog, from 23 January 2018 to 28 April 2018. The same method is used as the Twitter dataset to preprocess and split the Microblog dataset. In this dataset, the emotion time series size of each user was \(96\times 6\). The missing data rate of this dataset was 32.64%. ### Data Preparation

The basic of this research was to measure emotions.