CN116089715A - Sequence recommendation method based on personalized federal technology - Google Patents
Sequence recommendation method based on personalized federal technology Download PDFInfo
- Publication number
- CN116089715A CN116089715A CN202310023696.9A CN202310023696A CN116089715A CN 116089715 A CN116089715 A CN 116089715A CN 202310023696 A CN202310023696 A CN 202310023696A CN 116089715 A CN116089715 A CN 116089715A
- Authority
- CN
- China
- Prior art keywords
- sequence
- client
- sub
- local
- data
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 36
- 238000005516 engineering process Methods 0.000 title claims abstract description 27
- 238000012549 training Methods 0.000 claims abstract description 45
- 230000003993 interaction Effects 0.000 claims abstract description 14
- 238000007781 pre-processing Methods 0.000 claims abstract description 6
- 239000013598 vector Substances 0.000 claims description 16
- 230000006870 function Effects 0.000 claims description 14
- 230000002776 aggregation Effects 0.000 claims description 12
- 238000004220 aggregation Methods 0.000 claims description 12
- 238000003860 storage Methods 0.000 claims description 10
- 230000008569 process Effects 0.000 claims description 7
- 238000005457 optimization Methods 0.000 claims description 5
- 238000004140 cleaning Methods 0.000 claims description 3
- 230000002452 interceptive effect Effects 0.000 claims description 3
- 230000007246 mechanism Effects 0.000 claims description 3
- 230000002159 abnormal effect Effects 0.000 claims description 2
- 238000010586 diagram Methods 0.000 description 3
- 101001121408 Homo sapiens L-amino-acid oxidase Proteins 0.000 description 2
- 102100026388 L-amino-acid oxidase Human genes 0.000 description 2
- 101100012902 Saccharomyces cerevisiae (strain ATCC 204508 / S288c) FIG2 gene Proteins 0.000 description 2
- 230000006399 behavior Effects 0.000 description 2
- 238000004364 calculation method Methods 0.000 description 2
- 230000002708 enhancing effect Effects 0.000 description 2
- 238000011160 research Methods 0.000 description 2
- 230000000717 retained effect Effects 0.000 description 2
- NAWXUBYGYWOOIX-SFHVURJKSA-N (2s)-2-[[4-[2-(2,4-diaminoquinazolin-6-yl)ethyl]benzoyl]amino]-4-methylidenepentanedioic acid Chemical compound C1=CC2=NC(N)=NC(N)=C2C=C1CCC1=CC=C(C(=O)N[C@@H](CC(=C)C(O)=O)C(O)=O)C=C1 NAWXUBYGYWOOIX-SFHVURJKSA-N 0.000 description 1
- 238000012935 Averaging Methods 0.000 description 1
- 101100233916 Saccharomyces cerevisiae (strain ATCC 204508 / S288c) KAR5 gene Proteins 0.000 description 1
- 230000004888 barrier function Effects 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 238000004891 communication Methods 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000009826 distribution Methods 0.000 description 1
- 230000007613 environmental effect Effects 0.000 description 1
- 238000002474 experimental method Methods 0.000 description 1
- 239000011159 matrix material Substances 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000001537 neural effect Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/95—Retrieval from the web
- G06F16/953—Querying, e.g. by the use of web search engines
- G06F16/9535—Search customisation based on user profiles and personalisation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F21/60—Protecting data
- G06F21/62—Protecting access to data via a platform, e.g. using keys or access control rules
- G06F21/6218—Protecting access to data via a platform, e.g. using keys or access control rules to a system of files or objects, e.g. local or distributed file system or database
- G06F21/6245—Protecting personal data, e.g. for financial or medical purposes
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/08—Learning methods
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Databases & Information Systems (AREA)
- Physics & Mathematics (AREA)
- General Health & Medical Sciences (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Health & Medical Sciences (AREA)
- Software Systems (AREA)
- Data Mining & Analysis (AREA)
- Bioethics (AREA)
- Computational Linguistics (AREA)
- Artificial Intelligence (AREA)
- Evolutionary Computation (AREA)
- Life Sciences & Earth Sciences (AREA)
- Molecular Biology (AREA)
- Computing Systems (AREA)
- Mathematical Physics (AREA)
- Biophysics (AREA)
- Biomedical Technology (AREA)
- Medical Informatics (AREA)
- Computer Hardware Design (AREA)
- Computer Security & Cryptography (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
Description
技术领域Technical Field
本发明涉及计算机技术领域,特别是一种基于个性化联邦技术的序列推荐方法。The present invention relates to the field of computer technology, and in particular to a sequence recommendation method based on personalized federation technology.
背景技术Background Art
序列推荐系统的主要任务是通过具有时间先后关系的行为序列来挖掘用户的行为模式,以建模客户端的动态偏好,预测客户端在下一时刻的物品选择情况。由于序列推荐很有可能将收集到的用户数据用于恶意交易等,许多用户担心自己的隐私被泄露而不愿意共享数据。这很容易造成“数据孤岛”、“推荐壁垒”等严重问题。因此,基于隐私保护的序列推荐系统已经受到了工业界和学术界的高度重视和大量研究探讨。The main task of the sequential recommendation system is to mine the user's behavior patterns through a sequence of behaviors with a time sequence relationship, so as to model the client's dynamic preferences and predict the client's item selection at the next moment. Since sequential recommendation is likely to use the collected user data for malicious transactions, many users are worried about their privacy being leaked and are unwilling to share data. This can easily lead to serious problems such as "data islands" and "recommendation barriers". Therefore, the sequential recommendation system based on privacy protection has received great attention and extensive research and discussion from the industry and academia.
目前现有的基于隐私保护的序列推荐方法主要是通过引入密码学知识来进行数据保护,比如同态加密算法、差分隐私技术。在最新的技术研究中,一些研究人员通过联邦学习来对序列推荐系统进行隐私保护。虽然联邦架构可以使用户数据不出本地,但这样的分布式数据和架构降低了序列推荐模型的有效性。假设具有某些属性而可归为一类的客户端称为一个域,则上述问题具体体现在:(1)域间模型不平衡:单一全局模型无法适应所有域的序列特征。这可能是由于各个域的属性不一样,如由地理因素产生的习惯偏差等。(2)域内模型不平衡:不同客户端所持数据量不同。具有较少数据量的客户端无法有效应对复杂的序列模型,且在中心服务器的聚合操作中容易产生模型偏移现象。因此,亟需研发一种新的基于隐私保护的序列推荐方法,以解决目前序列推荐方法中存在的这些问题。At present, the existing privacy-preserving sequential recommendation methods mainly protect data by introducing cryptographic knowledge, such as homomorphic encryption algorithms and differential privacy technologies. In the latest technical research, some researchers use federated learning to protect the privacy of sequential recommendation systems. Although the federated architecture can keep user data local, such distributed data and architecture reduce the effectiveness of the sequential recommendation model. Assuming that clients with certain attributes that can be classified into one category are called a domain, the above problems are specifically reflected in: (1) Inter-domain model imbalance: a single global model cannot adapt to the sequence characteristics of all domains. This may be due to the different attributes of each domain, such as habit bias caused by geographical factors. (2) Intra-domain model imbalance: different clients have different amounts of data. Clients with less data cannot effectively cope with complex sequence models, and are prone to model drift in the aggregation operation of the central server. Therefore, it is urgent to develop a new privacy-preserving sequential recommendation method to solve these problems existing in the current sequential recommendation method.
发明内容Summary of the invention
本发明的目的在于,提供一种基于个性化联邦技术的序列推荐方法。本发明可以解决由分布式数据和客户端所带来的域间模型不平衡和域内模型不平衡问题,能在隐私保护的前提下有效建模用户的动态偏好,具有可扩展性、可移植性和隐私保护性的优点。The purpose of the present invention is to provide a sequence recommendation method based on personalized federation technology. The present invention can solve the problems of inter-domain model imbalance and intra-domain model imbalance caused by distributed data and clients, can effectively model the dynamic preferences of users under the premise of privacy protection, and has the advantages of scalability, portability and privacy protection.
本发明的技术方案:一种基于个性化联邦技术的序列推荐方法,包括以下步骤:The technical solution of the present invention is a sequence recommendation method based on personalized federation technology, comprising the following steps:
步骤S1、各个客户端在本地设备上维护所持数据,对自身交互数据以及交互项的属性值进行预处理,以清除数据中的干预项和非正常值;同时,使得所有客户端的数据结构在分布式框架中得到对齐;Step S1: Each client maintains the data it holds on the local device, and pre-processes its own interaction data and the attribute values of the interaction items to remove the intervening items and abnormal values in the data; at the same time, the data structures of all clients are aligned in the distributed framework;
步骤S2、客户端在本地设备上通过自身交互数据构建哈希索引,并形成哈希存储表;在哈希索引构建完成后,客户端将其上传至中心服务器;Step S2: The client constructs a hash index on the local device through its own interactive data and forms a hash storage table; after the hash index is constructed, the client uploads it to the central server;
步骤S3、客户端在本地设备上基于贝叶斯训练策略对训练数据进行增强操作,得到增强数据,用于本地序列模型的自监督学习,以强化本地序列模型的表征能力;Step S3: The client performs an enhancement operation on the training data based on the Bayesian training strategy on the local device to obtain enhanced data for self-supervised learning of the local sequence model to enhance the representation ability of the local sequence model;
步骤S4、结合步骤S2构建的哈希索引与步骤S3得到的增强数据,客户端在本地设备上构建一个基于多任务的本地序列推荐框架(本地序列推荐框架可有效整合通用序列编码器以形成本地序列模型),并与中心服务器协同地对本地序列模型进行分布式训练,直到本地序列模型收敛;Step S4: Combining the hash index constructed in step S2 with the enhanced data obtained in step S3, the client constructs a multi-task-based local sequence recommendation framework on the local device (the local sequence recommendation framework can effectively integrate the general sequence encoder to form a local sequence model), and performs distributed training on the local sequence model in collaboration with the central server until the local sequence model converges;
首先,所述客户端对所述本地序列模型进行初始化和预训练;其次,将所述本地序列模型上传至中心服务器,进行基于局部敏感哈希的个性化聚合操作;接着,所述中心服务器对所述客户端发送特定的聚合模型,所述客户端接收聚合模型后,进行下一轮的模型训练任务,直到本地序列模型发送收敛;First, the client initializes and pre-trains the local sequence model; second, the local sequence model is uploaded to the central server to perform personalized aggregation operations based on local sensitive hashing; then, the central server sends a specific aggregation model to the client, and after the client receives the aggregation model, it performs the next round of model training tasks until the local sequence model is sent and converged;
步骤S5、客户端获取用户嵌入网络的参数,结合已收敛的本地序列模型的输出,获取下一时刻的偏好预测结果,完成对客户端的个性化推荐。Step S5: The client obtains the parameters of the user embedding network, combines the output of the converged local sequence model, obtains the preference prediction result at the next moment, and completes the personalized recommendation for the client.
预测结果只存在于客户端设备中,中心服务器不接触任何训练数据源以及推荐结果,且客户端之间不进行通信。The prediction results only exist in the client device. The central server does not access any training data source or recommendation results, and there is no communication between clients.
前述的一种基于个性化联邦技术的序列推荐方法中,所述步骤S1中的预处理总体方向是整理并记录客户端对所有项目的访问情况,并通过向量矩阵进行表示;In the aforementioned sequence recommendation method based on personalized federation technology, the overall direction of the preprocessing in step S1 is to organize and record the client's access to all items and represent them through a vector matrix;
预处理具体包括对交互数据进行异常值和缺失值的清理(保证数据的可用性)、对客户端已访问的项目进行项目属性归档(如项目种类)、对自身用户属性进行归档(如所处地区、年龄、职业、爱好等);并对项目属性和用户属性在所有客户端上进行数据结构对齐操作,通过向量矩阵表示已对齐的项目属性和用户属性。Preprocessing specifically includes cleaning up outliers and missing values in interactive data (to ensure data availability), archiving project attributes of projects that have been accessed by the client (such as project type), and archiving user attributes (such as region, age, occupation, hobbies, etc.); and aligning the data structures of project attributes and user attributes on all clients, representing the aligned project attributes and user attributes through vector matrices.
前述的一种基于个性化联邦技术的序列推荐方法中,所述步骤2包括以下子步骤:In the aforementioned sequence recommendation method based on personalized federation technology, step 2 includes the following sub-steps:
子步骤S2.1、客户端将历史交互数据转化为二值特征向量,从中心服务器下载有关哈希的数据,并根据从中心服务器下载的数据在本地设备构建一组哈希函数簇;Sub-step S2.1, the client converts the historical interaction data into a binary feature vector, downloads the relevant hash data from the central server, and constructs a set of hash function clusters on the local device according to the data downloaded from the central server;
子步骤S2.2、将所述二值特征向量与所述哈希函数簇进行结合,生成特定于所述客户端的哈希索引并上传至中心服务器;Sub-step S2.2, combining the binary feature vector with the hash function cluster to generate a hash index specific to the client and uploading it to a central server;
子步骤S2.3、中心服务器接收各个客户端的哈希索引以构建一张哈希存储表。Sub-step S2.3: The central server receives the hash index of each client to construct a hash storage table.
前述的一种基于个性化联邦技术的序列推荐方法中,所述步骤3包括以下子步骤:In the aforementioned sequence recommendation method based on personalized federation technology, step 3 includes the following sub-steps:
子步骤S3.1、构造子序列集以生成训练数据,每一个训练数据包含一条正样本和负样本序列对,所述训练数据用于贝叶斯模型优化;Sub-step S3.1, constructing a subsequence set to generate training data, each training data includes a positive sample and a negative sample sequence pair, and the training data is used for Bayesian model optimization;
子步骤S3.2、基于训练数据中的正样本构建增强正样本;Sub-step S3.2, constructing enhanced positive samples based on positive samples in the training data;
子步骤S3.3、基于训练数据中的负样本构建增强负样本;Sub-step S3.3, constructing enhanced negative samples based on negative samples in the training data;
子步骤S3.4、将增强正样本与增强负样本成对地组成增强数据,用于贝叶斯模型的自监督学习。Sub-step S3.4: Enhanced positive samples and enhanced negative samples are paired to form enhanced data for self-supervised learning of the Bayesian model.
前述的一种基于个性化联邦技术的序列推荐方法中,所述子步骤S3.2中根据项目之间的相关性以及正样本序列的长度来构建增强正样本,根据三角形以边计算面积的法则来确定项目之间的相关性程度。In the aforementioned sequence recommendation method based on personalized federated technology, in the sub-step S3.2, enhanced positive samples are constructed according to the correlation between items and the length of the positive sample sequence, and the degree of correlation between items is determined according to the rule of calculating the area of a triangle by its sides.
前述的一种基于个性化联邦技术的序列推荐方法中,所述子步骤S3.3中根据负样本序列的长度来构建增强负样本。In the aforementioned sequence recommendation method based on personalized federated technology, in the sub-step S3.3, enhanced negative samples are constructed according to the length of the negative sample sequence.
前述的一种基于个性化联邦技术的序列推荐方法中,所述步骤4包括以下子步骤:In the aforementioned sequence recommendation method based on personalized federation technology, step 4 includes the following sub-steps:
子步骤S4.1、构建基于多任务学习的序列推荐框架,序列推荐框架具有可扩展性和可移植性,所述序列推荐框架由用户属性嵌入网络、本地对比学习机制、项目嵌入网络和通用序列编码器构成,在所述通用序列编码器按需选择后,形成本地序列模型;Sub-step S4.1, constructing a sequence recommendation framework based on multi-task learning, the sequence recommendation framework is scalable and portable, the sequence recommendation framework is composed of a user attribute embedding network, a local contrast learning mechanism, an item embedding network and a universal sequence encoder, and after the universal sequence encoder is selected as needed, a local sequence model is formed;
子步骤S4.2、通过接收中心服务器的初始化参数来初始更新本地序列模型,使用训练数据以及增强数据对本地序列模型进行本地训练,并将训练结束的本地序列模型上传至中心服务器,以等待中心服务器的个性化聚合模型传输;Sub-step S4.2, initially updating the local sequence model by receiving initialization parameters from the central server, locally training the local sequence model using the training data and the enhanced data, and uploading the trained local sequence model to the central server to wait for the personalized aggregation model transmission from the central server;
子步骤S4.3、中心服务器接收来自所有客户端的本地序列模型,并通过查询全局哈希存储表以获取各个客户端的相似用户,再根据查询结果对所有本地序列模型进行个性化聚合,使得特定的客户端对应特定的聚合模型,将聚合模型发送至对应客户端;Sub-step S4.3, the central server receives local sequence models from all clients, and obtains similar users of each client by querying the global hash storage table, and then performs personalized aggregation on all local sequence models according to the query results, so that a specific client corresponds to a specific aggregation model, and sends the aggregation model to the corresponding client;
子步骤S4.4、客户端接收聚合模型,并继续用训练数据和增强数据对聚合模型进行下一轮的更新,直到本地序列模型收敛。Sub-step S4.4: The client receives the aggregate model and continues to update the aggregate model with the training data and enhanced data until the local sequence model converges.
前述的一种基于个性化联邦技术的序列推荐方法中,所述步骤5包括以下子步骤:In the aforementioned sequence recommendation method based on personalized federation technology, step 5 includes the following sub-steps:
子步骤S5.1、提取用户属性嵌入网络的参数,用以当作用户属性的特征表示,将其与本地序列模型的输出向量做内积操作;Sub-step S5.1, extracting the parameters of the user attribute embedding network, using them as the feature representation of the user attribute, and performing an inner product operation on the parameters and the output vector of the local sequence model;
子步骤S5.2、将内积结果作为推荐预测结果,用以预测用户下一时刻的偏好;预测结果只保留于客户端本地设备,不与中心服务器共享,目的是保护用户隐私;Sub-step S5.2: using the inner product result as a recommendation prediction result to predict the user's preference at the next moment; the prediction result is only retained in the client's local device and is not shared with the central server in order to protect user privacy;
子步骤S5.3、推荐系统在线实时维护全局哈希表;但当某个客户端退出联邦训练框架时,推荐系统将不再保留任何有关客户端的模型发送记录。Sub-step S5.3: The recommendation system maintains the global hash table online in real time; however, when a client exits the federated training framework, the recommendation system will no longer retain any model sending records related to the client.
与现有技术相比,本发明的有益效果体现在:本发明个性化联邦体现在用户与中心服务器协同训练序列编码器的过程中,中心服务器根据客户端的数据分布特点、模型训练情况、所处环境位置等生成特定模型,在不获取用户隐私数据的情况下,可有效地将常用序列编码器整合到联邦分布式框架中。因此,基于本发明的联邦序列推荐系统具有可扩展性、可移植性和隐私保护性。Compared with the prior art, the beneficial effects of the present invention are as follows: the personalized federation of the present invention is embodied in the process of collaborative training of sequence encoders by users and central servers. The central server generates a specific model based on the data distribution characteristics, model training conditions, and environmental location of the client, and can effectively integrate the commonly used sequence encoders into the federated distributed framework without obtaining user privacy data. Therefore, the federated sequence recommendation system based on the present invention has scalability, portability, and privacy protection.
具体地,本发明引入了局部敏感哈希,以此设计一种个性化的联邦聚合策略。该策略可缓解单一全局模型无法适应所有域的序列特征问题。另外,通过设计一种基于贝叶斯训练的数据增强方法来改进对比学习策略,进而加强本地序列编码器的表征能力。进而,具有少量训练数据的客户端也能有效应对复杂的序列模型,且在分布式场景下,可有效参与其他客户端的模型训练过程。因此,引入个性化和表征增强的联邦序列技术不仅能适应于常用编码器,使得通用序列模型能在隐私保护的前提下有效建模用户的动态偏好,还能在预测用户下一时刻的项目偏好时,不消耗大量计算资源,提升推荐性能。Specifically, the present invention introduces local sensitive hashing to design a personalized federated aggregation strategy. This strategy can alleviate the problem that a single global model cannot adapt to the sequence characteristics of all domains. In addition, a data enhancement method based on Bayesian training is designed to improve the contrastive learning strategy, thereby enhancing the representation ability of the local sequence encoder. Furthermore, clients with a small amount of training data can also effectively cope with complex sequence models, and in a distributed scenario, can effectively participate in the model training process of other clients. Therefore, the introduction of personalized and representation-enhanced federated sequence technology can not only adapt to commonly used encoders, so that the general sequence model can effectively model the user's dynamic preferences under the premise of privacy protection, but also when predicting the user's item preferences at the next moment, it does not consume a lot of computing resources, thereby improving the recommendation performance.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
图1是本发明提供的一种基于个性化联邦技术的序列推荐方法实施例的实现流程图;FIG1 is a flowchart of an implementation of a sequence recommendation method embodiment based on personalized federation technology provided by the present invention;
图2是本地多任务序列模型及其分布式训练的整体框架示意图;FIG2 is a schematic diagram of the overall framework of the local multi-task sequence model and its distributed training;
图3是本发明提供的一种基于个性化联邦技术的序列推荐方法中涉及到的数据增强方法样例图。FIG3 is a diagram showing an example of a data enhancement method involved in a sequence recommendation method based on personalized federated technology provided by the present invention.
具体实施方式DETAILED DESCRIPTION
下面结合附图和实施例对本发明作进一步的说明,但并不作为对本发明限制的依据。The present invention is further described below in conjunction with the accompanying drawings and embodiments, but they are not intended to limit the present invention.
实施例:在本发明中,客户端所进行的数据预处理操作,可根据特定场景需求来选择。比如,在POI推荐场景中,可选择对POI的距离属性进行预处理等。关于个性化联邦技术的整体框架如图2所示。该框架图展示了所有涉及方法的细节以及前后顺序关系。Embodiment: In the present invention, the data preprocessing operation performed by the client can be selected according to the requirements of a specific scenario. For example, in the POI recommendation scenario, the distance attribute of the POI can be preprocessed. The overall framework of the personalized federation technology is shown in FIG2. The framework diagram shows the details of all the methods involved and the order of precedence.
在本实施例中,一种基于个性化联邦技术的序列推荐方法,包括图1的步骤S1-S5:In this embodiment, a sequence recommendation method based on personalized federation technology includes steps S1-S5 of FIG1 :
步骤S1:各个客户端在本地设备上维护所持数据,对自身交互数据以及交互项的属性值进行预处理;Step S1: Each client maintains the data it holds on the local device and pre-processes its own interaction data and attribute values of the interaction items;
预处理包括对交互数据进行异常值和缺失值的清理、对客户端已访问的项目进行项目属性归档、对自身用户属性进行归档;并对项目属性和用户属性在所有客户端上进行数据结构对齐操作,通过向量矩阵表示已对齐的项目属性和用户属性。Preprocessing includes cleaning up outliers and missing values in the interaction data, archiving project attributes of projects that the client has accessed, and archiving the user attributes of the client itself; and aligning the data structures of project attributes and user attributes on all clients, and representing the aligned project attributes and user attributes through vector matrices.
步骤S2:客户端将历史交互数据转化为二值特征向量,并根据中心服务器的协助指令,构建一组哈希函数簇;结合二值特征向量和哈希函数族生成特定的哈希索引,同时将其上传至中心服务器以构建全局哈希存储表。整个步骤S2的实施,具体包含以下S2.1-S2.3子步骤:Step S2: The client converts the historical interaction data into a binary feature vector, and builds a set of hash function clusters according to the assistance instructions of the central server; combines the binary feature vector and the hash function family to generate a specific hash index, and uploads it to the central server to build a global hash storage table. The implementation of the entire step S2 specifically includes the following sub-steps S2.1-S2.3:
S2.1:假设存在n个项目,对于联邦学习中的单个用户u,其所有交互数据可表示为一个n维向量Ru=(v1,v2,…,vi,…,vn);vi代表用户u的交互情况;如果vi=0,代表用户u没有对项目i进行访问;反之,vi=1代表用户u访问过项目i。S2.1: Assume that there are n projects. For a single user u in federated learning, all its interaction data can be represented as an n-dimensional vector Ru = ( v1 , v2 , …, vi , …, vn ); vi represents the interaction of user u; if vi = 0, it means that user u has not visited project i; otherwise, vi = 1 means that user u has visited project i.
S2.2:客户端获取随机向量Q=(q1,q2,…qi,…,qn),其中qi∈[-1,1]中的随机数,哈希函数定义如下公式(1):S2.2: The client obtains a random vector Q = (q 1 ,q 2 ,… qi ,…,q n ), where qi ∈[-1,1] is a random number, and the hash function is defined as follows:
其中,符号表示向量之间的点乘操作。Among them, the symbol Represents the dot product operation between vectors.
基于公式(1),构建哈希索引为:Dexu=[G1,G2,..,Gi,…,GK],每个Gi由{g1(Ru),g2(Ru),…,gr(Ru)}组成,其中,Gi代表一个哈希桶所产生的哈希值,K个这样的哈希值即组成了哈希索引Dexu。Based on formula (1), the hash index is constructed as: Dex u = [G 1 , G 2 ,.., Gi ,…, G K ], where each Gi is composed of {g 1 (R u ), g 2 (R u ),…, g r (R u )}, where Gi represents the hash value generated by a hash bucket, and K such hash values constitute the hash index Dex u .
S2.3:将Dexu上传至中心服务器,并成为组建全局哈希存储表的一部分。S2.3: Upload Dex u to the central server and make it part of the global hash storage table.
步骤S3:客户端通过训练正、负样本对生成增强正、负样本对,训练数据用于贝叶斯模型优化,增强数据用于贝叶斯模型的自监督学习;在数据增强过程中,充分考虑项目之间的相关性以及训练样本的序列长度,其数据增强的示例如图3所示,该图中的训练样本长度l设定为5。整个步骤S3的实施,具体包含以下S3.1-S3.4子步骤:Step S3: The client generates enhanced positive and negative sample pairs by training positive and negative sample pairs. The training data is used for Bayesian model optimization, and the enhanced data is used for self-supervised learning of the Bayesian model. In the data enhancement process, the correlation between items and the sequence length of the training samples are fully considered. An example of data enhancement is shown in Figure 3, where the training sample length l is set to 5. The implementation of the entire step S3 specifically includes the following sub-steps S3.1-S3.4:
S3.1:客户端为实现BPR优化,构造子序列集以生成训练样本;如当l=5时,子序列[v1,v2,v3,v4,v5]与[v1,v2,v3,v4,v6]分别看作一对正、负序列,即训练样本,其中,v5和v6分别看作正标签与负标签。S3.1: To achieve BPR optimization, the client constructs a subsequence set to generate training samples; for example, when l=5, the subsequences [ v1 , v2 , v3 , v4 , v5 ] and [ v1 , v2 , v3 , v4 , v6 ] are regarded as a pair of positive and negative sequences, i.e., training samples, where v5 and v6 are regarded as positive labels and negative labels, respectively.
S3.2:增强正样本:以正样本Sp=[v1,v2,…,vi,…,vlp]为例,vlp代表正标签项;随机选取vi∈Sp,使用相关项替换vi,生成增强正样本其中,vi≠vlp,指代vi的相关项(关联项);vi和之间的关联程度由这两个兴趣点间的地理属性决定;具体地,本发明充分考虑了用户正样本Sp中vi的上一个访问序列vi-1和下一个访问序列vi+1,以此计算与vi的关联程度;首先,如公式(2)所示,基于vi选择一定地理范围内的POI集合。S3.2: Enhanced positive samples: Take the positive sample S p = [v 1 ,v 2 ,…, vi ,…,v lp ] as an example, where v lp represents the positive label item; randomly select vi ∈ S p and use the related item Replace vi to generate enhanced positive samples Among them, vi ≠v lp , Refers to the related items (associated items) of vi ; vi and The degree of association between them is determined by the geographical attributes between the two points of interest; specifically, the present invention fully considers the previous access sequence vi-1 and the next access sequence vi +1 of vi in the user positive sample S p , and calculates The degree of association with vi ; first, as shown in formula (2), a set of POIs within a certain geographical range is selected based on vi .
其中,α表示是一个常量,表示一个地理距离的阈值;dis()表示地理距离大小;则表示与vi相距在α范围内的所有POI组成的集合。Among them, α is a constant, indicating a threshold of geographical distance; dis() indicates the size of geographical distance; It represents the set of all POIs within the range of α from vi .
接着,基于以边长计算三角形面积的思想,我们按如下公式(3)-公式(7)计算出vi和的相关度:Next, based on the idea of calculating the area of a triangle by its side length, we calculate v i and Relevance:
a=dis(vi+1,vi-1) (3)a=dis(vi +1 ,vi -1 ) (3)
b1=dis(vi,vi-1),c1=dis(vi,vi+1) (4)b 1 =dis(v i ,v i-1 ), c 1 =dis(v i ,v i+1 ) (4)
其中,dis()代表距离,可以是余弦距离或实际物理空间距离;a表示vi+1与vi-1间的距离,b1表示vi与vi-1间的距离,c1表示vi和vi+1间的距离,b2表示与vi-1间的距离,c2表示与vi+1间的距离,p1和p2表示三段距离的平均长度,可看作vi和的相关度。Where dis() represents the distance, which can be the cosine distance or the actual physical space distance; a represents the distance between vi+1 and vi-1 , b1 represents the distance between vi and vi-1 , c1 represents the distance between vi and vi+1 , b2 represents The distance between v i-1 and c 2 represents The distance between and vi +1 , p1 and p2 represent the average length of the three distances, can be regarded as vi and 's relevance.
另外,在增强正样本的操作中,产生的替换项个数由序列长度l决定,具体计算如公式(8)所示。In addition, in the operation of enhancing the positive sample, the number of replacement items generated is determined by the sequence length l, and the specific calculation is shown in formula (8).
S3.3:增强负样本:以负样本Sn=[v1,v2,…,vi,…,vln]为例,vln代表负标签项;选取替换项vi(≠vln),随机挑选该用户未交互的兴趣点v′i作为替换值,产生序列Sn=[v1,v2,…,v′i,…,vln]。替换次数遵循公式(9)的计算法则:S3.3: Enhanced negative samples: Take the negative sample Sn = [ v1 , v2 , ..., v1 , ..., v1n ] as an example, where v1n represents a negative label item; select the replacement item v1 (≠ v1n ), randomly select the interest point v′i that the user has not interacted with as the replacement value, and generate the sequence Sn = [ v1 , v2 , ..., v′i , ..., v1n ]. The number of replacements follows the calculation rule of formula (9):
其中,frepos表示增强正样本中的替换个数,freneg表示增强负样本中的替换个数。Among them, fre pos represents the number of replacements in the enhanced positive samples, and fre neg represents the number of replacements in the enhanced negative samples.
S3.4:将增强正样本与增强负样本成对地组成增强数据,用于贝叶斯模型的自监督学习。S3.4: Enhanced positive samples and enhanced negative samples are paired to form enhanced data for self-supervised learning of the Bayesian model.
步骤S4:客户端构建一个基于多任务学习的序列推荐框架,序列推荐框架由用户属性嵌入网络、本地对比学习机制、项目嵌入网络、通用序列编码器来构成,在序列编码器按需选择后,形成本地序列模型;随后,中心服务器结合全局哈希表,联合客户端完成本地序列模型的个性化训练。整个步骤S4的实施,具体包含如下S4.1-S4.4子步骤:Step S4: The client builds a sequence recommendation framework based on multi-task learning. The sequence recommendation framework consists of a user attribute embedding network, a local contrast learning mechanism, an item embedding network, and a universal sequence encoder. After the sequence encoder is selected on demand, a local sequence model is formed; then, the central server combines the global hash table and the client to complete the personalized training of the local sequence model. The implementation of the entire step S4 specifically includes the following sub-steps S4.1-S4.4:
S4.1:客户端u通过神经嵌入网络将自身属性表示为一维向量Uu,客户端结合所需序列编码器构造一个本地多任务学习模型。多任务包括推荐任务和对比学习任务;对于推荐任务,给定用户u、序列编码器f(·)、兴趣点嵌入V、用户在时间戳t的序列Sequ,t、时间嵌入T、上下文特征I,可以得到序列编码器的隐藏层ht。ht可由如下公式(10)表示:S4.1: The client u represents its own attributes as a one-dimensional vector U u through a neural embedding network. The client constructs a local multi-task learning model in combination with the required sequence encoder. The multi-task includes recommendation tasks and contrastive learning tasks. For the recommendation task, given the user u, the sequence encoder f(·), the interest point embedding V, the user's sequence Seq u,t at timestamp t, the time embedding T, and the context feature I, the hidden layer h t of the sequence encoder can be obtained. h t can be expressed by the following formula (10):
ht=f(V,T,I,Sequ,t;θs) (10)h t =f(V,T,I,Seq u,t ; θ s ) (10)
其中,θs代表编码器的参数集合。Among them, θs represents the parameter set of the encoder.
根据用户嵌入表示Uu,评估用户u在时间戳t时对项目j的偏好程度如下公式(11)所示:According to the user embedding representation U u , evaluate the preference of user u for item j at timestamp t As shown in the following formula (11):
接着,应用成对贝叶斯个性化排序(BPR)去学习序列编码器和嵌入网络的参数θr,推荐任务的损失函数如下公式(12):Next, we apply pairwise Bayesian personalized ranking (BPR) to learn the parameters θ r of the sequence encoder and embedding network, and the loss function of the recommendation task The following formula (12):
其中,σ(·)代表sigmod()函数,(j,k)是训练子序列中的一对正、负标签。Here, σ(·) represents the sigmoid() function, and (j, k) is a pair of positive and negative labels in the training subsequence.
S4.2:对于对比学习任务,将增强样本表示公式(13)和公式(14):S4.2: For contrastive learning tasks, the enhanced sample representation formula (13) and formula (14) are:
其中,Seqaug-p指增强正样本,Seqaug-n指增强负样本;被看作一对正样本对,其余的2N条被视为它的负例;序列对被编码后的特征为其对应的负例被编码后的特征为h′i。采用多分类交叉熵损失函数(NCE)学习来对比任务,如下公式(15)所示:Among them, Seq aug-p refers to the enhanced positive samples, and Seq aug-n refers to the enhanced negative samples; is considered as a pair of positive samples, and the remaining 2N is considered as its negative example; the sequence pair The encoded features are Its corresponding negative example The encoded feature is h′ i . The multi-classification cross entropy loss function (NCE) is used to learn the comparison task, as shown in the following formula (15):
其中,τ为温度系数,通过调参实验后取一个最优常数值;是序列对的编码特征,是序列对的编码特征;符合sim()表示求相似度;表示对比任务的损失函数。Among them, τ is the temperature coefficient, and an optimal constant value is obtained after parameter adjustment experiments; is a sequence pair The encoding features of is a sequence pair The encoding features of ; sim() means to find the similarity; Represents the loss function of the comparison task.
进一步地,将推荐任务和对比学习任务进行结合,得到最终的多任务序列模型。多任务序列模型的优化损失表示如下公式(16):Furthermore, the recommendation task and the contrastive learning task are combined to obtain the final multi-task sequence model. The optimization loss of the multi-task sequence model is expressed as follows (16):
其中,λ是一个常数系数,用以控制对比任务的占比,是推荐任务的损失函数,是对比任务的损失函数,是最终的多任务损失函数,客户端按上述操作进行本地模型训练。Among them, λ is a constant coefficient used to control the proportion of contrast tasks. is the loss function for the recommendation task, is the loss function of the comparison task, is the final multi-task loss function. The client performs local model training according to the above operations.
S4.3:客户端u将本地模型Θu={Wu}上传至中心服务器,Wu表示Θu的参数,中心服务器查询全局哈希存储表,寻找与u在同一个哈希桶的其他用户其定义为接着,中心服务器对u生成特定的个性化模型,表示如下公式(17):S4.3: Client u uploads the local model Θ u = {W u } to the central server, where W u represents the parameters of Θ u . The central server queries the global hash storage table to find other users in the same hash bucket as u. It is defined as Next, the central server generates a specific personalized model for u, expressed as the following formula (17):
其中,Avg(·)指求平均操作,α是常数,用以控制相似用户和非相似用户对用户u的本地模型的影响程度,Wu指用户u的相似用户的本地模型,Wz指用户u的不相似用户的本地模型,ln指与用户u的相似用户个数,指为用户u生成的个性化本地模型。Where Avg(·) refers to the averaging operation, α is a constant used to control the influence of similar and dissimilar users on the local model of user u, Wu refers to the local model of similar users of user u, Wz refers to the local model of dissimilar users of user u, ln refers to the number of users similar to user u, refers to the personalized local model generated for user u.
S4.4:中心服务器将特定发送给u,u对进行新一轮训练并重复上述过程,直到模型收敛。S4.4: The central server will specify Send to u, u A new round of training is performed and the above process is repeated until the model converges.
步骤S5:根据Uu和序列模型输出ht,获取下一时刻的偏好预测。Step S5: Obtain the preference prediction for the next moment based on U u and the sequence model output h t .
整个步骤S5的实施,具体包含S5.1-S5.3子步骤:The implementation of the entire step S5 specifically includes sub-steps S5.1-S5.3:
S5.1:对已训练完成的Uu和ht做内积操作。S5.1: Perform inner product operation on the trained U u and h t .
S5.2:根据内积结果预测下一时刻的用户偏好,所有推荐结果只保留于客户端本地设备,不与中心服务器共享。S5.2: Predict the user preference at the next moment based on the inner product results. All recommendation results are only retained on the client's local device and are not shared with the central server.
S5.3:推荐系统在线实时维护全局哈希存储表,当某个客户端退出训练时,系统将不再保留任何有关该客户端的数据记录。S5.3: The recommendation system maintains a global hash storage table online in real time. When a client exits training, the system will no longer retain any data records about the client.
以上仅是本发明的优选实施方式,本发明的保护范围并不仅仅局限于上述实施例,凡属于本发明思路下的技术方案均属于本发明的保护范围。应当指出,对于本技术领域的普通技术人员来说,在不脱离本发明思想前提下的若干改进和润饰,这些改进和润饰也应视为本发明的保护范围。The above are only preferred embodiments of the present invention. The protection scope of the present invention is not limited to the above embodiments. All technical solutions under the concept of the present invention belong to the protection scope of the present invention. It should be pointed out that for ordinary technicians in this technical field, some improvements and modifications without departing from the concept of the present invention should also be regarded as the protection scope of the present invention.
Claims (8)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310023696.9A CN116089715A (en) | 2023-01-09 | 2023-01-09 | Sequence recommendation method based on personalized federal technology |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310023696.9A CN116089715A (en) | 2023-01-09 | 2023-01-09 | Sequence recommendation method based on personalized federal technology |
Publications (1)
Publication Number | Publication Date |
---|---|
CN116089715A true CN116089715A (en) | 2023-05-09 |
Family
ID=86213415
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202310023696.9A Pending CN116089715A (en) | 2023-01-09 | 2023-01-09 | Sequence recommendation method based on personalized federal technology |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN116089715A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116361561A (en) * | 2023-05-30 | 2023-06-30 | 安徽省模式识别信息技术有限公司 | Distributed cross-border service recommendation method and system based on variational reasoning |
CN117494191A (en) * | 2023-10-17 | 2024-02-02 | 南昌大学 | Point-of-interest micro-service system and method for information physical security |
-
2023
- 2023-01-09 CN CN202310023696.9A patent/CN116089715A/en active Pending
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116361561A (en) * | 2023-05-30 | 2023-06-30 | 安徽省模式识别信息技术有限公司 | Distributed cross-border service recommendation method and system based on variational reasoning |
CN117494191A (en) * | 2023-10-17 | 2024-02-02 | 南昌大学 | Point-of-interest micro-service system and method for information physical security |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Lu et al. | Fedclip: Fast generalization and personalization for clip in federated learning | |
CN112836130B (en) | Context-aware recommendation system and method based on federated learning | |
Zhong et al. | Comsoc: adaptive transfer of user behaviors over composite social network | |
Li et al. | Exploiting explicit and implicit feedback for personalized ranking | |
Qin et al. | Privacy-preserving federated learning framework in multimedia courses recommendation | |
CN108446964B (en) | User recommendation method based on mobile traffic DPI data | |
CN116089715A (en) | Sequence recommendation method based on personalized federal technology | |
Wei et al. | Strategy-aware bundle recommender system | |
US10733243B2 (en) | Next generation similar profiles | |
Yang et al. | Bi-directional joint inference for user links and attributes on large social graphs | |
Yan et al. | On-device learning for model personalization with large-scale cloud-coordinated domain adaption | |
US20240054391A1 (en) | Privacy-enhanced training and deployment of machine learning models using client-side and server-side data | |
Zhang et al. | A survey on incremental update for neural recommender systems | |
Lang et al. | POI recommendation based on a multiple bipartite graph network model | |
Yang et al. | Attention mechanism and adaptive convolution actuated fusion network for next POI recommendation | |
Liao et al. | A scalable approach for content based image retrieval in cloud datacenter | |
Yu et al. | Neural personalized ranking via Poisson factor model for item recommendation | |
Sarkar et al. | Progressive search personalization and privacy protection using federated learning | |
CN116432039B (en) | Collaborative training method and device, business prediction method and device | |
Zuo et al. | Mixed contrastive transfer learning for few-shot workload prediction in the cloud | |
Liu et al. | Ftmoe: a federated transfer model based on mixture-of-experts for heterogeneous image classification | |
Yuan et al. | Optimizing factorization machines for top-n context-aware recommendations | |
JP2023182380A (en) | Machine learning methods, information processing systems, information processing devices, servers and programs | |
CN115391638A (en) | Recommendation model training method and device based on social network | |
Yan et al. | Personalized POI recommendation based on subway network features and users’ historical behaviors |
Legal Events
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 |