


技术领域technical field
本发明属于推荐系统技术领域,具体涉及一种基于联邦矩阵分解的个性化社交推荐方法。The invention belongs to the technical field of recommendation systems, and in particular relates to a personalized social recommendation method based on federated matrix decomposition.
背景技术Background technique
近年来,随着信息技术和互联网的蓬勃发展,人们逐渐从信息匮乏的时代走入了信息过载的时代,在这个时代,无论是信息消费者还是信息生产者都遇到了很大的挑战。作为信息消费者,如何从大量信息中找到自己感兴趣的信息是一件非常困难的事情;而作为信息生产者,如何在大量信息中发现人们所感兴趣的内容,并将其推荐给用户,无疑成为了一个值得人们研究的问题。例如说,一个电影网站怎样利用用户的观影记录信息,从十几万部电影中筛选出用户喜欢的,然后将其推荐给用户;一个电子商务网站如何根据用户的购买记录信息,在几十万商品中找到用户最满意的,并将其推荐,不至于使用户迷失在大量商品信息空间中。而推荐系统的设计和实现,一定程度上解决了信息时代中遇到的这些推荐问题In recent years, with the vigorous development of information technology and the Internet, people have gradually entered an era of information overload from an era of information scarcity. In this era, both information consumers and information producers have encountered great challenges. As an information consumer, how to find the information you are interested in from a large amount of information is a very difficult thing; as an information producer, how to find the content that people are interested in in a large amount of information and recommend it to users is undoubtedly It has become a problem worthy of people's research. For example, how does a movie website use the user's movie viewing record information to select the user's favorite from hundreds of thousands of movies, and then recommend it to the user; Find the most satisfying user among thousands of products, and recommend it, so as not to make users get lost in a large amount of product information space. The design and implementation of the recommendation system has solved these recommendation problems encountered in the information age to a certain extent.
推荐系统发展到今天已经越来越成熟,用户依靠推荐系统来缓解信息过载问题,并从浩瀚的物品(例如电影、音乐、新闻或餐馆)中探索他们感兴趣的东西。推荐系统是指一种根据用户的兴趣特点以及行为,推荐用户感兴趣物品或服务的系统。这种系统的输入是用户的喜好(例如对物品的评分)以及行为等信息,通过相关算法(例如协同过滤)建立用户喜好的数学模型,最终将预测结果(用户可能最感兴趣的商品或服务)输出。The development of recommender systems has become more and more mature today, and users rely on recommender systems to alleviate the problem of information overload and explore what they are interested in from a vast number of items (such as movies, music, news, or restaurants). A recommendation system refers to a system that recommends items or services of interest to users based on their interests and behaviors. The input of this system is the user's preferences (such as ratings on items) and behavior information, through related algorithms (such as collaborative filtering) to establish a mathematical model of user preferences, and finally predict the result (the product or service that the user may be most interested in) ) output.
传统推荐系统仅仅考虑了用户的喜好及行为等主观属性,忽略了用户的社交信息这一客观属性。实际上,用户总是向他们信任的朋友寻求电影、音乐或书籍的推荐,用户的品味和性格很容易受到他们朋友的影响。因此,传统的推荐系统纯粹地挖掘推荐系统的用户-商品评分矩阵,得到的结果有些不真实。其次,在推荐系统的网络环境中,用户越来越强烈地认识到自己的数据是需要保密的,而传统的推荐系统无法满足用户信息的隐私保护需求。Traditional recommendation systems only consider subjective attributes such as users' preferences and behaviors, and ignore the objective attributes of users' social information. In fact, users always seek recommendations for movies, music, or books from their trusted friends, and users' tastes and personalities are easily influenced by their friends. Therefore, the traditional recommender system purely mines the user-item rating matrix of the recommender system, and the results obtained are somewhat unreal. Secondly, in the network environment of the recommendation system, users increasingly realize that their data needs to be kept confidential, and the traditional recommendation system cannot meet the privacy protection requirements of user information.
发明内容Contents of the invention
为了解决现有技术中存在的上述问题,本发明提供了一种基于联邦矩阵分解的个性化社交推荐方法。本发明要解决的技术问题通过以下技术方案实现:In order to solve the above problems in the prior art, the present invention provides a personalized social recommendation method based on federated matrix decomposition. The technical problem to be solved in the present invention is realized through the following technical solutions:
本发明提供了一种基于联邦矩阵分解的个性化社交推荐方法,应用于客户端,该方法包括:The present invention provides a personalized social recommendation method based on federated matrix decomposition, which is applied to the client, and the method includes:
步骤1:获取客户端的初始预测模型,根据所述初始预测模型和客户端用户行为特征,提取所述初始预测模型的模型梯度集合,将其发送至服务器端;Step 1: Obtain the initial prediction model of the client, extract the model gradient set of the initial prediction model according to the initial prediction model and the client user behavior characteristics, and send it to the server;
步骤2:根据接收的更新梯度集合,得到客户端商品特征的条件分布,其中,所述更新梯度集合为所述服务器端对所述模型梯度集合进行处理得到的;Step 2: According to the received update gradient set, obtain the conditional distribution of the client commodity features, wherein the update gradient set is obtained by processing the model gradient set at the server end;
步骤3:获取客户端社交关系特征的条件分布;Step 3: Obtain the conditional distribution of client social relationship features;
步骤4:根据所述客户端商品特征的条件分布和所述客户端社交关系特征的条件分布,构建客户端预测模型,确定该模型的目标函数;Step 4: According to the conditional distribution of the client commodity features and the conditional distribution of the client social relationship features, construct a client prediction model, and determine the objective function of the model;
步骤5:利用所述目标函数对所述客户端预测模型进行优化,利用优化后的客户端预测模型实现用户推荐。Step 5: Using the objective function to optimize the client prediction model, and using the optimized client prediction model to implement user recommendation.
在本发明的一个实施例中,所述客户端用户行为特征包括用户信息、商品信息和用户对商品的评分信息。In an embodiment of the present invention, the user behavior characteristics of the client include user information, product information, and user rating information for the product.
在本发明的一个实施例中,所述服务器端对所述模型梯度集合进行处理得到所述更新梯度,包括:In one embodiment of the present invention, the server side processes the set of model gradients to obtain the update gradient, including:
所述服务器端根据联邦学习模式对接收的多个所述客户端对应的所述模型梯度集合进行聚合平均处理,得到所述更新梯度集合,The server side aggregates and averages the model gradient sets corresponding to the multiple received clients according to the federated learning mode to obtain the updated gradient set,
其中,聚合平均处理过程为:Among them, the aggregation average processing process is:
其中,wk为第k个客户端的模型梯度集合,w为更新梯度集合,t为迭代次数,K为客户端数量,N为所有客户端的样例数量,Nk为第k个客户端的样例数量。Among them, wk is the model gradient set of the kth client, w is the update gradient set, t is the number of iterations, K is the number of clients, N is the number of samples of all clients, Nk is the sample of the kth client quantity.
在本发明的一个实施例中,根据接收的更新梯度集合,构建客户端商品特征的条件分布,包括:In one embodiment of the present invention, according to the received update gradient set, construct the conditional distribution of client commodity features, including:
步骤2.1:根据所述更新梯度集合,利用带动量的随机梯度下降算法对初始商品特征进行更新,得到客户端商品特征,Step 2.1: According to the update gradient set, use the stochastic gradient descent algorithm with momentum to update the initial product features to obtain the client product features,
其中,更新过程如下:Among them, the update process is as follows:
v←αv0+w;v←αv0 +w;
V←V0-lv;V←V0 -lv;
其中,v0为初始商品特征对应的动量,v为更新后的客户端商品特征对应的动量,α为动量参数,V0为初始商品特征,l为学习率,V为客户端商品特征;Among them, v0 is the momentum corresponding to the initial product feature, v is the momentum corresponding to the updated client product feature, α is the momentum parameter, V0 is the initial product feature, l is the learning rate, and V is the client product feature;
步骤2.2:根据所述客户端用户行为特征和所述客户端商品特征构建User-Item矩阵分解模型,得到评分上的条件分布为:Step 2.2: Construct a User-Item matrix decomposition model according to the client user behavior characteristics and the client product characteristics, and obtain the conditional distribution on the score as:
其中,R为评分数据集,U为客户端用户行为特征,V为客户端商品特征,表示评分数据集上的方差,Ui为用户i的潜在特征向量,Vj为商品j的潜在特征向量,m为客户端的用户数量,n为客户端的商品数量,rij为用户i对商品j的评分,为均值为μ和方差为σ2的高斯分布的概率密度函数,IRij为第一指示函数,g(·)为logistic函数,g(x)=1/(1+exp(-x));Among them, R is the rating data set, U is the client user behavior characteristics, V is the client product characteristics, Indicates the variance on the scoring data set, Ui is the latent feature vector of user i, Vj is the latent feature vector of product j, m is the number of users on the client side, n is the number of products on the client side, rij is the user i’s response to product j rating of is the probability density function of the Gaussian distribution whose mean is μ and variance isσ2 , IRij is the first indicator function, g( ) is the logistic function, g(x)=1/(1+exp(-x)) ;
步骤2.3:根据所述评分上的条件分布,为客户端用户行为特征和客户端商品特征添加零均值球形高斯先验,表示为:Step 2.3: According to the conditional distribution on the score, add a zero-mean spherical Gaussian prior to the client user behavior characteristics and client product characteristics, expressed as:
其中,表示客户端用户行为特征上的方差,表示客户端商品特征上的方差,I表示对角矩阵;in, Represents the variance on the client user behavior characteristics, Represents the variance on the client commodity features, I represents the diagonal matrix;
步骤2.4:根据添加零均值球形高斯先验后的客户端用户行为特征和客户端商品特征,通过贝叶斯推理得到客户端商品特征的条件分布,表示为:Step 2.4: According to the client user behavior characteristics and client commodity characteristics after adding the zero-mean spherical Gaussian prior, the conditional distribution of the client commodity characteristics is obtained through Bayesian inference, expressed as:
其中,Z表示因子特征矩阵。Among them, Z represents the factor feature matrix.
在本发明的一个实施例中,所述步骤3包括:In one embodiment of the present invention, said step 3 includes:
步骤3.1:根据所述客户端用户行为特征和所述客户端商品特征,构建有向社交网络图定义社交网络图的社交网络矩阵为C={cik},其中,为顶点集,记为表示一个社交网络中的所有用户,ε为边集合,表示用户之间的关系,社交网络矩阵C为m×m维的非对称矩阵,cik为顶点vi和顶点vk边上的权值;Step 3.1: Construct a directed social network graph according to the client user behavior characteristics and the client product characteristics Define a social network graph The social network matrix of is C={ciik }, where, is a set of vertices, denoted as Represents all users in a social network, ε is a set of edges, representing the relationship between users, the social network matrix C is an asymmetric matrix of m×m dimensions, cik is the weight on the edge of vertex vi and vertex vk ;
步骤3.2:对所述社交网络矩阵进行分解,得到社交网络关系上的条件分布为:Step 3.2: Decompose the social network matrix to obtain the conditional distribution on the social network relationship as:
其中,Z为因子特征矩阵,ICik为第二指示函数,表示修正后的cik,Zk表示第k个因子潜在特征向量,d+(vi)表示节点vi的出度,d-(vk)表示节点vk的入度,表示社交网络矩阵上的方差;Among them, Z is the factor feature matrix, ICik is the second indicator function, represents the corrected cik , Zk represents the kth factor latent feature vector, d+ (vi ) represents the out-degree of node vi , d- (vk ) represents the in-degree of node vk , Represents the variance on the social network matrix;
步骤3.3:根据所述社交网络关系上的条件分布,为客户端用户行为特征和因子特征矩阵添加零均值球形高斯先验,表示为:Step 3.3: According to the conditional distribution on the social network relationship, add a zero-mean spherical Gaussian prior to the client user behavior feature and factor feature matrix, expressed as:
其中,表示因子特征矩阵上的方差;in, Represents the variance on the factor characteristic matrix;
步骤3.4:根据添加零均值球形高斯先验后的客户端用户行为特征和因子特征矩阵,通过贝叶斯推理得到客户端社交关系特征的条件分布,表示为:Step 3.4: According to the client user behavior characteristics and factor feature matrix after adding the zero-mean spherical Gaussian prior, the conditional distribution of the client social relationship characteristics is obtained through Bayesian inference, expressed as:
在本发明的一个实施例中,所述步骤4包括:In one embodiment of the present invention, said step 4 includes:
将所述客户端商品特征的条件分布和所述客户端社交关系特征的条件分布,融合成一个特征表示,得到所述客户端预测模型,该客户端预测模型的社交推荐的后验概率表示为:Combining the conditional distribution of the client commodity features and the conditional distribution of the client social relationship features into a feature representation, the client prediction model is obtained, and the posterior probability of the social recommendation of the client prediction model is expressed as :
其中,是一个不依赖于参数的常数;in, is a constant that does not depend on the parameter;
所述客户端预测模型的目标函数为:The objective function of the client prediction model is:
其中,定义为Frobenius范数。in, Defined as the Frobenius norm.
在本发明的一个实施例中,所述步骤5包括:In one embodiment of the present invention, said step 5 includes:
步骤5.1:按照梯度下降的方式调整所述客户端预测模型的参数,以使所述目标函数值达到局部最小,其中,所述客户端预测模型的参数包括客户端用户行为特征、客户端商品特征和因子特征矩阵;Step 5.1: Adjust the parameters of the client prediction model in a gradient descent manner so that the objective function value reaches a local minimum, wherein the parameters of the client prediction model include client user behavior characteristics and client product characteristics and factor feature matrix;
步骤5.2:根据所述目标函数的局部最小值对应的参数集合,对所述客户端预测模型进行优化,利用优化后的客户端预测模型实现用户推荐。Step 5.2: According to the parameter set corresponding to the local minimum value of the objective function, optimize the client prediction model, and use the optimized client prediction model to implement user recommendation.
与现有技术相比,本发明的有益效果在于:Compared with prior art, the beneficial effect of the present invention is:
本发明的基于联邦矩阵分解的个性化社交推荐方法,协调多个客户端共同训练客户端预测模型,通过将模型梯度发送给至服务器端,同时客户端的数据保留在本地,通过在服务器端进行模型梯度平均,服务器将结果发送给各个客户端用于训练本地模型,在保护用户隐私的前提下构建一个有效的机器学习模型,该模型在提高推荐效率的同时保持推荐的准确度。The personalized social recommendation method based on federated matrix decomposition of the present invention coordinates multiple clients to jointly train the client-side prediction model, by sending the model gradient to the server-side, while the client-side data is kept locally, and the model is carried out on the server-side Gradient averaging, the server sends the results to each client for training the local model, and builds an effective machine learning model under the premise of protecting user privacy, which improves the recommendation efficiency while maintaining the accuracy of the recommendation.
上述说明仅是本发明技术方案的概述,为了能够更清楚了解本发明的技术手段,而可依照说明书的内容予以实施,并且为了让本发明的上述和其他目的、特征和优点能够更明显易懂,以下特举较佳实施例,并配合附图,详细说明如下。The above description is only an overview of the technical solution of the present invention. In order to better understand the technical means of the present invention, it can be implemented according to the contents of the description, and in order to make the above and other purposes, features and advantages of the present invention more obvious and understandable , the following preferred embodiments are specifically cited below, and are described in detail as follows in conjunction with the accompanying drawings.
附图说明Description of drawings
图1是本发明实施例提供的一种基于联邦矩阵分解的个性化社交推荐方法的流程图;Fig. 1 is a flowchart of a personalized social recommendation method based on federated matrix decomposition provided by an embodiment of the present invention;
图2是本发明方法与非联邦方法的仿真实验比较图;Fig. 2 is the comparison figure of simulation experiment of the inventive method and non-federal method;
图3是本发明方法与无社交方法的仿真实验比较图。Fig. 3 is a comparison diagram of simulation experiments between the method of the present invention and the non-social method.
具体实施方式Detailed ways
为了进一步阐述本发明为达成预定发明目的所采取的技术手段及功效,以下结合附图及具体实施方式,对依据本发明提出的一种基于联邦矩阵分解的个性化社交推荐方法进行详细说明。In order to further explain the technical means and effects adopted by the present invention to achieve the intended purpose of the invention, a personalized social recommendation method based on federated matrix decomposition proposed according to the present invention will be described in detail below in conjunction with the accompanying drawings and specific implementation methods.
有关本发明的前述及其他技术内容、特点及功效,在以下配合附图的具体实施方式详细说明中即可清楚地呈现。通过具体实施方式的说明,可对本发明为达成预定目的所采取的技术手段及功效进行更加深入且具体地了解,然而所附附图仅是提供参考与说明之用,并非用来对本发明的技术方案加以限制。The aforementioned and other technical contents, features and effects of the present invention can be clearly presented in the following detailed description of specific implementations with accompanying drawings. Through the description of specific embodiments, the technical means and effects of the present invention to achieve the intended purpose can be understood more deeply and specifically, but the accompanying drawings are only for reference and description, and are not used to explain the technical aspects of the present invention. program is limited.
实施例一Embodiment one
请参见图1,图1是本发明实施例提供的一种基于联邦矩阵分解的个性化社交推荐方法的流程图,本实施例的基于联邦矩阵分解的个性化社交推荐方法应用于客户端,该方法包括:Please refer to FIG. 1. FIG. 1 is a flowchart of a personalized social recommendation method based on federated matrix decomposition provided by an embodiment of the present invention. The personalized social recommendation method based on federated matrix decomposition in this embodiment is applied to a client. Methods include:
步骤1:获取客户端的初始预测模型,根据初始预测模型和客户端用户行为特征,提取初始预测模型的模型梯度集合,将其发送至服务器端;Step 1: Obtain the initial prediction model of the client, extract the model gradient set of the initial prediction model according to the initial prediction model and the user behavior characteristics of the client, and send it to the server;
在本实施例中,一个服务器端对应多个客户端,每个客户端包括多个用户。其中,客户端用户行为特征包括用户信息(该用户信息可以是用户的编号)、商品信息(该商品信息可以是商品的编号)和用户对商品的评分信息(该评分信息可以是用户对商品偏好程度的打分)。In this embodiment, one server corresponds to multiple clients, and each client includes multiple users. Among them, the client user behavior features include user information (the user information can be the serial number of the user), commodity information (the commodity information can be the serial number of the commodity) and the user's rating information on the commodity (the scoring information can be the user's preference for the commodity). degree of scoring).
可选地,利用概率矩阵分解算法,从客户端用户行为特征和客户端初始预测模型中提取得到客户端的初始预测模型的梯度,多个客户端将其对对应的初始预测模型的梯度集合发送至服务器端。Optionally, using the probability matrix decomposition algorithm, the gradient of the client's initial prediction model is extracted from the client user behavior characteristics and the client's initial prediction model, and multiple clients send their gradient sets for the corresponding initial prediction model to Service-Terminal.
在本实施例中,客户端初始预测模型为随机产生的。In this embodiment, the initial prediction model of the client is randomly generated.
步骤2:根据接收的更新梯度集合,得到客户端商品特征的条件分布,其中,更新梯度集合为服务器端对模型梯度集合进行处理得到的;Step 2: According to the received update gradient set, obtain the conditional distribution of the client product features, where the update gradient set is obtained by processing the model gradient set on the server side;
在本实施例中,服务器端根据联邦学习模式对接收的多个客户端对应的模型梯度集合进行聚合平均处理,得到更新梯度集合,In this embodiment, the server side aggregates and averages the received model gradient sets corresponding to multiple clients according to the federated learning mode to obtain an updated gradient set,
其中,聚合平均处理过程为:Among them, the aggregation average processing process is:
其中,wk为第k个客户端的模型梯度集合,w为更新梯度集合,t为迭代次数,K为客户端数量,N为所有客户端的样例数量,Nk为第k个客户端的样例数量。Among them, wk is the model gradient set of the kth client, w is the update gradient set, t is the number of iterations, K is the number of clients, N is the number of samples of all clients, Nk is the sample of the kth client quantity.
在本实施例中,服务器端对模型梯度集合进行处理得到更新梯度集合之后,将其发送至每一个客户端,客户端根据接收的更新梯度集合执行本地更新过程。In this embodiment, after the server side processes the model gradient set to obtain an updated gradient set, it sends it to each client, and the client executes a local update process according to the received updated gradient set.
需要说明的是,在联邦学习的训练过程中,客户端的用户原始数据始终保留在客户端(本地),服务器端和用户之间通过共享加密的或不包含隐私信息的中间参数的方式进行模型训练和参数更新。在本实施例中,利用联邦学习模式在服务器端进行模型梯度集合的聚合平均处理,实现了对用户隐私信息的保护。It should be noted that during the training process of federated learning, the original user data of the client is always kept on the client (local), and the server and the user share encrypted or intermediate parameters that do not contain private information for model training. and parameter updates. In this embodiment, the aggregation and average processing of the model gradient set is performed on the server side by using the federated learning mode, so as to realize the protection of user privacy information.
在本实施例中,构建客户端商品特征的条件分布包括,将观察到的评分上潜在用户和商品特征表示为条件分布、为客户端用户行为特征和客户端商品特征添加零均值球形高斯先验(zero-mean spherical Gaussian priors)、以及通过贝叶斯推理得到最终的条件分布。In this embodiment, constructing the conditional distribution of client product features includes expressing the observed potential user and product features on the score as a conditional distribution, and adding a zero-mean spherical Gaussian prior to the client user behavior features and client product features (zero-mean spherical Gaussian priors), and the final conditional distribution is obtained through Bayesian inference.
具体地,包括以下步骤:Specifically, the following steps are included:
步骤2.1:根据更新梯度集合,利用带动量的随机梯度下降算法对初始商品特征进行更新,得到客户端商品特征,Step 2.1: According to the update gradient set, use the stochastic gradient descent algorithm with momentum to update the initial product features to obtain the client product features,
其中,更新过程如下:Among them, the update process is as follows:
v←αv0+w(2);v←αv0 +w(2);
V←V0-lv(3);V←V0 -lv(3);
其中,v0为初始商品特征对应的动量,v为更新后的客户端商品特征对应的动量,α为动量参数,V0为初始商品特征,l为学习率,V为客户端商品特征。Among them, v0 is the momentum corresponding to the initial product features, v is the momentum corresponding to the updated client product features, α is the momentum parameter, V0 is the initial product features, l is the learning rate, and V is the client product features.
在本实施例中,初始商品特征为随机产生的。In this embodiment, the initial commodity features are randomly generated.
步骤2.2:根据客户端用户行为特征和客户端商品特征构建User-Item矩阵分解模型,得到评分上的条件分布为:Step 2.2: Construct the User-Item matrix decomposition model according to the client user behavior characteristics and client product characteristics, and obtain the conditional distribution on the score as follows:
其中,R为评分数据集,在本实施例中,R评分数据集根据客户端用户行为特征中的用户对商品的评分信息得到;U为客户端用户行为特征,V为客户端商品特征,其中,U∈Rl×m,V∈Rl×n,l表示特征维度;表示评分数据集上的方差,Ui为用户i的潜在特征向量,Vj为商品j的潜在特征向量,m为客户端的用户数量,n为客户端的商品数量,rij为用户i对商品j的评分,为均值为μ和方差为σ2的高斯分布的概率密度函数,IRij为第一指示函数,在本实施例中,如果用户i评过商品j则IRij等于1,否则为0;g(·)为logistic函数,g(x)=1/(1+exp(-x)),在本实施例中,logistic函数可以使的范围限制到[0,1]。Wherein, R is a scoring data set, and in the present embodiment, the R scoring data set is obtained according to the rating information of the user in the client user behavior feature to the product; U is the client user behavior feature, and V is the client product feature, where , U∈Rl×m , V∈Rl×n , l represents the feature dimension; Indicates the variance on the scoring data set, Ui is the latent feature vector of user i, Vj is the latent feature vector of product j, m is the number of users on the client side, n is the number of products on the client side, rij is the user i’s response to product j rating of It is the probability density function of the Gaussian distribution that the mean is μ and the variance is σ2 , IRij is the first indicator function, in this embodiment, if user i has commented on product j then IRij is equal to 1, otherwise it is 0; g( ) is a logistic function, g(x)=1/(1+exp(-x)), in the present embodiment, the logistic function can make The range is limited to [0,1].
步骤2.3:根据评分上的条件分布,为客户端用户行为特征和客户端商品特征添加零均值球形高斯先验,表示为:Step 2.3: According to the conditional distribution on the score, add a zero-mean spherical Gaussian prior to the client user behavior characteristics and client product characteristics, expressed as:
其中,表示客户端用户行为特征上的方差,表示客户端商品特征上的方差,I表示对角矩阵。in, Represents the variance on the client user behavior characteristics, Represents the variance on the client product features, and I represents the diagonal matrix.
步骤2.4:根据添加零均值球形高斯先验后的客户端用户行为特征和客户端商品特征,通过贝叶斯推理得到客户端商品特征的条件分布,表示为:Step 2.4: According to the client user behavior characteristics and client commodity characteristics after adding the zero-mean spherical Gaussian prior, the conditional distribution of the client commodity characteristics is obtained through Bayesian inference, expressed as:
其中,Z表示因子特征矩阵。Among them, Z represents the factor feature matrix.
步骤3:获取客户端社交关系特征的条件分布;Step 3: Obtain the conditional distribution of client social relationship features;
具体地,包括:Specifically, including:
步骤3.1:根据客户端用户行为特征和客户端商品特征,构建有向社交网络图定义社交网络图的社交网络矩阵为C={cik},其中,为顶点集,记为表示一个社交网络中的所有用户,ε为边集合,表示用户之间的关系,社交网络矩阵C为m×m维的非对称矩阵,cik为顶点vi和顶点vk边上的权值,其表示在社交网络中用户i信任或了解用户k的程度;Step 3.1: Construct a directed social network graph based on client user behavior characteristics and client product characteristics Define a social network graph The social network matrix of is C={ciik }, where, is a set of vertices, denoted as Represents all users in a social network, ε is a set of edges, representing the relationship between users, the social network matrix C is an asymmetric matrix of m×m dimensions, cik is the weight on the edge of vertex vi and vertex vk , which represents the degree to which user i trusts or knows user k in the social network;
在本实施例的社交网络图中,对于一对顶点vi和vk,cik∈(0,1],因为在社交网络中,特别是在一个基于信任的社交网络中,用户i信任k不一定需要用户k信任i,因此,社交网络矩阵C为非对称矩阵。The social network graph in this example , for a pair of vertices vi and vk , cik ∈ (0,1], because in a social network, especially in a trust-based social network, user i trust k does not necessarily require user k trust i, Therefore, the social network matrix C is an asymmetric matrix.
步骤3.2:对社交网络矩阵进行分解,得到社交网络关系上的条件分布为:Step 3.2: Decompose the social network matrix to obtain the conditional distribution on the social network relationship as:
其中,Z为因子特征矩阵,ICik为第二指示函数,在本实施例中,如果用户i信任或了解用户k则ICik等于1,否则为0;表示修正后的cik,Zk表示第k个因子潜在特征向量,d+(vi)表示节点vi的出度,d-(vk)表示节点vk的入度,表示社交网络矩阵上的方差;Wherein, Z is a factor feature matrix, and ICik is a second indicator function. In this embodiment, if user i trusts or understands user k, then ICik is equal to 1, otherwise it is 0; represents the corrected cik , Zk represents the kth factor latent feature vector, d+ (vi ) represents the out-degree of node vi , d- (vk ) represents the in-degree of node vk , Represents the variance on the social network matrix;
在本实施例中,社交网络矩阵分解的是基于分析社交网络提出用户的高质量l维特征表示,其中,U∈Rl×m,Z∈Rl×n。logistic函数可以使的范围限制到[0,1]。In this example, the social network matrix factorization is based on analyzing the social network A high-quality l-dimensional feature representation of users is proposed, where U ∈ Rl×m , Z ∈ Rl×n . The logistic function can make The range is limited to [0,1].
需要说明的是,在线社交网络中,cik的值由用户i对用户k显式表示,由于包含噪声并且忽略了社交网络的图特征信息,因此,它不能准确地描述用户之间的关系,在本实施例中,采用c*ik替代cik。It should be noted that in an online social network, the value of cik is explicitly represented by user i to user k. Since it contains noise and ignores the graph feature information of the social network, it cannot accurately describe the relationship between users. In this embodiment, cik is replaced by c*ik .
步骤3.3:根据社交网络关系上的条件分布,为客户端用户行为特征和因子特征矩阵添加零均值球形高斯先验,表示为:Step 3.3: According to the conditional distribution on the social network relationship, add a zero-mean spherical Gaussian prior to the client user behavior feature and factor feature matrix, expressed as:
其中,表示因子特征矩阵上的方差;in, Represents the variance on the factor feature matrix;
步骤3.4:根据添加零均值球形高斯先验后的客户端用户行为特征和因子特征矩阵,通过贝叶斯推理得到客户端社交关系特征的条件分布,表示为:Step 3.4: According to the client user behavior characteristics and factor feature matrix after adding the zero-mean spherical Gaussian prior, the conditional distribution of the client social relationship characteristics is obtained through Bayesian inference, expressed as:
在本实施例中,通过获取本地客户端对应的社交关系特征,从而增强客户端的用户表征,以缓解冷启动问题。In this embodiment, the user representation of the client is enhanced by acquiring the social relationship features corresponding to the local client, so as to alleviate the cold start problem.
步骤4:根据客户端商品特征的条件分布和客户端社交关系特征的条件分布,构建客户端预测模型,确定该模型的目标函数;Step 4: According to the conditional distribution of client commodity features and the conditional distribution of client social relationship features, construct a client prediction model and determine the objective function of the model;
具体地,步骤4包括:Specifically, step 4 includes:
将客户端商品特征的条件分布和客户端社交关系特征的条件分布,融合成一个特征表示,得到客户端预测模型,该客户端预测模型的社交推荐的后验概率表示为:The conditional distribution of client commodity features and the conditional distribution of client social relationship features are fused into a feature representation to obtain a client prediction model. The posterior probability of social recommendation of the client prediction model is expressed as:
其中,是一个不依赖于参数的常数;in, is a constant that does not depend on the parameter;
客户端预测模型的目标函数为:The objective function of the client predictive model is:
其中,定义为Frobenius范数。in, Defined as the Frobenius norm.
由于用户的社交信息在一定程度上反映了朋友在他对一些物品或服务选择上的影响。例如,当用户向朋友请求推荐一部电影或一家餐馆时,实际上是在请求一个口头的社交推荐。本实施例正是根据这一思想,将用户的社交信息加入到推荐方法中,使用户的信息更完善,以解决数据的稀疏性,从而提高了算法的预测准确率,使得用户对推荐的商品更满意。Since the user's social information reflects the influence of friends on his selection of some items or services to a certain extent. For example, when a user asks a friend for a movie or restaurant recommendation, they are actually asking for a verbal social recommendation. Based on this idea, this embodiment adds the user's social information into the recommendation method to make the user's information more complete to solve the sparsity of the data, thereby improving the prediction accuracy of the algorithm and making the user's recommendation of the recommended product more accurate. more satisfied.
步骤5:利用目标函数对客户端预测模型进行优化,利用优化后的客户端预测模型实现用户推荐。Step 5: Use the objective function to optimize the client prediction model, and use the optimized client prediction model to implement user recommendation.
在保持观测噪声方差和先验方差不变的情况下,最大化三个潜在特征(U、V和Z)上的后验概率(log-posterior),相当于最小化上述公式(14)的具有二次正则项的sum-of-squared-errors目标函数。In the case of keeping the observation noise variance and the prior variance constant, maximizing the posterior probability (log-posterior) on the three latent features (U, V, and Z) is equivalent to minimizing the above formula (14) with The sum-of-squared-errors objective function for the quadratic regularizer.
具体地,步骤5包括:Specifically, step 5 includes:
步骤5.1:按照梯度下降的方式调整客户端预测模型的参数,以使目标函数值达到局部最小,其中,客户端预测模型的参数包括客户端用户行为特征、客户端商品特征和因子特征矩阵;Step 5.1: Adjust the parameters of the client forecasting model in a gradient descent manner so that the objective function value reaches a local minimum, wherein the parameters of the client forecasting model include client user behavior characteristics, client commodity characteristics and factor feature matrix;
可选地,采用引入带动量的随机梯度下降算法更新模型参数。Optionally, the model parameters are updated using the stochastic gradient descent algorithm with momentum.
在本实施例中,由于用户数据分布的特征,客户端之间的依赖程度更高,模型需要更加精细地设计,引入带动量的随机梯度下降算法更新模型参数,能够进一步提高推荐系统的精度。In this embodiment, due to the characteristics of user data distribution, the dependence between clients is higher, and the model needs to be more carefully designed. The introduction of stochastic gradient descent algorithm with momentum to update model parameters can further improve the accuracy of the recommendation system.
步骤5.2:根据目标函数的局部最小值对应的参数集合,对客户端预测模型进行优化,利用优化后的客户端预测模型实现用户推荐。Step 5.2: According to the parameter set corresponding to the local minimum value of the objective function, optimize the client prediction model, and use the optimized client prediction model to realize user recommendation.
需要说明的是,对客户端预测模型的参数进行进一步处理,能够得到优化模型。处理规则由本领域技术人员根据业务需要进行确定,在本实施例中不作限制。可选地,采用SGD处理规则,经过SGD能够得到最优的参数集合,利用该最优的参数集合优化客户端预测模型。It should be noted that the optimized model can be obtained by further processing the parameters of the client prediction model. The processing rules are determined by those skilled in the art according to business needs, and are not limited in this embodiment. Optionally, an SGD processing rule is adopted, an optimal parameter set can be obtained through SGD, and the client prediction model is optimized using the optimal parameter set.
在本实施例中,通过在Ui,Vj和Zk上执行梯度下降得到目标函数的局部最小值,具体过程如下所示:In this embodiment, the local minimum of the objective function is obtained by performing gradient descent on Ui , Vj and Zk , and the specific process is as follows:
其中,g′(·)是logistic函数的导数,g′(x)=exp(x)/(1+exp(x))2。Wherein, g′(·) is the derivative of the logistic function, g′(x)=exp(x)/(1+exp(x))2 .
进一步地,值得注意的是,在获取优化后的客户端预测模型后,可以通过对本地客户端预测模型和用户行为特征进行配准,以检验该优化后的客户端预测模型的效果。Further, it is worth noting that after obtaining the optimized client prediction model, the effect of the optimized client prediction model can be checked by registering the local client prediction model with user behavior characteristics.
本实施例的基于联邦矩阵分解的个性化社交推荐方法,能够在大规模客户端应用的场景下,协调多个客户端共同训练全局模型,客户端将模型梯度发送给中心服务器端,同时,客户端的数据保留在本地,通过在服务器端进行模型梯度平均,服务器端将结果发送给各个客户端用于训练本地模型,在保护用户隐私的前提下构建一个有效的机器学习模型。另外,客户端根据服务器端返回的结果,执行带动量的随机梯度下降算法对参数更新,防止了信息冗余,提高了迭代速度,加快收敛,避免陷入庞大的计算量,帮助寻找最小的损失值,从而达到优化模型的效果,提高了模型精度。The personalized social recommendation method based on federated matrix decomposition in this embodiment can coordinate multiple clients to jointly train the global model in the scenario of large-scale client application, and the client sends the model gradient to the central server. At the same time, the client The data on the client side is kept locally, and the model gradient is averaged on the server side, and the server side sends the results to each client side for training the local model, building an effective machine learning model under the premise of protecting user privacy. In addition, according to the results returned by the server, the client executes the stochastic gradient descent algorithm with momentum to update the parameters, which prevents information redundancy, improves the iteration speed, accelerates convergence, avoids falling into a huge amount of calculation, and helps to find the minimum loss value , so as to achieve the effect of optimizing the model and improve the accuracy of the model.
实施例二Embodiment two
本实施例通过仿真实验对实施例一的基于联邦矩阵分解的个性化社交推荐方法的效果进行具体说明。In this embodiment, the effects of the personalized social recommendation method based on federated matrix decomposition in Embodiment 1 are specifically described through simulation experiments.
1.仿真条件。1. Simulation conditions.
本实施例的仿真实验平台采用Intel(R)Core(TM)CPU i7-8750H2.20GHz,内存为32GB,运行windows 10的PC机,编程语言为Python。The simulation experiment platform of this embodiment adopts Intel(R) Core(TM) CPU i7-8750H2.20GHz, the memory is 32GB, the PC running windows 10, and the programming language is Python.
2.仿真内容与结果分析。2. Simulation content and result analysis.
以下center_loss表示基于矩阵分解的个性化社交推荐算法,该算法中不考虑联邦学习,client_loss和client_loss_social表示基于联邦矩阵分解的个性化社交推荐方法,client_loss_nosocial表示基于联邦矩阵分解的个性化推荐算法,在该算法中不考虑用户社交信息。其中参数设置相同。The following center_loss represents a personalized social recommendation algorithm based on matrix decomposition, which does not consider federated learning. client_loss and client_loss_social represent a personalized social recommendation method based on federated matrix decomposition, and client_loss_nosocial represents a personalized recommendation algorithm based on federated matrix decomposition. In this The algorithm does not consider user social information. The parameter settings are the same.
如图2所示的本发明方法与非联邦方法(该推荐方法中不考虑联邦学习)的仿真实验比较图,选择两个参与联邦训练的客户端,从实验结果可以看出本发明的方法可以得到精度更高,质量更好的结果,表明了本发明方法的有效性。As shown in Figure 2, the simulation experiment comparison between the method of the present invention and the non-federated method (federal learning is not considered in this recommended method), two clients participating in federated training are selected, and it can be seen from the experimental results that the method of the present invention can A result with higher precision and better quality is obtained, which shows the effectiveness of the method of the present invention.
如图3所示的本发明方法与无社交方法(该推荐方法中不考虑用户社交信息)的仿真实验比较图,从实验结果可以看出本发明的添加社交关系的推荐方法对比不添加社交关系的推荐方法可以得到更好的仿真结果,表明了本发明方法在一定程度上缓解了冷启动问题。As shown in Figure 3, the comparison diagram of the simulation experiment between the method of the present invention and the non-social method (the user social information is not considered in this recommendation method), from the experimental results, it can be seen that the recommendation method of adding social relations of the present invention is compared without adding social relations The recommended method can get better simulation results, which shows that the method of the present invention alleviates the cold start problem to a certain extent.
应当说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的物品或者设备中还存在另外的相同要素。It should be noted that in this article, relational terms such as first and second etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply that there is a relationship between these entities or operations. There is no such actual relationship or order between them. Furthermore, the terms "comprises", "comprises" or any other variation are intended to cover a non-exclusive inclusion such that an article or device comprising a set of elements includes not only those elements but also other elements not expressly listed. Without further limitations, an element defined by the phrase "comprising a" does not exclude the presence of additional identical elements in the article or device comprising said element.
以上内容是结合具体的优选实施方式对本发明所作的进一步详细说明,不能认定本发明的具体实施只局限于这些说明。对于本发明所属技术领域的普通技术人员来说,在不脱离本发明构思的前提下,还可以做出若干简单推演或替换,都应当视为属于本发明的保护范围。The above content is a further detailed description of the present invention in conjunction with specific preferred embodiments, and it cannot be assumed that the specific implementation of the present invention is limited to these descriptions. For those of ordinary skill in the technical field of the present invention, without departing from the concept of the present invention, some simple deduction or replacement can be made, which should be regarded as belonging to the protection scope of the present invention.
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202210795895.7ACN115374953A (en) | 2022-07-07 | 2022-07-07 | A Personalized Social Recommendation Method Based on Federated Matrix Factorization |
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202210795895.7ACN115374953A (en) | 2022-07-07 | 2022-07-07 | A Personalized Social Recommendation Method Based on Federated Matrix Factorization |
| Publication Number | Publication Date |
|---|---|
| CN115374953Atrue CN115374953A (en) | 2022-11-22 |
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202210795895.7APendingCN115374953A (en) | 2022-07-07 | 2022-07-07 | A Personalized Social Recommendation Method Based on Federated Matrix Factorization |
| Country | Link |
|---|---|
| CN (1) | CN115374953A (en) |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN116011540A (en)* | 2022-12-13 | 2023-04-25 | 西安交通大学 | A federated learning method and device based on social grouping |
| CN118332165A (en)* | 2024-04-21 | 2024-07-12 | 西南财经大学 | Efficient federal matrix decomposition recommendation method for communication |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN116011540A (en)* | 2022-12-13 | 2023-04-25 | 西安交通大学 | A federated learning method and device based on social grouping |
| CN116011540B (en)* | 2022-12-13 | 2025-07-18 | 西安交通大学 | Federal learning method and device based on social grouping |
| CN118332165A (en)* | 2024-04-21 | 2024-07-12 | 西南财经大学 | Efficient federal matrix decomposition recommendation method for communication |
| CN118332165B (en)* | 2024-04-21 | 2025-06-13 | 西南财经大学 | Communication-Efficient Federated Matrix Factorization Recommendation Method |
| Publication | Publication Date | Title |
|---|---|---|
| Li et al. | Hybrid algorithm based on content and collaborative filtering in recommendation system optimization and simulation | |
| US10515424B2 (en) | Machine learned query generation on inverted indices | |
| Ahmed et al. | Rating‐Based Recommender System Based on Textual Reviews Using IoT Smart Devices | |
| WO2022041979A1 (en) | Information recommendation model training method and related device | |
| US10965775B2 (en) | Discovering signature of electronic social networks | |
| Guo et al. | Cold start recommendation based on attribute-fused singular value decomposition | |
| US20150187024A1 (en) | System and Method for Socially Aware Recommendations Based on Implicit User Feedback | |
| CN107526850A (en) | Social networks friend recommendation method based on multiple personality feature mixed architecture | |
| Xu et al. | Integrated collaborative filtering recommendation in social cyber-physical systems | |
| CN109460520B (en) | Point-of-interest recommendation method based on geo-social relationship and deep implicit interest mining | |
| CN107113466A (en) | To user's recommended project | |
| Dakhel et al. | A social recommender system using item asymmetric correlation | |
| CN113836393B (en) | Cold start recommendation method based on preference self-adaptive meta-learning | |
| CN111475744B (en) | Personalized position recommendation method based on ensemble learning | |
| JP2019113943A (en) | Information providing apparatus, information providing method, and program | |
| Zhang et al. | Precision Marketing Method of E‐Commerce Platform Based on Clustering Algorithm | |
| CN115374953A (en) | A Personalized Social Recommendation Method Based on Federated Matrix Factorization | |
| Li | Accurate digital marketing communication based on intelligent data analysis | |
| Chen et al. | A novel social recommendation method fusing user’s social status and homophily based on matrix factorization techniques | |
| Pipergias Analytis et al. | The structure of social influence in recommender networks | |
| Chen et al. | A probabilistic linguistic and dual trust network-based user collaborative filtering model | |
| Huang et al. | Improved collaborative filtering personalized recommendation algorithm based on k-means clustering and weighted similarity on the reduced item space | |
| Wan et al. | A recommendation approach based on heterogeneous network and dynamic knowledge graph | |
| Zhao et al. | A Hierarchical Attention Recommender System Based on Cross‐Domain Social Networks | |
| CN108763515B (en) | Time-sensitive personalized recommendation method based on probability matrix decomposition |
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination |