# Hierarchical Social Recommendation Model Based on a Graph Neural Network

Authors: Zhongqin Bi; Lina Jing; Meijing Shan; Shuming Dou; Shiyang Wang
Journal: Wireless Communications and Mobile Computing
 (2021)

---

## Abstract

With the continuous accumulation of social network data, social recommendation has become a widely used recommendation method. Based on the theory of social relationship propagation, mining user relationships in social networks can alleviate the problems of data sparsity and the cold start of recommendation systems. Therefore, integrating social information into recommendation systems is of profound importance. We present an efficient network model for social recommendation. The model is based on the graph neural network. It unifies the attention mechanism and bidirectional LSTM into the same framework and uses a multilayer perceptron. In addition, an embedded propagation method is added to learn the neighbor influences of different depths and extract useful neighbor information for social relationship modeling. We use this method to solve the problem that the current research methods of social recommendation only extract the superficial level of social networks but ignore the importance of the relationship strength of the users at different levels in the recommendation. This model integrates social relationships into user and project interactions, not only capturing the weight of the relationship between different users but also considering the influence of neighbors at different levels on user preferences. Experiments on two public datasets demonstrate that the proposed model is superior to other benchmark methods with respect to mean absolute error and root mean square error and can effectively improve the quality of recommendations.


---

## Body

## 1. Introduction

With the rapid development of the Internet and the explosive growth of information, recommendation systems help information consumers find the content that they are interested in from a large amount of information, effectively relieving the pressure of information overload. Collaborative filtering [1] is one of the most commonly used recommendation methods. It uses historical data of user-item interactions to learn users’ preferences for projects without explicit user and project information [2]. In addition to user-project interactions, social relationships between users also provide potential information for modeling user preferences. According to the social theory, people in a social network are affected by their social relationships, resulting in the homogeneity of preferences of social neighbors. Therefore, the influence of social relations on recommendation systems has attracted increasing attention [3]. The general approach of recommendation algorithms based on social information is to integrate social relations based on the rating matrix information. By contrast, social relations are the mapping of natural social relations and reflect the users’ natural social relations [4–6].In recent years, researchers have used the methods of convolutional networks, recurrent networks, and deep autoencoders to define and design neural network structures for processing graph data. Such deep neural networks are called graph neural networks (GNNs) [10–14]. Some recommendation systems use GNNs as feature learning tools to extract useful features from social information [7–9]. The main idea is to use neural networks to iteratively aggregate feature information from the local graph neighborhood. At the same time, node information can be transmitted and aggregated through graphs after transformation. In addition, the data in the social recommendation system can be expressed as user-user social graphs and user-item graphs that provide potential advantages for the learning of GNNs. Some studies use GNNs to incorporate social network information into users and item potential factors to learn. For example, GraphRec [6] proposed a social recommendation framework of GNN that aggregates user-item interaction information and social relationship information simultaneously when performing predictions. DiffNet [44] is a hierarchical influence propagation structure for the simulation of the recursive dynamic diffusion process in social recommendations. Through this structure, both users and projects can be expressed as embedded information containing collaboration and functional content.Although these recommendations based on GNNs have been very successful, they do not take full advantage of social network information. First, most of the methods simply link the user representation extracted from the social relationship to the user or item information and lack in-depth learning of the social relationship. Second, most of them only consider the role of direct (local) neighbors and ignore the influence of indirect neighbors that come from a few hops away. When direct neighbors are sparse, indirect neighbors are also helpful for user representation, and the recommendation system needs to take this indirect social relationship into account. Finally, not all neighbors are useful when recommending users. For example, a user who likes Macs may not be indicative that all of his neighbors like Macs. If the influence of these neighbors is treated equally, then the recommendation effect will be reduced. Therefore, it is necessary for the recommendation algorithm to distinguish strong and weak social relations and reasonably allocate the influence weight of neighbors on users.In this paper, we use a GNN to design a hierarchical social collaborative filtering framework called GHSCF. The model includes three modules: the embedded propagation layer, the embedded layer, and the sequential learning layer. The framework can make full use of social network information for recommendations. Compared with other social recommendation methods, this model has the following advantages. First, an embedded propagation method is designed to learn the influence of neighbors at different levels. When direct neighbors have no valuable information to share, users may use indirect neighbor information. In addition, the attention mechanism is introduced to distinguish strong and weak social connections, screen helpful neighbors, and effectively capture the influence weights of different neighbors. Second, the user preference sequence generated by different levels of communication learning represents user modeling of different levels of neighbors. The long-term and short-term memory (LSTM) network is used for serial modeling and makes final recommendations based on the influence of neighbors at different levels.In summary, the contributions of this article are as follows:(1)
We designed a hierarchical social recommendation model based on the graph neural network to capture user relationships along social networks and simulate changes in influence between users at different levels to improve the accuracy of user representation(2)
We propose an embedded propagation based on GNN that introduces a user relationship metric for the most relevant items and alleviates the problem of inconsistent user preferences for target items(3)
We combine the attention mechanism with the bidirectional LSTM network and propose a bidirectional LSTM with an attention mechanism that can help sequence modeling(4)
We conduct comprehensive experiments on two standard datasets and compare existing social recommendation frameworks in order to evaluate and demonstrate the effectiveness of the proposed approach, proving the superior performance of our method. Compared with the existing methods, our method not only considers the information from the neighbors but also considers the information of the original neighbors. Our method reasonably distinguishes strong and weak social relationsThe rest of this article is organized as follows: in Section2, we briefly introduce the related work. In Section 3, we provide some preliminary information. In Section 4, we introduce our GHSCF architecture model in detail. Section 5 describes the experimental results. Section 6 concludes the paper.


## 2. Related Work

The collaborative filtering recommendation algorithm [1] is the most widely used method in recommendation systems to predict the interaction between users and products. Using the historical interaction information between users and products, the users and products of interest can be modeled. In addition to user-item interaction, the use of social relationships to make suggestions has attracted great attention [20, 21]. Many social recommendation methods [22–27] have demonstrated the effectiveness of incorporating social relationships into recommendations. SoDimRec [26] uses the heterogeneity of social relations and the weak dependence on social networks to make recommendations. SOReg [17] proposes two kinds of social recommendation algorithms and uses a social regularization conditional constraint matrix to decompose the objective function. TRUSTMF [18] simulates the interaction between users and maps users to two low-dimensional spaces by decomposing the social trust network into the trust space and trusted space. Although the social recommendation method based on matrix decomposition has achieved a good recommendation effect, its linearity is insufficient to reveal the complex nonlinear relationship between users and products.Recently, deep neural networks have been used to enhance recommendation systems [28, 29, 43]. Most of these systems use deep neural networks as feature learning tools to extract features from auxiliary information, such as the text description of items [30, 32, 33, 46]. Neural matrix factorization (NeuMF) [19] proposes a neural cooperative filtering (NCF) framework to learn the nonlinear interactions between users and projects. Later, researchers attempted to incorporate social relationship information into the NCF model to improve recommendation performance. Neural social collaborative ranking (NSCR) [31] uses social network information as graph regularization to extend the NeuMF model so that nearby neighbors have similar potential vectors. The deep neural network model on social relations (DeepSoR) [12] learns the nonlinear characteristics of each user from social relations and integrates them into probability matrix factorization for rating prediction. The deep social collaborative filtering (DSCF) [45] framework uses a random walk layer to generate the item perceived social sequence and extract relevant information from distant neighbors for user-item nonlinear fusion. All of these works address the cross-domain task of social recommendation and thus differ from traditional social recommendation systems.GNNs have demonstrated the ability to learn graph structure data [11, 34, 35, 42, 45, 48]. In the social recommendation task, the relationship between users employs typical graph data. Thus, GNNs have a natural advantage when used for this task. In [6, 36, 37, 47], SocialGCN [36] was proposed to capture user preferences by utilizing the advantages of GCNS and modeling the diffusion process of preference information in the figure. However, SocialGCN does not consider the relative importance of different neighbors and the degree of trust of the users for different neighbors when buying different items. GraphRec [6] implements a new graphical neural network framework for social recommendation. In particular, a principled approach is designed to capture interaction and rating information jointly and to simulate both types of graphs and heterogeneous intensities coherently. However, GraphRec does not take into account the influence of remote neighbors. This paper proposes a hierarchical social recommendation model that can make full use of social network information to make recommendations. This model can simulate the influence process of user preference information spread in social networks and model user preference considering the importance of neighbors at different levels.


## 3. Preliminaries

### 3.1. Attentional Mechanism

The attention mechanism [39] refers to the human visual attention and thinking mode to help the model quickly screen valuable information from a large amount of content. It uses the scoring method to extract the weight of key information and is widely used in various deep learning tasks, such as natural language processing, image classification, and speech recognition [40, 41].Each layer of the model uses an input information vectorX=x1,x2,⋯,xn to search and select important information in X in a given query vector q. A “soft” selection mechanism is usually adopted to capture the weight distribution of each piece of information in the input information. The weight of x1 is calculated as follows:
(1)ei=vτtanhWxi+bi,αi=expei∑j=1Nexpej.The probability vector constituted byαi is called the attention distribution. W, U, and V are learnable network parameters. The input information is summarized by the weighted average method and is calculated as follows:
(2)s=∑i=1Nαixi.


### 3.2. LSTM

An LSTM network [38] is a sequential convolutional network derived from a cyclic neural network that alleviates the vanishing and exploding gradient problems of cyclic neural networks by using cell states and gate mechanisms. LSTM can learn long-term dependence, making it suitable for solving many long sequence learning problems. The excellent performance of LSTM arises from its unique internal structure. Specifically, LSTM uses three gate structures to control the flow of the information state. In each time step t, the current cell state ct−1 and the hidden layer state ht−1 are updated through an input sequence element value xt, the cell state ct, and the hidden layer state ht of the time step t−1. The formula is as follows:
(3)itftot=σσσWht−1;xt+b,c^t=tanhWcht−1:xt+bc,ct=ft⊙c^t−1+it⊙c^t,ht=ot⊙tanhct,where it, ft, and ot represent gate activation, σ is the sigmoid activation function, tanh is the hyperbolic tangent activation function, and ⊙ represents vector element multiplication. Intuitively, ForgetGate ft controls the extent to which the previous memory unit is forgotten, and input gate it controls how many input gates are updated by each unit. The output gate ot controls the output of the internal memory state. The hidden layer state ht represents the output information of the internal memory unit of the LSTM unit.The prediction may need to be determined based on both previous and subsequent inputs, improving the performance of the network. A more common approach is to use bidirectional LSTM to simulate textual semantics from the forward and backward states of the hidden layer. For a sequence vectorx1,x2,⋯,xT, the forward LSTM reads the sequence x1 to xT, and the backward LSTM reads the sequence xT to x1 and then connects the forward and backward hidden layer states ht⟶ and ht⟵, ht integrating all of the information of the sequence around xt.


## 3.1. Attentional Mechanism

The attention mechanism [39] refers to the human visual attention and thinking mode to help the model quickly screen valuable information from a large amount of content. It uses the scoring method to extract the weight of key information and is widely used in various deep learning tasks, such as natural language processing, image classification, and speech recognition [40, 41].Each layer of the model uses an input information vectorX=x1,x2,⋯,xn to search and select important information in X in a given query vector q. A “soft” selection mechanism is usually adopted to capture the weight distribution of each piece of information in the input information. The weight of x1 is calculated as follows:
(1)ei=vτtanhWxi+bi,αi=expei∑j=1Nexpej.The probability vector constituted byαi is called the attention distribution. W, U, and V are learnable network parameters. The input information is summarized by the weighted average method and is calculated as follows:
(2)s=∑i=1Nαixi.


## 3.2. LSTM

An LSTM network [38] is a sequential convolutional network derived from a cyclic neural network that alleviates the vanishing and exploding gradient problems of cyclic neural networks by using cell states and gate mechanisms. LSTM can learn long-term dependence, making it suitable for solving many long sequence learning problems. The excellent performance of LSTM arises from its unique internal structure. Specifically, LSTM uses three gate structures to control the flow of the information state. In each time step t, the current cell state ct−1 and the hidden layer state ht−1 are updated through an input sequence element value xt, the cell state ct, and the hidden layer state ht of the time step t−1. The formula is as follows:
(3)itftot=σσσWht−1;xt+b,c^t=tanhWcht−1:xt+bc,ct=ft⊙c^t−1+it⊙c^t,ht=ot⊙tanhct,where it, ft, and ot represent gate activation, σ is the sigmoid activation function, tanh is the hyperbolic tangent activation function, and ⊙ represents vector element multiplication. Intuitively, ForgetGate ft controls the extent to which the previous memory unit is forgotten, and input gate it controls how many input gates are updated by each unit. The output gate ot controls the output of the internal memory state. The hidden layer state ht represents the output information of the internal memory unit of the LSTM unit.The prediction may need to be determined based on both previous and subsequent inputs, improving the performance of the network. A more common approach is to use bidirectional LSTM to simulate textual semantics from the forward and backward states of the hidden layer. For a sequence vectorx1,x2,⋯,xT, the forward LSTM reads the sequence x1 to xT, and the backward LSTM reads the sequence xT to x1 and then connects the forward and backward hidden layer states ht⟶ and ht⟵, ht integrating all of the information of the sequence around xt.


## 4. Model

In this section, we describe in detail the proposed model, namely, GHSCF. The framework of the model is shown in Figure1. The model includes three modules: the embedded propagation layer captures the intensity of different levels of neighbor social relations and carries out user preference modeling, the embedding layer models the user-item interaction, and the sequence learning layer uses LSTM to fuse user-item interaction sequences composed of different levels. The remainder of this section describes each module in detail.Figure 1
Hierarchical recommendation model based on a graph neural network.


### 4.1. Embedded Propagation Layer

In this layer, a GNN-based messaging structure is constructed so that the model can capture user relationships along with the social network and optimize user preferences with different levels of neighbors, as shown in Figure2. To better illustrate the internal structure of the embedded propagation layer, we first introduce the propagation structure of one layer and then extend it to multiple layers.Figure 2
Embedded propagation model.In social recommendation, when trying to recommend an item for a given useru, the user’s preferences are influenced by direct neighbors, while indirect neighbors can also provide valuable help. At the same time, the connection between users can be transmitted through social networks to influence the behavior of other users further. Therefore, the recommendation algorithm should include all of these neighbors in the potential factors of user preferences and introduce the attention mechanism to select representative social neighbors to describe the social information of users. Therefore, this paper proposes a user potential representation method based on social space that aggregates the potential factors of neighboring users to learn the preferences of target users. Specifically, it iteratively learns the potential representation of user u according to its neighbor set Nu, as follows:
(4)eu1=LeakyReLUW1eu+W2∑k∈Nuaukeuk.In the formula,eu1 represents the representation of user u obtained after the first embedded propagation layer, auk represents the influence weight of neighbors, that is, 1/∣Nu∣, euk represents the potential representation of neighbor k, and LeakyReLU [15] is the activation function that allows the use of positive signals and small negative signals to encode messages. Notably, in addition to integrating the neighborhood information, the model also preserves the user’s original characteristics.Although users can be modeled based on neighborhood information, no explicit recommendations are specified; that is, users share social relationships with their neighbors’ individual interacting items. However, the preferences of target users and their neighbors may not be the same. Sometimes, the neighbors’ information does not help recommend target items, and only the information related to the item contributes. Therefore, the model needs to select an item related to the target item for each user to realize similarity modeling between the user and a neighbor. It is important to note that only the most relevant items contribute to the recommendation of a particular item. This is because the most relevant items are the most important influencing factors for the target item, while other items may not be helpful or contribute to noise. Specifically, for the target itemp, we select the item most related to p from the item interaction set of user u:
(5)pu=argmaxpi∈Vucospi,p.In the formula,vu is the user’s item interaction set, and cospi,p is a function to measure the similarity between item p and item pi. Cosine similarity is used according to experience:
(6)cospi,p=fpiTfpfpifp.In the formula, thef function generates the appropriate feature representation for the item. In this paper, the NeuMF model is used to extract the representation of objects and to calculate the similarity.As mentioned earlier, there are strong ties and weak ties in a social network, and users may share more similar items with strong ties. Therefore, through the most similar items between users, we can learn the relationship strength.(7)βuk=LeakyReLUvT⋅Wepk⊕Wepu,auk=expβuk∑i∈Nuexpβui,where epk represents the embedding representation of the most relevant item of user k and epu represents the embedding representation of the most relevant item p of user u. auk is the degree of correlation between users. With the first layer of direct user modeling, the simulation network propagation mode overlays more indirect neighbors, leading to deeper user preference modeling, which is crucial for the subsequent serialization modeling.Throughn embedded propagation layers, user u can receive information transmitted by neighbors on n layers. In the NTH layer, user u is recursively expressed as
(8)eun=LeakyReLUW1neun−1+W2n∑k∈Nuauknekn,where W1nW2n is a trainable transformation matrix, eun−1 is the user preference of the upper layer generated by the transmission signal of the previous layer and aggregates the neighbor information of the upper layer, ekn is the neighbor K embedding vector of the Nth layer, and aukn is the influence factor. Through the propagation of social networks, on the basis of direct neighbor modeling, the modeling information of indirect neighbors’ user preferences is accumulated layer by layer, which is represented as a user preference sequence eu1,eu2,⋯,eun that reflects that users at different friend levels will be affected by different neighbors.


### 4.2. Embedded Layer

The user preference sequence is composed of user modeling by neighbors and users in a social network under the influence of the strength of item interaction. Therefore, it is necessary to integrate the user preference sequence into the user-item interaction first, so that the user’s various preference information is fully considered. Clearly, the bad and good comments from the user’s social neighbors reflect the user’s choice of items in a sequential manner. The interaction between the user and the item is highly nonlinear, and a multilayer perceptron (MLP) can fuse the interaction information with the user preference information. The input of the MLP includes user embeddingeu, single-layer user preference embedding eui, i∈1,n, item embedding as input ep, and output user-item interactive embedding as mi, i∈1,n, that is given by
(9)mi=fu,peu⊕ep⊕eui,i∈1,n.Using an MLP, a sequence of all user-item interactions can be obtained from the neighbors[mu1,mu2,⋯,mun].


### 4.3. Sequential Learning Layer

The purpose of the sequence learning layer is to integrate the sequence of rating vectors further or to integrate the information of rating vectors under different levels to obtain a unified representation. Since all of the neighbors in the sequence will affect the prediction, for the distant neighbors, the model needs to capture the remote social information between these neighbors and the useru. In addition, the influence between users in a social networks is bidirectional, and bidirectional LSTM has inherent advantages in sequence modeling:
(10)h⟶i=LSTM⟶mi,i∈1,n,h⟵i=LSTM⟵mi,i∈1,n.The output featurehi=h⟶i;h⟵i is obtained by connecting the forward hidden layer state h⟶ and the backward hidden layer state h⟵ of the sequence. Then, the attention mechanism is used to learn the important features in the sequence:
(11)s=∑i=1nαihi.In the formula,αi is the weight of attention. αi is used to assign the importance of information at different levels of the sequence:
(12)ai=vaTtanhWahi+ba,αi=expai∑i∈Nuexpai.


### 4.4. Model Learning

In this work, we apply the proposed model to the recommendation task of rating prediction and finally use the MLP to predict useru’s rating score for item p.
(13)rup′=fs.Since the task focused on in this work is rating prediction, the model selects a commonly used objective function:(14)Loss=12O∑u,p∈Orup′−rup2,where O is the number of ratings observed and rup is the true rating of user u on item p.


## 4.1. Embedded Propagation Layer

In this layer, a GNN-based messaging structure is constructed so that the model can capture user relationships along with the social network and optimize user preferences with different levels of neighbors, as shown in Figure2. To better illustrate the internal structure of the embedded propagation layer, we first introduce the propagation structure of one layer and then extend it to multiple layers.Figure 2
Embedded propagation model.In social recommendation, when trying to recommend an item for a given useru, the user’s preferences are influenced by direct neighbors, while indirect neighbors can also provide valuable help. At the same time, the connection between users can be transmitted through social networks to influence the behavior of other users further. Therefore, the recommendation algorithm should include all of these neighbors in the potential factors of user preferences and introduce the attention mechanism to select representative social neighbors to describe the social information of users. Therefore, this paper proposes a user potential representation method based on social space that aggregates the potential factors of neighboring users to learn the preferences of target users. Specifically, it iteratively learns the potential representation of user u according to its neighbor set Nu, as follows:
(4)eu1=LeakyReLUW1eu+W2∑k∈Nuaukeuk.In the formula,eu1 represents the representation of user u obtained after the first embedded propagation layer, auk represents the influence weight of neighbors, that is, 1/∣Nu∣, euk represents the potential representation of neighbor k, and LeakyReLU [15] is the activation function that allows the use of positive signals and small negative signals to encode messages. Notably, in addition to integrating the neighborhood information, the model also preserves the user’s original characteristics.Although users can be modeled based on neighborhood information, no explicit recommendations are specified; that is, users share social relationships with their neighbors’ individual interacting items. However, the preferences of target users and their neighbors may not be the same. Sometimes, the neighbors’ information does not help recommend target items, and only the information related to the item contributes. Therefore, the model needs to select an item related to the target item for each user to realize similarity modeling between the user and a neighbor. It is important to note that only the most relevant items contribute to the recommendation of a particular item. This is because the most relevant items are the most important influencing factors for the target item, while other items may not be helpful or contribute to noise. Specifically, for the target itemp, we select the item most related to p from the item interaction set of user u:
(5)pu=argmaxpi∈Vucospi,p.In the formula,vu is the user’s item interaction set, and cospi,p is a function to measure the similarity between item p and item pi. Cosine similarity is used according to experience:
(6)cospi,p=fpiTfpfpifp.In the formula, thef function generates the appropriate feature representation for the item. In this paper, the NeuMF model is used to extract the representation of objects and to calculate the similarity.As mentioned earlier, there are strong ties and weak ties in a social network, and users may share more similar items with strong ties. Therefore, through the most similar items between users, we can learn the relationship strength.(7)βuk=LeakyReLUvT⋅Wepk⊕Wepu,auk=expβuk∑i∈Nuexpβui,where epk represents the embedding representation of the most relevant item of user k and epu represents the embedding representation of the most relevant item p of user u. auk is the degree of correlation between users. With the first layer of direct user modeling, the simulation network propagation mode overlays more indirect neighbors, leading to deeper user preference modeling, which is crucial for the subsequent serialization modeling.Throughn embedded propagation layers, user u can receive information transmitted by neighbors on n layers. In the NTH layer, user u is recursively expressed as
(8)eun=LeakyReLUW1neun−1+W2n∑k∈Nuauknekn,where W1nW2n is a trainable transformation matrix, eun−1 is the user preference of the upper layer generated by the transmission signal of the previous layer and aggregates the neighbor information of the upper layer, ekn is the neighbor K embedding vector of the Nth layer, and aukn is the influence factor. Through the propagation of social networks, on the basis of direct neighbor modeling, the modeling information of indirect neighbors’ user preferences is accumulated layer by layer, which is represented as a user preference sequence eu1,eu2,⋯,eun that reflects that users at different friend levels will be affected by different neighbors.


## 4.2. Embedded Layer

The user preference sequence is composed of user modeling by neighbors and users in a social network under the influence of the strength of item interaction. Therefore, it is necessary to integrate the user preference sequence into the user-item interaction first, so that the user’s various preference information is fully considered. Clearly, the bad and good comments from the user’s social neighbors reflect the user’s choice of items in a sequential manner. The interaction between the user and the item is highly nonlinear, and a multilayer perceptron (MLP) can fuse the interaction information with the user preference information. The input of the MLP includes user embeddingeu, single-layer user preference embedding eui, i∈1,n, item embedding as input ep, and output user-item interactive embedding as mi, i∈1,n, that is given by
(9)mi=fu,peu⊕ep⊕eui,i∈1,n.Using an MLP, a sequence of all user-item interactions can be obtained from the neighbors[mu1,mu2,⋯,mun].


## 4.3. Sequential Learning Layer

The purpose of the sequence learning layer is to integrate the sequence of rating vectors further or to integrate the information of rating vectors under different levels to obtain a unified representation. Since all of the neighbors in the sequence will affect the prediction, for the distant neighbors, the model needs to capture the remote social information between these neighbors and the useru. In addition, the influence between users in a social networks is bidirectional, and bidirectional LSTM has inherent advantages in sequence modeling:
(10)h⟶i=LSTM⟶mi,i∈1,n,h⟵i=LSTM⟵mi,i∈1,n.The output featurehi=h⟶i;h⟵i is obtained by connecting the forward hidden layer state h⟶ and the backward hidden layer state h⟵ of the sequence. Then, the attention mechanism is used to learn the important features in the sequence:
(11)s=∑i=1nαihi.In the formula,αi is the weight of attention. αi is used to assign the importance of information at different levels of the sequence:
(12)ai=vaTtanhWahi+ba,αi=expai∑i∈Nuexpai.


## 4.4. Model Learning

In this work, we apply the proposed model to the recommendation task of rating prediction and finally use the MLP to predict useru’s rating score for item p.
(13)rup′=fs.Since the task focused on in this work is rating prediction, the model selects a commonly used objective function:(14)Loss=12O∑u,p∈Orup′−rup2,where O is the number of ratings observed and rup is the true rating of user u on item p.


## 5. Experiment

### 5.1. Experimental Data

In this experiment, we selected two commonly used public datasets to evaluate the effectiveness of this method, namely, Ciao and Epinions. They are item rating datasets taken from two different social platforms that contain user rating records and social relationship information. The user rating in the dataset is recorded in intervals of 1 for each user to view the items, with [1, 5] as the rating interval. The social relationship information gives the set of all social neighbors for each user. The statistics for these two datasets are shown in Table 1.Table 1
Statistics for the two datasets.
DatasetUsersItemsRatingsLinksRating densitySocial connection densityCiao7,31710,4975283,319111,7810.0368%0.2087%Epinions18,088261,649764,352355,8130.0161%0.1087%For the convenience of subsequent use, 80% of the data in each dataset were randomly selected for training, 10% were selected for validation, and 10% were selected for testing. All hyperparameters were selected based on the validation set. In this model, Minh and Salakhutdinov’s method [16] was selected as the optimization algorithm, and the initial learning rate was set to 0.005. At the same time, to alleviate the overfitting problem, dropout technology was used in the training process, and the ratio was set to 0.6. Unless otherwise mentioned, three hidden layers were used for all neural networks, and the number of neighboring layers was set to 4. For the embedded size, the model tests the values of {8,16,32,64,128,256} and searches for the batch size and learning rate in {16,32,64,128,512} and {0.0005, 0.001, 0.005, 0.01, 0.05, 0.1}. After repeated tests, the embedded size of the model was set to 64, the batch size to 128, and the learning rate to 0.005. In addition, following a rule of thumb, the size of the hidden layer was set to the embedded size (the dimension of the underlying factor), and the activation function is set to ReLU. Finally, the parameters of the baseline algorithm were initialized and repeatedly adjusted through testing to achieve the best performance.To evaluate the quality of the recommendation algorithm, two commonly used prediction accuracy indexes, namely, the mean absolute error (MAE) and root mean square error (RMSE), were used in this paper. Smaller MAE and RMSE values indicate better prediction accuracy.(15)RMSE=1N∑I=1Ny∧i=yi2,MAE=1N∑i=1Ny∧i−yi,where N represents the number of test examples.


### 5.2. Contrast Experiment

(i)
PMF [16]: probabilistic matrix factorization is a standard rating prediction model that uses only ratings for collaborative filtering(ii)
SoRec [17]: social regularization models social network information as regularization terms and constrains the matrix factorization framework(iii)
SocialMF [18]: this model effectively integrates social information into the conventional matrix decomposition framework. However, it assumes that the trust relationship between all users is the same and simulates social influence based on that assumption(iv)
NeuMF [19]: this method is a state-of-the-art neural CF model that uses multiple hidden layers above the elements and connects embedded users and objects to capture their nonlinear feature interactions(v)
DeepSoR [12]: this model uses a deep neural network to learn the representation of each user from social relations and integrates it into probability matrix factorization for rating prediction(vi)
DSCF [8]: a deep social collaborative filtering framework that extracts valuable information from social relationships for recommendation and generates an item-aware social sequence for integration into user-item interaction(vii)
DiffNet [44]: a social recommendation framework based on a GNN. It proposes a hierarchical diffusion method to simulate the transmission process of the users’ potential preferences in social trust networks


### 5.3. Results and Analysis

As shown in Table2, probabilistic matrix factorization (PMF) performed poorly on both datasets. This indicates that the internal product is insufficient for capturing the complex relationship between the user and item, further limiting performance. NeuMF consistently outperformed PMF in all cases, demonstrating the importance of nonlinear characteristic interactions between the user and item embedding. Both SoRec and SocialMF utilize ratings and social network information, while PMF only uses rating information. These results indicate that social network information is complementary to rating information. DeepSoR, DSCF, and DiffNet outperform SoRec and SocialMF, and all of these methods use ratings and social network information. However, DeepSoR, DiffNet, and DSCF are based on neural network structures, further demonstrating the superiority of neural networks in making recommendations. In contrast to the other methods, DiffNet shows quite a strong performance, implying that GNNs can deeply mine the underlying information of graphic data. Notably, GHSCF consistently outperformed all baseline approaches. Compared to DeepSoR and DSCF, GHSCF provides advanced modeling components to combine different levels of neighbors in social network information. Further analysis was performed to better understand the contributions of the model components.Table 2
RMSE and MAE experimental results of the models.
ModelsCiaoEpinionsMAERMSEMAERMSEPMF0.90211.12380.99521.2128SoRec0.86111.08480.91191.1703SocialMF0.82701.05010.88371.1328NeuMF0.80621.06170.90721.1476DeepSoR0.77391.03160.83831.0972DSCF0.72700.98670.82751.0667DiffNet0.71940.97820.81581.0741GHSCF0.72060.91940.79680.9731


### 5.4. Model Analysis

#### 5.4.1. Effectiveness of the Number of Embedded Propagation Layers

To investigate whether the model can benefit from multiple embedded propagation layers, the model performance is tested by changing the number of layers of the model. We explore model performance at levels 1 through 4 according to the experimental results shown in Table3.Table 3
RMSE and MAE of different communication levels.
LayersCiaoEpinionsMAERMSEMAERMSEGHSCF-10.72710.96050.80811.0558GHSCF-20.72380.95980.80751.0247GHSCF-30.72060.91940.80710.9731GHSCF-40.72290.96010.80681.0331With increasing model layers, the RMSE and MAE decrease gradually and tend to become stable, indicating that the model can not only effectively utilize the direct neighbor information but also capture the influence of indirect neighbors on the modeling of user preferences. It is important to note that in dataset Ciao, overfitting occurs, possibly due to the noise that an architecture that applies too deeply can generate for the learning representation. When the number of propagation layers is changed, the model is always superior to other methods on the two datasets, indicating that the propagation mechanism in this model can effectively capture the neighbor information at different levels, which is helpful for improving user preference modeling.


#### 5.4.2. Neighbor Relationship Modeling and LSTM Validity Analysis

To better understand the proposed model, this experiment compared three variants of the GHSCF model: GHSCF-β, GHSCF-α, and GHSCF-Item. These three variants are defined as follows:
(i)
GHSCF-β: the purpose of this variant is to study the effect of the attention factor β on the strength of the learning user’s relationship, assuming that each neighbor has the same influence on the target user(ii)
GHSCF-α: in this variant, the bidirectional LSTM structure is replaced by the serial average; that is, the user preferences of different levels are integrated by averaging, and the differences between different levels are ignored(iii)
GHSCF-item: this variant only uses the user vector to evaluate the strong or weak relationship between the user and his neighbors; that is, the influence of the most relevant items is no longer consideredThe results on the Ciao dataset are shown in Figure3. The results using the Epinions dataset are not shown here because similar observations can be made. First, the performance of the GHSCF and GHSCF items is better than that of the GHSCF β. This indicates that not all neighbors have the same influence on target users, and correctly distinguishing the strong and weak relations of neighbors is beneficial for user preference modeling. In addition, the performance of the GHSCF items is worse than that of the GHSCFs. This is because adjacent users may not have an item intersection, and it is not sufficient to capture the strength of user relationships only by considering the user’s own social network information. Therefore, not all information from neighbors is useful when recommending a particular project, and it is more valuable to select neighbor-related projects to measure user relationships. Second, the performance of GHSCF-α is significantly lower than that of GHSCF. This indicates that the bidirectional LSTM component better learns the representation of the sequence of user-item interactions at different levels. Therefore, it is further proven that target users in social networks will have different degrees of preferences for target products due to the influence of neighbors separated by different distances.Figure 3
Results of MAE and RMSE experiments for different variants.


#### 5.4.3. Effect of the Embedded Size

Figure4 shows the impact of the embedded sizes of users and items on model performance. As the embedded size increases, the recommended performance first increases and then decreases. When the embedded size is increased from 8 to 64, the performance is significantly improved. However, when the embedding size is 256, the performance is degraded. This shows that using a large embedded size has a powerful representation. If the length of embedding is too large, then the complexity of the model will increase significantly, and overfitting may occur. Therefore, the correct embedding length must be found to balance performance and complexity.Figure 4
Effect of different embedded sizes.
(a)
Ciao—MAE and RMSE(b)
Epinions—MAE and RMSE


## 5.1. Experimental Data

In this experiment, we selected two commonly used public datasets to evaluate the effectiveness of this method, namely, Ciao and Epinions. They are item rating datasets taken from two different social platforms that contain user rating records and social relationship information. The user rating in the dataset is recorded in intervals of 1 for each user to view the items, with [1, 5] as the rating interval. The social relationship information gives the set of all social neighbors for each user. The statistics for these two datasets are shown in Table 1.Table 1
Statistics for the two datasets.
DatasetUsersItemsRatingsLinksRating densitySocial connection densityCiao7,31710,4975283,319111,7810.0368%0.2087%Epinions18,088261,649764,352355,8130.0161%0.1087%For the convenience of subsequent use, 80% of the data in each dataset were randomly selected for training, 10% were selected for validation, and 10% were selected for testing. All hyperparameters were selected based on the validation set. In this model, Minh and Salakhutdinov’s method [16] was selected as the optimization algorithm, and the initial learning rate was set to 0.005. At the same time, to alleviate the overfitting problem, dropout technology was used in the training process, and the ratio was set to 0.6. Unless otherwise mentioned, three hidden layers were used for all neural networks, and the number of neighboring layers was set to 4. For the embedded size, the model tests the values of {8,16,32,64,128,256} and searches for the batch size and learning rate in {16,32,64,128,512} and {0.0005, 0.001, 0.005, 0.01, 0.05, 0.1}. After repeated tests, the embedded size of the model was set to 64, the batch size to 128, and the learning rate to 0.005. In addition, following a rule of thumb, the size of the hidden layer was set to the embedded size (the dimension of the underlying factor), and the activation function is set to ReLU. Finally, the parameters of the baseline algorithm were initialized and repeatedly adjusted through testing to achieve the best performance.To evaluate the quality of the recommendation algorithm, two commonly used prediction accuracy indexes, namely, the mean absolute error (MAE) and root mean square error (RMSE), were used in this paper. Smaller MAE and RMSE values indicate better prediction accuracy.(15)RMSE=1N∑I=1Ny∧i=yi2,MAE=1N∑i=1Ny∧i−yi,where N represents the number of test examples.


## 5.2. Contrast Experiment

(i)
PMF [16]: probabilistic matrix factorization is a standard rating prediction model that uses only ratings for collaborative filtering(ii)
SoRec [17]: social regularization models social network information as regularization terms and constrains the matrix factorization framework(iii)
SocialMF [18]: this model effectively integrates social information into the conventional matrix decomposition framework. However, it assumes that the trust relationship between all users is the same and simulates social influence based on that assumption(iv)
NeuMF [19]: this method is a state-of-the-art neural CF model that uses multiple hidden layers above the elements and connects embedded users and objects to capture their nonlinear feature interactions(v)
DeepSoR [12]: this model uses a deep neural network to learn the representation of each user from social relations and integrates it into probability matrix factorization for rating prediction(vi)
DSCF [8]: a deep social collaborative filtering framework that extracts valuable information from social relationships for recommendation and generates an item-aware social sequence for integration into user-item interaction(vii)
DiffNet [44]: a social recommendation framework based on a GNN. It proposes a hierarchical diffusion method to simulate the transmission process of the users’ potential preferences in social trust networks


## 5.3. Results and Analysis

As shown in Table2, probabilistic matrix factorization (PMF) performed poorly on both datasets. This indicates that the internal product is insufficient for capturing the complex relationship between the user and item, further limiting performance. NeuMF consistently outperformed PMF in all cases, demonstrating the importance of nonlinear characteristic interactions between the user and item embedding. Both SoRec and SocialMF utilize ratings and social network information, while PMF only uses rating information. These results indicate that social network information is complementary to rating information. DeepSoR, DSCF, and DiffNet outperform SoRec and SocialMF, and all of these methods use ratings and social network information. However, DeepSoR, DiffNet, and DSCF are based on neural network structures, further demonstrating the superiority of neural networks in making recommendations. In contrast to the other methods, DiffNet shows quite a strong performance, implying that GNNs can deeply mine the underlying information of graphic data. Notably, GHSCF consistently outperformed all baseline approaches. Compared to DeepSoR and DSCF, GHSCF provides advanced modeling components to combine different levels of neighbors in social network information. Further analysis was performed to better understand the contributions of the model components.Table 2
RMSE and MAE experimental results of the models.
ModelsCiaoEpinionsMAERMSEMAERMSEPMF0.90211.12380.99521.2128SoRec0.86111.08480.91191.1703SocialMF0.82701.05010.88371.1328NeuMF0.80621.06170.90721.1476DeepSoR0.77391.03160.83831.0972DSCF0.72700.98670.82751.0667DiffNet0.71940.97820.81581.0741GHSCF0.72060.91940.79680.9731


## 5.4. Model Analysis

### 5.4.1. Effectiveness of the Number of Embedded Propagation Layers

To investigate whether the model can benefit from multiple embedded propagation layers, the model performance is tested by changing the number of layers of the model. We explore model performance at levels 1 through 4 according to the experimental results shown in Table3.Table 3
RMSE and MAE of different communication levels.
LayersCiaoEpinionsMAERMSEMAERMSEGHSCF-10.72710.96050.80811.0558GHSCF-20.72380.95980.80751.0247GHSCF-30.72060.91940.80710.9731GHSCF-40.72290.96010.80681.0331With increasing model layers, the RMSE and MAE decrease gradually and tend to become stable, indicating that the model can not only effectively utilize the direct neighbor information but also capture the influence of indirect neighbors on the modeling of user preferences. It is important to note that in dataset Ciao, overfitting occurs, possibly due to the noise that an architecture that applies too deeply can generate for the learning representation. When the number of propagation layers is changed, the model is always superior to other methods on the two datasets, indicating that the propagation mechanism in this model can effectively capture the neighbor information at different levels, which is helpful for improving user preference modeling.


### 5.4.2. Neighbor Relationship Modeling and LSTM Validity Analysis

To better understand the proposed model, this experiment compared three variants of the GHSCF model: GHSCF-β, GHSCF-α, and GHSCF-Item. These three variants are defined as follows:
(i)
GHSCF-β: the purpose of this variant is to study the effect of the attention factor β on the strength of the learning user’s relationship, assuming that each neighbor has the same influence on the target user(ii)
GHSCF-α: in this variant, the bidirectional LSTM structure is replaced by the serial average; that is, the user preferences of different levels are integrated by averaging, and the differences between different levels are ignored(iii)
GHSCF-item: this variant only uses the user vector to evaluate the strong or weak relationship between the user and his neighbors; that is, the influence of the most relevant items is no longer consideredThe results on the Ciao dataset are shown in Figure3. The results using the Epinions dataset are not shown here because similar observations can be made. First, the performance of the GHSCF and GHSCF items is better than that of the GHSCF β. This indicates that not all neighbors have the same influence on target users, and correctly distinguishing the strong and weak relations of neighbors is beneficial for user preference modeling. In addition, the performance of the GHSCF items is worse than that of the GHSCFs. This is because adjacent users may not have an item intersection, and it is not sufficient to capture the strength of user relationships only by considering the user’s own social network information. Therefore, not all information from neighbors is useful when recommending a particular project, and it is more valuable to select neighbor-related projects to measure user relationships. Second, the performance of GHSCF-α is significantly lower than that of GHSCF. This indicates that the bidirectional LSTM component better learns the representation of the sequence of user-item interactions at different levels. Therefore, it is further proven that target users in social networks will have different degrees of preferences for target products due to the influence of neighbors separated by different distances.Figure 3
Results of MAE and RMSE experiments for different variants.


### 5.4.3. Effect of the Embedded Size

Figure4 shows the impact of the embedded sizes of users and items on model performance. As the embedded size increases, the recommended performance first increases and then decreases. When the embedded size is increased from 8 to 64, the performance is significantly improved. However, when the embedding size is 256, the performance is degraded. This shows that using a large embedded size has a powerful representation. If the length of embedding is too large, then the complexity of the model will increase significantly, and overfitting may occur. Therefore, the correct embedding length must be found to balance performance and complexity.Figure 4
Effect of different embedded sizes.
(a)
Ciao—MAE and RMSE(b)
Epinions—MAE and RMSE


## 5.4.1. Effectiveness of the Number of Embedded Propagation Layers

To investigate whether the model can benefit from multiple embedded propagation layers, the model performance is tested by changing the number of layers of the model. We explore model performance at levels 1 through 4 according to the experimental results shown in Table3.Table 3
RMSE and MAE of different communication levels.
LayersCiaoEpinionsMAERMSEMAERMSEGHSCF-10.72710.96050.80811.0558GHSCF-20.72380.95980.80751.0247GHSCF-30.72060.91940.80710.9731GHSCF-40.72290.96010.80681.0331With increasing model layers, the RMSE and MAE decrease gradually and tend to become stable, indicating that the model can not only effectively utilize the direct neighbor information but also capture the influence of indirect neighbors on the modeling of user preferences. It is important to note that in dataset Ciao, overfitting occurs, possibly due to the noise that an architecture that applies too deeply can generate for the learning representation. When the number of propagation layers is changed, the model is always superior to other methods on the two datasets, indicating that the propagation mechanism in this model can effectively capture the neighbor information at different levels, which is helpful for improving user preference modeling.


## 5.4.2. Neighbor Relationship Modeling and LSTM Validity Analysis

To better understand the proposed model, this experiment compared three variants of the GHSCF model: GHSCF-β, GHSCF-α, and GHSCF-Item. These three variants are defined as follows:
(i)
GHSCF-β: the purpose of this variant is to study the effect of the attention factor β on the strength of the learning user’s relationship, assuming that each neighbor has the same influence on the target user(ii)
GHSCF-α: in this variant, the bidirectional LSTM structure is replaced by the serial average; that is, the user preferences of different levels are integrated by averaging, and the differences between different levels are ignored(iii)
GHSCF-item: this variant only uses the user vector to evaluate the strong or weak relationship between the user and his neighbors; that is, the influence of the most relevant items is no longer consideredThe results on the Ciao dataset are shown in Figure3. The results using the Epinions dataset are not shown here because similar observations can be made. First, the performance of the GHSCF and GHSCF items is better than that of the GHSCF β. This indicates that not all neighbors have the same influence on target users, and correctly distinguishing the strong and weak relations of neighbors is beneficial for user preference modeling. In addition, the performance of the GHSCF items is worse than that of the GHSCFs. This is because adjacent users may not have an item intersection, and it is not sufficient to capture the strength of user relationships only by considering the user’s own social network information. Therefore, not all information from neighbors is useful when recommending a particular project, and it is more valuable to select neighbor-related projects to measure user relationships. Second, the performance of GHSCF-α is significantly lower than that of GHSCF. This indicates that the bidirectional LSTM component better learns the representation of the sequence of user-item interactions at different levels. Therefore, it is further proven that target users in social networks will have different degrees of preferences for target products due to the influence of neighbors separated by different distances.Figure 3
Results of MAE and RMSE experiments for different variants.


## 5.4.3. Effect of the Embedded Size

Figure4 shows the impact of the embedded sizes of users and items on model performance. As the embedded size increases, the recommended performance first increases and then decreases. When the embedded size is increased from 8 to 64, the performance is significantly improved. However, when the embedding size is 256, the performance is degraded. This shows that using a large embedded size has a powerful representation. If the length of embedding is too large, then the complexity of the model will increase significantly, and overfitting may occur. Therefore, the correct embedding length must be found to balance performance and complexity.Figure 4
Effect of different embedded sizes.
(a)
Ciao—MAE and RMSE(b)
Epinions—MAE and RMSE


## 6. Conclusion and Future Work

We propose a hierarchical social recommendation model that designs an embedded propagation layer. This model takes into account information not only from immediate neighbors but also from distant neighbors, helping to model user preferences at different neighborhood levels. In addition, this paper introduces an object perception method to capture the strength of neighborhood relationships, taking into account the importance of close objects between users. Finally, we propose a bidirectional LSTM with an attention mechanism to extract user-item interaction sequences with different preferences. In addition, to solve the overfitting problem, this paper uses the dropout strategy. Experiments show that neighbors at different levels play an important role in social information modeling. Finally, the feasibility of these changes is tested by a comparative experiment that shows that the GNN can learn more accurate social influence and further improve the recommendation performance.In this work, we only use user-item interaction information to measure the similarity between projects. By contrast, tangential information associated with the project, such as text description and visual content of images, may be more valuable. In addition, we now consider ratings with social information to be static. However, ratings and social information are dynamic. Therefore, in future work, we will consider the establishment of a dynamic GNN for social recommendation.



---

*Source: 9107718-2021-08-31.xml*