Matrix Factorization Recommendation Algorithm Based on Multiple Social Relationships

With the widespread use of social networks, social recommendation algorithms that add social relationships between users to recommender systems have been widely applied. Existing social recommendation algorithms only introduced one type of social relationship to the recommendation system, but in reality, there are often multiple social relationships among users. In this paper, a new matrix factorization recommendation algorithm combined with multiple social relationships is proposed. .rough experiment results analysis on the Epinions dataset, the proposed matrix factorization recommendation algorithm has a significant improvement over the traditional and matrix factorization recommendation algorithms that integrate a single social relationship.


Introduction
With the development of big data technology, data redundancy has seriously interfered with obtaining effective information.
e recommendation system solves the problem well and becomes a research hotspot in related fields. e recommendation system recommends items or information that may be of interest to users based on their hobbies, demand information, and consumer behavior [1,2]. At present, the recommender system had been widely used in different industries, such as Amazon product recommendation, iTunes music recommendation, and Netflix movie recommendation because the recommendation algorithm can filter according to the mass of user history information, mine the deep relationship between users and users or items, and produce more accurate personalized recommendation with preference characteristics, which can better meet the needs of users. e algorithms used by the recommendation system consist of three types: collaborative filtering recommendation algorithms [3,4], content-based recommendation algorithms [5], and hybrid recommendation algorithms [6]. Among them, collaborative filtering recommendation algorithm is currently the most popular, and it consists of three types: item-based collaborative filtering [7], user-based collaborative filtering [8], and matrix factorization collaborative filtering [9]. e matrix factorization collaborative filtering recommendation algorithm has attracted more and more researchers' attention because of its outstanding performance in the Netflix Prize competition. However, in practical applications, only a small number of users will rate or comment on a small number of items. erefore, the matrix factorization recommendation algorithm has obvious data sparsity problem and item coldstart problem. e algorithm expresses the user's scorings of items in matrix form and factorizes the matrix to mine lowdimensional hidden feature space and then get user feature matrix and item feature matrix, finally through inner product operation of the two low-dimensional feature matrixes to describe the relation between users and items. Although the existing recommendation algorithms had obtained a good recommendation result, these traditional recommendation algorithms ignored the influence of social relationships among users on recommendation results. Since social relationships can reflect the similarity between users' preferences, simply considering the user's scoring of the items can no longer meet the recommendation needs, so the social recommendation algorithm that introduces social relationship into recommendation algorithm became current research hotspots in recommendation systems [10]. Hao et al. [11] proposed a weighted bipartite graph recommendation algorithm that used the monotonic saturation function as the weight and used the true value of the number of target users and other items to score relative to the total number of users as the traditional similarity coefficient. Chen et al. [12] calculated the similarity between users and items through similar tags and proposed a joint probability matrix factorization recommendation algorithm that merged the neighbor perception of social tags, effectively using the semantics of the tag improved the recommendation quality. Lin et al. [13] used the principle of trust generation in social psychology, based on the trust extension method of user credibility, to alleviate the sparseness of data, and proposed a matrix recommendation algorithm with enhanced trust. Korpinar et al. [14] based on the shared representation method of user feature matrix, proposed a novel social recommendation model based on shared representation of user feature matrix, which effectively improved the accuracy of recommendation.
Most existing social recommendation algorithms only introduce a social relationship, but each added social relationship affects the recommendation result differently, so introduction of multiple social relationships would definitely improve recommendation accuracy. In this paper, a multiple relationships social network is constructed through a multisubnet composite complex network model [15], a shared user feature matrix is used to introduce multiple social relationships into the recommendation algorithm, and a matrix factorization recommendation algorithm that integrates multiple social relationships is proposed.

Traditional Matrix Factorization Model.
Assuming that the recommendation system includes m customers and n commodities, R m×n � [R ij ] m×n represents the customercommodity scoring matrix, which is shown as Figure 1. R ij represents the rating of customer i to item j, where R ij ∈ [1,5]. Usually, there many empty elements in R m×n , and it will cause a sparse matrix of customer-commodity scoring.
In social networks, as shown in Figure 2, the social relationship between customers can be represented by a matrix C: C � [C ik ] m×m , the value of C ik is 0 or 1, and if C ik � 0, it means that there is no social relationship between customers. e flowchart of traditional matrix factorization algorithm [8] is shown in Figure 3.
Matrix R m×n can be factorized into user feature matrix U m×k and item feature V k×n , respectively. k represents dimension of vector, in general, it is much smaller than m and n, and then dimensionality reduction can be realized. U i and V j represent the potential feature spaces of corresponding users u i and items v j , respectively. e null value in scoring matrix can be forecast through U T i V j , and then the prediction scoring matrix could be obtained.
For the convenience of research, the function f(a) � 1/R max is used to map the customer's scoring of the commodity to [0,1] interval, where R max represents the customer's maximum scoring of commodity. e traditional matrix factorization only uses a simple linear model R � U T V, and the obtained results will be too fitted to the scoring matrix, resulting in the prediction scores deviating too much from the real data, and the final prediction results are distorted. erefore, the logistic function g(a) � 1/(1 + e − a ) is used in this paper, so that the customer's scoring of commodity is defined in the range of [0, 1]. e observed conditional probability distribution can be defined ast where N(x|μ, σ 2 ) indicates that x follows a Gaussian distribution whose mean is μ and variance is σ 2 . I R ij represents  Figure 1: Customer-commodity scoring matrix.  an index function, and if user i has a score of item j, its value is 1; otherwise, it is 0. Suppose U and V obey the spherical Gaussian distribution prior to mean 0: en, through Bayesian inference, the posterior probability distribution of U and V could be obtained as follows:

Matrix Factorization Recommendation Algorithm Integrating a Social Relationship.
In the traditional recommendation algorithm, users are independent of each other, which ignores the users' social relationship. If there is a social relationship between two users, the preferences of users or the choice of items will affect each other. erefore, it is necessary to integrate social relationships into the recommendation algorithm; thus, recommendation accuracy will be improved greatly.
Suppose that there is only one kind of social relationship between users, and the social relationship can be incorporated into the matrix factorization recommendation algorithm through sharing the user's potential eigenspace, which is the same as that in user scoring matrix. en, it is analyzed by probability matrix factorization. C � C ik represents an m × m matrix, which factorizes the social network into user feature matrix U ∈ R l×m and social feature matrix Z ∈ R l×m . e conditional distribution of observed social relationship can be defined: Suppose that U and Z follow the spherical Gaussian prior distribution with mean 0: en, through simple Bayesian inference, the following results can be obtained: where I C ik is an indicator function, and if user i has a social relationship with user k, its value is 1; otherwise, it is 0. e flowchart of matrix factorization recommendation algorithm integrating a social relationship (MFRS1) is shown in Figure 4.
According to the shared user eigenspace, the user's item scoring matrix is closely related to the social relationship matrix, and the posterior distribution of social recommendations can be obtained by logarithm: where C is a constant which does not rely on any parameter, and the maximum posterior distribution function should be equal to the minimum objective function, which is as follows: where λ C ∈ [0, 1] is used to adjust the influence proportion of user scoring matrix and social relationship matrix on recommendation result. When λ C � 1, it means that the social relationship between users is not considered, when λ C � 0, it means that the user scoring matrix has a proportion of 0, and the rest means that a social relationship is integrated.

Matrix Factorization Recommendation Algorithm Integrating Multiple Social Relationships.
In actual social networks, there are often more than one kind of social relationship between users, and each social relationship has a different impact on the recommendation, so introduction of a kind of social relationship would definitely affect recommendation accuracy. Suppose that there are two kinds of social relationships c 1 and c 2 between users, and the flowchart of matrix factorization recommendation algorithm integrating multiple social relationships (MFRS2) is shown in Figure 5.
According to the algorithm, c 1 relationship between users is represented by matrix C 1 � [C 1 ik ] m×m , and c 2 relationship between users is represented by matrix ik ] m×m . If relationship strength of c 1 is β, then relationship strength of c 2 is 1 − β, where β ∈ [0, 1]. erefore, the objective function for minimizing the introduction of two kinds of social relationships is e gradient descent algorithm can be used to solve the objective function as follows: where g ′ (x) � e x /(1 + e x ) 2 represents derivative of logistic function g(x). For reducing model complexity, the corresponding parameter setting is

Results and Analysis
3.1. Experimental Data. In this paper, Epinions is used as the experimental dataset, and it is a knowledge-sharing website where customers could review commodities or give integer scorings between one and five. New customers can use these comments or ratings to determine whether the commodity is worth buying. e Epinions dataset includes the customer's trust relationship, customer's scoring for commodities, and comment information of commodities. It includes 49,290 customers, 139,738 commodities, 664,824 comment messages, and 487,181 trust relationships.
In the course of experiment, a five-fold cross-validation method was used to train and verify the proposed recommended algorithm. e Epinions dataset was separated into five equal groups, one group was randomly selected as test set, and the other four groups were acted as training set. Five experiments were conducted to ensure that each test set is tested. e ultimate experimental result was the average of five experiments.

Evaluation Indicators.
In this paper, two identical evaluation indicators are used to measure the accuracy of recommendations, namely, mean absolute error (MAE) and root mean squared error (RMSE) [16]. ese two indicators measure accuracy of recommendation algorithm through calculating the error between the prediction score and the actual score. e smaller their value, the higher the recommendation accuracy. e definitions of MAE and RMSE are as follows: where r ij represents the real scoring of customer i for commodity j, r ij ′ represents the prediction scoring of customer u i for commodity j, and E P represents the test set.

Experimental Results
Analysis. During the experiment, the number of algorithm user features is K � 5, the number of iterations is 1000, and λ U � λ V � 0.001. e proportion between social relationship matrix and customer scoring matrix can be adjusted by parameter α, and the proportion between the two social relationships can be adjusted by parameter β. e different values of α and β will directly affect the recommendation result. e value of α and β is determined by the method of simulation experiment. β � 1 means that only one kind of social relationship is introduced, when α takes different values, and the change of MAE value and RMSE value in the dataset is shown in Figures 6 and 7.
As shown in Figures 6 and 7, in the Epinions dataset, when α � 0.8, the values of MAE and RMSE are all the smallest; that is, for one social relationship, when α � 0.8, the recommendation accuracy rate is the highest.
O u and O v are used to denote the item sets that customers u and v had scored, respectively, the more commodities which customers u and v jointly scored, the more likely they are to have the same interest and influence each other, and the specific definitions are as follows: When f uv > 0.2, it means that customers u and v have similar interests. Suppose that the relationship between users satisfying this condition is the c 2 relationship. When α and β take different values, the changes in MAE and RMSE on the Epinions dataset are shown in Figures 8 and 9.
As shown in Figures 8 and 9, in the Epinions dataset, when the parameters α � 0.3 and β � 0.4, the value of MAE is the smallest, that is, the recommended accuracy rate in the proposed algorithm is the highest. Similarly, when α � 0.7 and β � 0.5, the value of RMSE is the smallest, which means that the recommendation accuracy in the proposed algorithm is the highest. For verifying the performance of MDRS2 algorithm and the impact of various social relationships on the recommendation, we compared MDRS2 algorithm with SocRec algorithm [14], TDSRec algorithm [17], and MDRS1 algorithm on the Epinions dataset. e SocRec algorithm considers the attributes of social relationships between users on the basis of matrix factorization and incorporates a social relationship; the TDSRec algorithm combines the similarity based on user ratings preferences while considering social networks and predicts the values of customer scoring matrix together. e MDRS1 algorithm only considers one kind of social relationship. e MDRS2 algorithm tightly links the user-item scoring matrix and the social relationship matrix through sharing the user's feature space and integrates multiple social relationships into matrix factorization. e experimental statistical result is shown in Table 1.
As shown in Table 1, in the Epinions dataset, the MAE and RMSE values of the MDRS2 algorithm are smaller than those of other algorithms; that is, the prediction accuracy is higher. It can be seen that the recommendation algorithm that introduces two kinds of social relationships has a higher accuracy rate than other three recommendation algorithms, which indicates that introducing multiple relationships between users would improve recommendation accuracy, and the more relationships between users, the higher the recommendation accuracy.

Conclusions
In this paper, through factorizing the user-item scoring matrix, according to multi-subnet composite complex network, a variety of social relationships are integrated into the matrix factorization recommendation algorithm by using the shared user's potential feature space. Using the matrix factorization recommendation algorithm to the useritem dataset after introducing the social relationship, users' preferences for items will be accurately obtained. rough experiments on real datasets, it is proved that the proposed matrix factorization recommendation algorithm, which combines multiple relationships, improves the recommendation accuracy. It means that introducing multiple social relationships can better personalize recommendations for users, and the more relationships introduced, the better the recommendation effect. In future research, the user's indirect relationship and direct relationship can be combined to further study the impact of social relationships on recommendations.
Data Availability e basic data used in this article are downloaded from the online public dataset: Epinions http://www.trustlet.org/ epinions.html.