Training method, information recommendation method, device and equipment for vertical federation model
By performing sample alignment and filtering processing of streaming data within a preset time period, the problem of long training time and low accuracy of longitudinal federated models is solved, and efficient training and accurate prediction of the model are achieved.
Patent Information
- Application Number
- CN202111286816.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-02
- Publication Date
- 2025-08-22
- Estimated Expiration
- 2041-11-02
AI Technical Summary
In the prior art, the training time of the longitudinal federated model is long and cannot be trained based on the streaming data generated in real time, resulting in low model accuracy and inaccurate prediction results.
By acquiring streaming data, a first streaming data sample of the longitudinal federal model is generated, and aligned with the second electronic device according to the preset time period. After the filtering process, the vertical federal model is trained multiple rounds using multiple target streaming data samples to generate the trained model.
Improve the accuracy of the longitudinal federated model and the accuracy of the prediction results, reduce training time, and enhance the reliability of streaming data samples.
Smart Images

Figure CN114004366B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of machine learning technology, and in particular to a training method, information recommendation method, device and equipment for a vertical federated model. Background Art
[0002] The Federated Learning framework is a distributed AI model training framework. Without sharing user data, federated learning enables companies to jointly participate in model training, effectively resolving data silos and ensuring data security. Trained models can be used to predict user behavior, thereby providing better services. Therefore, how to train the model is crucial.
[0003] For example, let's consider two companies participating in model training. The two companies are the caller and the participant, respectively. The caller's samples contain sample features and sample labels, while the participant's samples have different sample features from the caller. The caller and participant first identify their common users using encrypted user sample alignment technology and obtain local samples corresponding to these users. The caller and participant then train their local models based on these local samples, updating the model parameters until the loss function converges, resulting in a trained model.
[0004] In the process of implementing the present invention, the inventors found that there are at least the following problems in the prior art: since the prior art uses local samples that are pre-collected and stored locally to train the model, when the number of local samples is large, the training time is long, and the model cannot be trained based on real-time streaming data. The accuracy of the model is low, and the prediction results obtained by the model are inaccurate. Summary of the Invention
[0005] The present application provides a training method, information recommendation method, device and equipment for a vertical federated model to solve the problem that the existing technology uses local samples collected and stored locally in advance to train the model. When the number of local samples is large, the training time is long, and the model cannot be trained based on real-time streaming data. The model accuracy is low and the prediction results obtained by the model are inaccurate.
[0006] In a first aspect, an embodiment of the present application provides a method for training a vertical federation model. The method for training a vertical federation model is applied to a first electronic device, and the method includes:
[0007] In response to a user operation, acquiring streaming data generated by the operation;
[0008] Processing the streaming data to generate a first streaming data sample of a longitudinal federated model, wherein the first streaming data sample includes a sample label, a sample time, at least one sample feature, and a user identifier;
[0009] performing sample alignment processing on the plurality of first streaming data samples according to the preset time period and the user identifiers of the plurality of second streaming data samples in the second electronic device, and performing filtering processing on the plurality of aligned first streaming data samples to obtain a plurality of target streaming data samples;
[0010] The longitudinal federation model is trained multiple times using the multiple target streaming data samples to obtain a trained longitudinal federation model, which is used to obtain a prediction result or classification result of the user based on the user's feature information.
[0011] In a possible design of the first aspect, after generating the first streaming data sample of the federated model, the method further includes:
[0012] Using a hash algorithm, the user identifiers of the first streaming data sample are stored in a plurality of pre-established partitions;
[0013] Accordingly, performing sample alignment processing on the plurality of first streaming data samples according to the preset time period and the user identifiers of the plurality of second streaming data samples in the second electronic device includes:
[0014] Acquire a plurality of first user identifiers in each partition whose sample time is within the preset time period;
[0015] receiving a plurality of second user identifiers in each partition sent by the second electronic device;
[0016] For each partition, performing sample alignment processing on the multiple first user identifiers in the partition and the multiple second user identifiers obtained for the partition corresponding to the second electronic device to obtain multiple target user identifiers;
[0017] According to the multiple target user identifiers, multiple aligned first streaming data samples are obtained.
[0018] In another possible design of the first aspect, the filtering process includes at least one of an outlier detection process, a missing value detection process, and a normalization process.
[0019] Optionally, before performing multiple rounds of training on the longitudinal federation model using multiple target streaming data samples, the method further includes:
[0020] The initial federation model is trained using local data samples stored in the longitudinal federation model training database to obtain the longitudinal federation model.
[0021] Optionally, obtaining a plurality of first user identifiers whose sample times in each partition are within the preset time period includes:
[0022] Encryption processing is performed on multiple user identifiers whose sample times are within the preset time period to obtain multiple first user identifiers.
[0023] In a second aspect, an embodiment of the present application provides an information recommendation method, comprising:
[0024] Obtain user feature information;
[0025] Inputting the user's feature information into a pre-acquired trained longitudinal federation model to obtain a prediction result or classification result for the user, wherein the trained longitudinal federation model is obtained by training the longitudinal federation model multiple times based on multiple streaming data acquired in response to operations of multiple users, a preset time period, and user identifiers of multiple second streaming data samples;
[0026] Recommend information to the user based on the prediction result or the classification result.
[0027] In a possible design of the second aspect, obtaining characteristic information of the user includes:
[0028] According to the user identifier of the user, characteristic information of the user is obtained from a user information database.
[0029] In a third aspect, an embodiment of the present application provides a training device for a vertical federation model, wherein the training device for the vertical federation model is applied to a first electronic device, and the device includes:
[0030] An acquisition module, configured to acquire streaming data generated by a user operation in response to the user operation;
[0031] a processing module, configured to process the streaming data to generate a first streaming data sample of a longitudinal federated model, wherein the first streaming data sample includes a sample label, a sample time, at least one sample feature, and a user identifier;
[0032] The processing module is further configured to perform sample alignment processing on the plurality of first streaming data samples according to a preset time period and user identifiers of the plurality of second streaming data samples in the second electronic device, and perform filtering processing on the plurality of aligned first streaming data samples to obtain a plurality of target streaming data samples;
[0033] The processing module is further used to perform multiple rounds of training on the longitudinal federation model using the multiple target streaming data samples to obtain a trained longitudinal federation model, and the longitudinal federation model is used to obtain the prediction result or classification result of the user based on the user's feature information.
[0034] In a possible design of the third aspect, after generating the first streaming data sample of the federated model, the processing module is further configured to:
[0035] Using a hash algorithm, the user identifiers of the first streaming data sample are stored in a plurality of pre-established partitions;
[0036] Accordingly, the processing module is specifically configured to:
[0037] Acquire a plurality of first user identifiers in each partition whose sample time is within the preset time period;
[0038] receiving a plurality of second user identifiers in each partition sent by the second electronic device;
[0039] For each partition, performing sample alignment processing on the multiple first user identifiers in the partition and the multiple second user identifiers obtained for the partition corresponding to the second electronic device to obtain multiple target user identifiers;
[0040] According to the multiple target user identifiers, multiple aligned first streaming data samples are obtained.
[0041] In another possible design of the third aspect, the filtering process includes at least one of an outlier detection process, a missing value detection process, and a normalization process.
[0042] Optionally, before performing multiple rounds of training on the longitudinal federation model using multiple target streaming data samples, the processing module is further configured to:
[0043] The initial federation model is trained using local data samples stored in the longitudinal federation model training database to obtain the longitudinal federation model.
[0044] Optionally, the acquisition module is specifically configured to:
[0045] Encryption processing is performed on multiple user identifiers whose sample times are within the preset time period to obtain multiple first user identifiers.
[0046] In a fourth aspect, an embodiment of the present application provides an information recommendation device, including:
[0047] Acquisition module, used to obtain user feature information;
[0048] a processing module, configured to input the user's feature information into a pre-acquired trained longitudinal federation model to obtain a prediction result or classification result for the user, wherein the trained longitudinal federation model is obtained by performing multiple rounds of training on the longitudinal federation model based on multiple streaming data acquired in response to operations of multiple users, a preset time period, and user identifiers of multiple second streaming data samples;
[0049] The processing module is further configured to recommend information to the user based on the prediction result or the classification result.
[0050] In a possible design of the fourth aspect, the acquisition module is specifically configured to:
[0051] According to the user identifier of the user, characteristic information of the user is obtained from a user information database.
[0052] In a fifth aspect, an embodiment of the present application provides an electronic device comprising: a processor, a memory, and computer program instructions stored in the memory and executable on the processor, wherein the processor executes the computer program instructions to implement the first aspect and the methods provided by various possible designs.
[0053] In the sixth aspect, an embodiment of the present application provides an electronic device, comprising: a processor, a memory, and computer program instructions stored in the memory and executable on the processor, wherein the processor executes the computer program instructions to implement the second aspect and the methods provided by each possible design.
[0054] In the seventh aspect, an embodiment of the present application may provide a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement the first aspect and the methods provided by various possible designs.
[0055] In an eighth aspect, an embodiment of the present application may provide a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, they are used to implement the second aspect and the methods provided by each possible design.
[0056] In a ninth aspect, an embodiment of the present application provides a computer program product, comprising a computer program, which, when executed by a processor, is used to implement the first aspect and the methods provided by various possible designs.
[0057] In a tenth aspect, an embodiment of the present application provides a computer program product, including a computer program, which, when executed by a processor, is used to implement the second aspect and the methods provided by each possible design.
[0058] The embodiments of the present application provide a training method, information recommendation method, apparatus, and device for a vertical federation model. The training method for the vertical federation model includes: obtaining streaming data generated by the operation in response to a user operation, processing the streaming data to generate a first streaming data sample of the vertical federation model, performing sample alignment processing on the multiple first streaming data samples based on a preset time period and user identifiers of multiple second streaming data samples in a second electronic device, filtering the multiple aligned first streaming data samples, obtaining multiple target streaming data samples, and performing multiple rounds of training on the vertical federation model using the multiple target streaming data samples to obtain a trained vertical federation model. The first electronic device generates streaming data samples in response to the user's real-time operation and aligns the first streaming data samples based on the preset time period, thereby avoiding the problems of missing streaming data samples and inconsistent streaming data sample order caused by different streaming data download times between the first electronic device and the second electronic device. The vertical federation model can be continuously trained based on the multiple target streaming data samples, thereby improving the accuracy of the vertical federation model and the accuracy of the prediction results or classification results obtained by the vertical federation model, reducing training time, and improving the reliability of streaming data sample storage. BRIEF DESCRIPTION OF THE DRAWINGS
[0059] In order to more clearly illustrate the technical solutions in the present application or the prior art, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0060] Figure 1 A schematic diagram of an application scenario of the training method of the vertical federation model provided in an embodiment of the present application;
[0061] Figure 2 A flowchart of a first embodiment of a method for training a vertical federated model provided in an embodiment of the present application;
[0062] Figure 3 A flowchart of a second embodiment of a method for training a vertical federated model provided in an embodiment of the present application;
[0063] Figure 4 A flowchart of a third embodiment of a training method for a vertical federation model provided in an embodiment of the present application;
[0064] Figure 5 A flowchart of a fourth embodiment of a method for training a vertical federated model provided in an embodiment of the present application;
[0065] Figure 6A flowchart of a fifth embodiment of a training method for a vertical federated model provided in an embodiment of the present application;
[0066] Figure 7 A flowchart of Example 6 of the training method for a vertical federated model provided in an embodiment of the present application;
[0067] Figure 8 A flowchart of Example 1 of the information recommendation method provided in the embodiments of the present application;
[0068] Figure 9 A schematic diagram of the structure of a training device for a vertical federation model provided in an embodiment of the present application;
[0069] Figure 10 A schematic diagram of the structure of the information recommendation device provided in an embodiment of the present application;
[0070] Figure 11 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application.
[0071] The above drawings illustrate specific embodiments of the present disclosure, which will be described in more detail below. These drawings and textual descriptions are not intended to limit the scope of the present disclosure in any way, but rather to illustrate the concepts of the present disclosure to those skilled in the art by reference to specific embodiments. DETAILED DESCRIPTION
[0072] To make the purpose, technical solutions, and advantages of the embodiments of this application more clear, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0073] The terms "first," "second," "third," "fourth," and so forth (if any) in the description and claims of the present invention and the accompanying drawings are used to distinguish similar objects and are not necessarily used to describe a particular order or sequential sequence. It should be understood that the terms used in this manner are interchangeable where appropriate, such that the embodiments of the present invention described herein can be practiced in sequences other than those illustrated or described herein.
[0074] In addition, the terms "comprises" and "having" and any variations thereof are intended to cover a non-exclusive inclusion. For example, a process, method, system, product or apparatus that includes a series of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, product or apparatus.
[0075] Before introducing the embodiments of the present application, the application background of the embodiments of the present application is first explained:
[0076] With the introduction of the General Data Protection Regulation (GDPR), companies are increasingly tightening their management of user data privacy and security. Without user approval, companies cannot exchange user data, leading to data silos. The Federated Learning framework is a distributed AI model training framework that enables multiple companies to participate in model training without sharing user data with other companies. This provides a viable approach to addressing data security and data silos, and is a mutually beneficial approach to machine learning.
[0077] Federated learning can be categorized into vertical federated learning, horizontal federated learning, and transfer federated learning. In vertical federated learning, companies share many common users, but the overlap in sample features is low. For example, consider two companies (a bank and an e-commerce company) that offer different services to clients. While their customer bases overlap significantly, they possess data on different aspects of their clients, meaning their sample features have little overlap. Vertical federated learning aggregates different sample features in an encrypted state, resolving the issue of too few or missing features during model training. Using trained models, users' operational behaviors can be predicted, providing better services. Therefore, model training is crucial.
[0078] Before training the model, since the user groups between companies do not completely overlap, samples from different companies need to be aligned. For example, two companies participate in model training. The two companies are the caller and the participant. The caller's sample has sample features and sample labels, while the participant's sample has sample features different from the caller's. The caller and the participant each use encrypted user sample alignment technology (such as RSA encryption algorithm, privacy-preserving set intersection (PSI) technology, etc.) to confirm the common users of both parties without disclosing their respective user data. They then obtain local samples corresponding to the common users, ensuring that the local samples are in the same order and that non-overlapping users are not exposed. After obtaining their respective local samples corresponding to the common users, the caller and the participant each train their local models based on the local samples and update the model parameters until the loss function converges, thereby obtaining a trained model.
[0079] However, the existing technology uses local samples collected and stored in advance to train the model. When the number of local samples is large, the training time is long. It is impossible to train the model based on the streaming data generated in real time by the online traffic shared by both parties. The model accuracy is low, resulting in inaccurate prediction results obtained by the model.
[0080] In response to the above problems, the invention of this application is as follows: During the model training process, since the streaming data may be dropped at different times in different companies, if the streaming data is aligned directly after being dropped in one company, there may be problems with missing samples and inconsistent sample order, making it impossible to align the samples. Based on this, the inventors discovered that if a preset time period can be set in advance based on the time difference between the streaming data being dropped in different companies, and the samples are aligned according to the preset time period, the problems of missing samples and inconsistent sample order in the prior art can be solved, thereby improving the accuracy of the model and the accuracy of the prediction results obtained by the model, and also reducing the model training time.
[0081] For example, the training method of the vertical federation model provided in the embodiment of the present application can be applied to Figure 1 In the schematic diagram of an application scenario shown in FIG. Figure 1 A schematic diagram of an application scenario of the training method of the vertical federation model provided in the embodiment of the present application is used to solve the above technical problems. Figure 1 As shown, the application scenario may include: at least two terminal devices (such as Figure 1 The terminal devices 11 and 12 in the embodiment and the data storage devices connected to the terminal devices (such as Figure 1 Each terminal device corresponds to a company, for example, terminal device 11 corresponds to company A, and terminal device 12 corresponds to company B. Company A and company B may be companies that provide different services to users.
[0082] For example, in Figure 1 In the application scenario shown, the terminal device 11 can generate a first streaming data sample in response to a user operation and store it in the data storage device 21 so that it can be directly used in subsequent training of the vertical federation model.
[0083] The terminal device 11 may also receive the user identifier of the second streaming data sample sent by the terminal device 12 , and process the first streaming data sample stored in the data storage device 21 to obtain a target streaming data sample.
[0084] The data storage device 21 can store a large number of first streaming data samples, user identifiers of second streaming data samples, target streaming data samples, and a vertical federation model. The terminal device 11 executes the program code for the vertical federation model training method based on the target streaming data samples and the vertical federation model, obtains the trained vertical federation model, and stores it in the data storage device 21 for subsequent direct use.
[0085] It should be noted that the attached Figure 1 This is only a schematic diagram of an application scenario provided by the embodiment of the present application. Figure 1 The equipment included in the Figure 1 The positional relationship between the devices in the Figure 1 In the embodiment, the data storage device 21 can be an external memory relative to the terminal device 11. In other cases, the data storage device 21 can also be placed in the terminal device 11.
[0086] In actual applications, since the server is also a processing device with data processing capabilities, the above Figure 1 The terminal device in the application scenario shown can also be implemented by a server. In the embodiment of the present application, the server and the terminal device can be collectively referred to as electronic devices.
[0087] The technical solution of the present application is described in detail below through specific embodiments.
[0088] It should be noted that the following specific embodiments may be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.
[0089] Figure 2 This is a flow chart of the first embodiment of the training method of the vertical federation model provided in the embodiment of the present application. Figure 2 As shown, the training method of the vertical federation model is applied to the first electronic device and may include the following steps:
[0090] S101: In response to a user operation, acquiring streaming data generated by the operation.
[0091] In this step, the first electronic device needs to install an application or a browser, so as to respond to the user's operation on the application or the browser and provide the user with corresponding services. The first electronic device can also generate corresponding streaming data according to the user's operation.
[0092] For example, the delivery scenario is used as an example for explanation. In this example, the executor of the training method of the vertical federated model is server one. Application one and application two can be installed in the user's terminal device, and instructions can be sent to server one and server two through application one and application two respectively, so as to obtain the services provided by company one and company two to the user. After company one and company two reach a cooperation, company one can deliver the product link to application two. When the user clicks on the product link in application two, the terminal device can automatically jump to application one for the user and present the user with the interface corresponding to the product link. After obtaining the user's operation (such as browsing operation, ordering operation, playback operation, etc.), server one generates streaming data according to the operation.
[0093] Optionally, the streaming data includes a user identifier.
[0094] S102: Process the streaming data to generate a first streaming data sample of the vertical federation model.
[0095] In this step, after acquiring the streaming data, the first electronic device may process the streaming data to generate a first streaming data sample, so that the vertical federation model can be trained based on the first streaming data.
[0096] The first electronic device may extract at least one sample feature from the streaming data, and generate a sample label based on the operation data (such as order operation data, browsing operation data, playback operation data, etc.) in the streaming data.
[0097] Furthermore, the first electronic device may generate first streaming data according to the acquired at least one sample feature and the sample label, and determine the time when the first streaming data is generated as the sample time.
[0098] Optionally, the first streaming data sample includes a sample label, a sample time, at least one sample feature and a user identifier.
[0099] Optionally, the first electronic device may store the user identifier of the first streaming data sample in a memory, or in a data storage device or disk, which is not specifically limited in this embodiment of the present application.
[0100] S103: Perform sample alignment processing on the plurality of first streaming data samples according to the preset time period and the user identifiers of the plurality of second streaming data samples in the second electronic device, and perform filtering processing on the plurality of aligned first streaming data samples to obtain a plurality of target streaming data samples.
[0101] In this step, after obtaining the plurality of first streaming data samples, the first electronic device may process the plurality of first streaming data samples, thereby obtaining target streaming data samples that can be used to train the vertical federation model.
[0102] Optionally, the first electronic device can pre-acquire user identifiers of multiple second streaming data samples in the second electronic device. Further, the user identifiers of multiple second streaming data samples can be stored in a data storage device, in the memory of the first electronic device, or on a disk. This embodiment of the present application does not limit this.
[0103] Optionally, the first electronic device may further pre-set a preset time period according to a time difference between the first electronic device and the second electronic device in which the streaming data is stored on the disk, such as from XXXX-YY-ZZ to AAAA-BB-CC.
[0104] The preset time period can be achieved through a time window.
[0105] Exemplarily, the first electronic device may further pre-set a preset duration and obtain a preset time period based on the current time. The preset duration may be 1 day, 2 days, 3 days, etc. For example, if the preset duration is 1 day and the current time is XXXX-YY-MM-DD, the first electronic device may use the current time as the start time and the preset duration as the duration to obtain the preset time period (from XXXX-YY-MM-ZZ to XXXX-YY-MM-ZZ+1); or may use the current time as the start time and the sum of two preset durations as the total duration to obtain the preset time period (from XXXX-YY-MM-ZZ to XXXX-YY-MM-ZZ+2); or may use the current time as the start time and the sum of n preset durations as the total duration to obtain the preset time period (from XXXX-YY-MM-ZZ to XXXX-YY-MM-ZZ+n day). The setting may be based on actual conditions and is not specifically limited in the embodiments of the present application.
[0106] In a specific embodiment, the first electronic device can obtain user identifiers of multiple first streaming data samples whose sample times are within a preset time period, and multiple user identifiers of second streaming data samples in a second electronic device whose sample times are within a preset time period from a memory, a data storage device or a disk, and perform sample alignment processing on the user identifiers of the multiple first streaming data samples and the user identifiers of the multiple second streaming data samples, and use the first streaming data sample with the same user identifier as the second streaming data sample as the first streaming data sample after alignment processing.
[0107] In this embodiment, it is also necessary to perform filtering processing on the first streaming data sample after the alignment processing, and the filtering processing includes at least one of outlier detection processing, missing value detection processing and normalization processing.
[0108] Optionally, the filtering process may also include regularization processing, dimensionality reduction processing, desensitization processing, etc., which can be set according to actual conditions. The embodiments of the present application do not impose specific restrictions on this.
[0109] S104: Perform multiple rounds of training on the longitudinal federation model using multiple target streaming data samples to obtain a trained longitudinal federation model.
[0110] In this step, after the first electronic device obtains multiple target streaming data samples, it can perform multiple rounds of training on the vertical federation model according to a preset training algorithm and number of iterations.
[0111] Among them, the vertical federation model is used to obtain the user's prediction results or classification results based on the user's feature information.
[0112] For example, taking an e-commerce company as an example, the prediction result may be that the user is interested in product A, that the user will shop at night, or that the price of the product purchased by the user is relatively high; the classification result may be that the user is a high-spending group, a high-credit group, a high-quality user group, etc., so that information can be recommended to the user based on the prediction result or classification result.
[0113] The training method of a longitudinal federation model provided in an embodiment of the present application obtains streaming data generated by the operation in response to a user operation, processes the streaming data, generates a first streaming data sample of the longitudinal federation model, performs sample alignment processing on the multiple first streaming data samples according to a preset time period and the user identifier of the multiple second streaming data samples in the second electronic device, filters the multiple aligned first streaming data samples, obtains multiple target streaming data samples, and uses the multiple target streaming data samples to perform multiple rounds of training on the longitudinal federation model to obtain a trained longitudinal federation model. The first electronic device generates streaming data samples in response to the user's real-time operation, and aligns the first streaming data samples within the preset time period, thereby avoiding the problems of missing streaming data samples and inconsistent streaming data sample order caused by different streaming data download times between the first electronic device and the second electronic device. The longitudinal federation model can be continuously trained based on the target streaming data samples, thereby improving the accuracy of the longitudinal federation model and the accuracy of the prediction results or classification results obtained by the longitudinal federation model, reducing training time, and improving the reliability of streaming data sample storage.
[0114] Based on any of the above embodiments, Figure 3 This is a flow chart of the second embodiment of the training method of the vertical federation model provided in the embodiment of this application. Figure 3 As shown, the first electronic device may further use a hash algorithm to store the user identifiers of the first streaming data samples in a plurality of pre-established partitions. Then, in S103, sample alignment processing of the plurality of first streaming data samples according to the preset time period and the user identifiers of the plurality of second streaming data samples in the second electronic device may be implemented by the following steps:
[0115] S201: Acquire a plurality of first user identifiers in each partition whose sample times are within a preset time period.
[0116] In this step, for each partition, the first electronic device may encrypt multiple user identifiers whose sample times are within a preset time period to obtain multiple first user identifiers.
[0117] Among them, the first electronic device can use a homomorphic encryption algorithm to encrypt multiple user identifiers whose sample time is in a preset time period, and can also select a suitable encryption algorithm to encrypt the multiple user identifiers according to actual conditions. The embodiment of this application does not impose specific restrictions on this.
[0118] S202: Receive multiple second user identifications in each partition sent by the second electronic device.
[0119] S203: For each partition, perform sample alignment processing on the multiple first user identifiers in the partition and the multiple second user identifiers obtained for the partition corresponding to the second electronic device to obtain multiple target user identifiers.
[0120] In this step, after the first electronic device obtains multiple second user identifiers in each partition of the second electronic device, it can compare the multiple first user identifiers in each partition with the multiple second user identifiers of the corresponding partition of the second electronic device, and determine the first user identifier that is the same as the second user identifier as the target user identifier.
[0121] S204: Acquire a plurality of aligned first streaming data samples according to the plurality of target user identifiers.
[0122] In this step, the first electronic device determines the first streaming data sample corresponding to the target user identifier as the first streaming data sample after alignment processing.
[0123] The training method of the longitudinal federated model provided in the embodiment of the present application obtains multiple first user identifiers in each partition whose sample time is in a preset time period, receives multiple second user identifiers in each partition sent by the second electronic device, and for each partition, performs sample alignment processing on the multiple first user identifiers in the partition and the multiple second user identifiers of the corresponding partition of the second electronic device obtained, obtains multiple target user identifiers, and obtains multiple aligned first streaming data samples based on the multiple target user identifiers. The first electronic device stores the user identifiers of the first streaming data samples in multiple pre-established partitions, and performs sample alignment processing on each partition, thereby reducing the processing time and resource costs when performing sample alignment processing on a large number of first streaming data samples, and reducing operation and maintenance costs.
[0124] Optionally, in some embodiments, before performing multiple rounds of training on the vertical federation model using multiple target streaming data samples, the training method for the vertical federation model may further include the following steps: training the initial federation model using local data samples stored in the vertical federation model training database to obtain the vertical federation model. Simultaneously, the first electronic device may obtain characteristic information of the user based on the user identifier and obtain a prediction result or classification result using the vertical federation model. Based on the prediction result or classification result, information recommendations may be made to the user, and streaming data may be obtained in response to the user's actions on the information.
[0125] Based on any of the above embodiments, Figure 4 This is a flow chart of the third embodiment of the training method of the vertical federation model provided in the embodiment of this application. Figure 4 As shown, the training method of the vertical federation model also includes the following steps:
[0126] In step 1, the first electronic device uses local data samples to train the initial federation model to obtain a first longitudinal federation model.
[0127] The first vertical federation model is also the vertical federation model in the above embodiment.
[0128] In step 2, characteristic information of the user is obtained according to the user ID, and a prediction result or a classification result is obtained using the first longitudinal federation model.
[0129] Step 3: Recommend information to the user based on the prediction result or classification result, and obtain the first streaming data in response to the user's operation on the information.
[0130] The first streaming data is the streaming data in the above embodiment.
[0131] Step 4: Generate sample labels based on the operation data in the first streaming data.
[0132] Step 5: Generate a first streaming sample based on at least one sample feature and a sample label in the first streaming data, and store the user identifier of the first streaming sample in a first data storage device.
[0133] Based on any of the above embodiments, Figure 5 This is a flow chart of the fourth embodiment of the training method of the vertical federation model provided in the embodiment of the present application. Figure 5 As shown, the training method of the vertical federation model also includes the following steps:
[0134] In step 1, the first electronic device performs sample alignment processing on the user identifiers of multiple first streaming data samples in the data storage device according to the time window and the user identifiers of multiple second streaming data samples in the second electronic device, and obtains the aligned first streaming data samples.
[0135] Step 2: Filter the aligned first streaming data sample to obtain a first target streaming data sample.
[0136] The first target streaming data sample is the target streaming data sample in the above embodiment.
[0137] Step 3: Store the first target streaming data sample in a first data storage device.
[0138] Based on any of the above embodiments, Figure 6 This is a flow chart of the fifth embodiment of the training method of the vertical federation model provided in the embodiment of the present application. Figure 6 As shown, the training method of the vertical federation model also includes the following steps:
[0139] In step 1, multiple first target streaming data samples are used to perform multiple rounds of training on the first longitudinal federation model to obtain a trained longitudinal federation model.
[0140] The first electronic device may perform multiple rounds of training on the first vertical federation model according to a preset training algorithm and number of iterations, and the preset training algorithm and number of iterations need to be consistent with the training algorithm and number of iterations preset by the second electronic device.
[0141] Step 2: Perform model evaluation on the trained vertical federation model.
[0142] Based on any of the above embodiments, Figure 7 This is a flow chart of Example 6 of the training method for the vertical federation model provided in the embodiment of this application. Figure 7 , the training method of the vertical federation model also includes the following steps:
[0143] Step 1: Use local data samples to train the initial federated model to obtain the vertical federated model.
[0144] Step 2: According to the user ID, obtain the user's feature information and use the vertical federation model to obtain the prediction result or classification result.
[0145] Step 3: Recommend information to users based on the prediction results or classification results, and obtain streaming data in response to the user's operation on the information.
[0146] In step 4, according to the preset time period and the user identifiers of the plurality of second streaming data samples in the second electronic device, sample alignment processing is performed on the plurality of first streaming data samples, and filtering processing is performed on the plurality of aligned first streaming data samples to obtain a plurality of target streaming data samples.
[0147] In step 5, multiple rounds of training are performed on the longitudinal federation model using multiple target streaming data samples to obtain a trained longitudinal federation model.
[0148] Step 6: Perform model evaluation on the trained vertical federation model.
[0149] After obtaining the trained vertical federation model, the trained vertical federation model can be used to obtain prediction or classification results for the user. The following describes in detail the method for obtaining prediction or classification results for the user using the trained vertical federation model, using specific embodiments. The following specific embodiments may be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.
[0150] In a specific implementation, the information recommendation method can also be executed by an electronic device with processing capabilities, such as a terminal or server. It should be understood that the electronic device for the information recommendation method and the electronic device for executing the vertical federation model training method can be the same device or different devices.
[0151] Figure 8 This is a flow chart of Example 1 of the information recommendation method provided in this application. Figure 8 As shown, the information recommendation method may include the following steps:
[0152] S301: Obtain user feature information.
[0153] In this step, the first electronic device needs to obtain the characteristic information of the user so that it can subsequently obtain a prediction result or a classification result based on the characteristic information of the user through a pre-acquired trained longitudinal federation model.
[0154] In a possible implementation, the first electronic device may obtain the characteristic information of the user from a user information database according to the user identifier of the user.
[0155] In another possible implementation, the first electronic device may also obtain feature information in response to a user operation.
[0156] S302: Inputting the user's feature information into the pre-acquired trained longitudinal federation model to obtain the user's prediction result or classification result.
[0157] In this step, after the first electronic device obtains the user's feature information, it can use the trained longitudinal federation model to obtain the user's prediction result or classification result, so as to subsequently recommend information to the user based on the prediction result or classification result.
[0158] The trained vertical federation model is obtained by performing multiple rounds of training on the vertical federation model based on multiple streaming data obtained in response to operations of multiple users, a preset time period, and user identifiers of multiple second streaming data samples.
[0159] S303: Recommend information to the user based on the prediction result or classification result.
[0160] In this step, after the first electronic device obtains the prediction result or the classification result, it can recommend information to the user based on the prediction result or the classification result, thereby improving the accuracy of the information recommendation.
[0161] In a possible implementation, taking an e-commerce company as an example, if the prediction result is that the user is interested in product A, information corresponding to product A can be recommended to the user based on the prediction result.
[0162] In another possible implementation, taking an e-commerce company as an example, if the prediction result is that the user will shop at night, information can be recommended to the user during the night time period based on the prediction result.
[0163] In another possible implementation, using an e-commerce company as an example, if the classification result indicates that the user is a high-spending group, the electronic device can recommend the highest-priced products to the user when the user searches for products. For example, when the user searches for mobile phones, the electronic device can recommend the highest-priced mobile phones to the user based on the classification result indicating that the user is a high-spending group.
[0164] The information recommendation method provided in the embodiment of the present application obtains the user's characteristic information, inputs the user's characteristic information into a pre-acquired and trained longitudinal federated model, obtains the user's prediction result or classification result, and recommends information to the user based on the prediction result or classification result, thereby effectively improving the accuracy of information recommendation to the user and improving the user experience.
[0165] The following are device embodiments of the present application, which can be used to implement the method embodiments of the present application. For details not disclosed in the device embodiments of the present application, please refer to the method embodiments of the present application.
[0166] Figure 9 This is a schematic diagram of the structure of the training device of the vertical federation model provided in the embodiment of the present application. Figure 9 As shown, the training device of the vertical federation model includes:
[0167] An acquisition module 51 is configured to acquire streaming data generated by a user operation in response to the user operation;
[0168] A processing module 52 is configured to process the streaming data to generate a first streaming data sample of the longitudinal federation model, wherein the first streaming data sample includes a sample label, a sample time, at least one sample feature, and a user identifier;
[0169] The processing module 52 is further configured to perform sample alignment processing on the plurality of first streaming data samples according to the preset time period and the user identifiers of the plurality of second streaming data samples in the second electronic device, and filter the plurality of aligned first streaming data samples to obtain a plurality of target streaming data samples;
[0170] The processing module 52 is further configured to perform multiple rounds of training on the longitudinal federation model using multiple target streaming data samples to obtain a trained longitudinal federation model. The longitudinal federation model is configured to obtain prediction results or classification results of the user based on the user's feature information.
[0171] In a possible design of an embodiment of the present application, after generating the first streaming data sample of the federated model, the processing module 52 is further configured to:
[0172] Using a hash algorithm, the user identifiers of the first streaming data sample are stored in a plurality of pre-established partitions;
[0173] Accordingly, the processing module 52 is specifically configured to:
[0174] Acquire multiple first user identifiers in each partition whose sample time is within a preset time period;
[0175] receiving a plurality of second user identifiers in each partition sent by a second electronic device;
[0176] For each partition, performing sample alignment processing on the multiple first user identifiers in the partition and the multiple second user identifiers obtained for the corresponding partition of the second electronic device to obtain multiple target user identifiers;
[0177] According to the multiple target user identifiers, multiple aligned first streaming data samples are obtained.
[0178] In another possible design of an embodiment of the present application, the filtering process includes at least one of an outlier detection process, a missing value detection process, and a normalization process.
[0179] Optionally, before performing multiple rounds of training on the longitudinal federation model using multiple target streaming data samples, the processing module 52 is further configured to:
[0180] The initial federated model is trained using local data samples stored in the longitudinal federated model training database to obtain a longitudinal federated model.
[0181] Optionally, the acquisition module 51 is specifically configured to:
[0182] A plurality of user identifiers whose sample times are within a preset time period are encrypted to obtain a plurality of first user identifiers.
[0183] The training device for the vertical federation model provided in the embodiment of the present application can be used to execute the training method for the vertical federation model in any of the above embodiments. Its implementation principles and technical effects are similar and will not be repeated here.
[0184] Figure 10 This is a schematic diagram of the structure of the information recommendation device provided in the embodiment of the present application. Figure 10 As shown, the information recommendation device includes:
[0185] Acquisition module 61, used to obtain user feature information;
[0186] Processing module 62, configured to input the user's feature information into a pre-acquired trained longitudinal federation model to obtain a prediction result or classification result for the user, wherein the trained longitudinal federation model is obtained by performing multiple rounds of training on the longitudinal federation model based on multiple streaming data acquired in response to operations of multiple users, a preset time period, and user identifiers of multiple second streaming data samples;
[0187] The processing module 62 is further configured to recommend information to the user based on the prediction results or classification results.
[0188] In a possible design of an embodiment of the present application, the acquisition module 61 is specifically configured to:
[0189] According to the user's user ID, the user's characteristic information is obtained from the user information database.
[0190] The information recommendation device provided in the embodiments of the present application can be used to execute the information recommendation method in any of the above embodiments. Its implementation principles and technical effects are similar and will not be described in detail here.
[0191] It should be noted that it should be understood that the division of the various modules of the above device is merely a division of logical functions. In actual implementation, they can be fully or partially integrated into one physical entity, or they can be physically separated. Moreover, these modules can all be implemented in the form of software called by processing elements; they can also all be implemented in the form of hardware; some modules can also be implemented in the form of software called by processing elements, and some modules can be implemented in the form of hardware. In addition, these modules can be fully or partially integrated together or implemented independently. The processing element here can be an integrated circuit with signal processing capabilities. In the implementation process, each step of the above method or each of the above modules can be completed by the hardware integrated logic circuit in the processor element or by instructions in the form of software.
[0192] Figure 11 This is a schematic diagram of the structure of the electronic device provided in the embodiment of the present application. Figure 11 As shown, the electronic device may include: a processor 71, a memory 72, and computer program instructions stored in the memory 72 and executable on the processor 71. When the processor 71 executes the computer program instructions, it implements the training method and / or information recommendation method of the vertical federation model provided in any of the aforementioned embodiments.
[0193] Optionally, the electronic device may further include an interface for interacting with other devices.
[0194] Optionally, the above-mentioned components of the electronic device may be connected via a system bus.
[0195] The memory 72 may be a separate storage unit or a storage unit integrated in the processor. The number of processors may be one or more.
[0196] It should be understood that the processor 71 can be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in this application can be directly implemented as being executed by a hardware processor, or can be executed by a combination of hardware and software modules in the processor.
[0197] The system bus can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. System buses can be divided into address buses, data buses, and control buses. For ease of illustration, the diagram uses only a single thick line, but this does not imply a single bus or type of bus. Memory may include random access memory (RAM) and non-volatile memory (NVM), such as at least one disk drive.
[0198] All or part of the steps of the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a readable memory. When the program is executed, it performs the steps of the above-mentioned method embodiments; and the aforementioned memory (storage medium) includes: read-only memory (ROM), RAM, flash memory, hard disk, solid-state drive, magnetic tape, floppy disk, optical disc, and any combination thereof.
[0199] The electronic device provided in the embodiment of the present application can be used to execute the training method and / or information recommendation method of the vertical federation model provided in any of the above-mentioned method embodiments. Its implementation principles and technical effects are similar and will not be repeated here.
[0200] An embodiment of the present application provides a computer-readable storage medium, which stores computer instructions. When the computer instructions are executed on a computer, the computer executes the training method and / or information recommendation method of the above-mentioned vertical federation model.
[0201] The computer-readable storage medium mentioned above may be implemented by any type of volatile or non-volatile memory device, or a combination thereof, such as static random access memory, electrically erasable programmable read-only memory, erasable programmable read-only memory, programmable read-only memory, read-only memory, magnetic storage, flash memory, magnetic disk, or optical disk. The computer-readable storage medium may be any available medium that can be accessed by a general-purpose or special-purpose computer.
[0202] Optionally, a readable storage medium is coupled to a processor so that the processor can read information from the readable storage medium and write information to the readable storage medium. Of course, the readable storage medium can also be an integral part of the processor. The processor and the readable storage medium can be located in an application specific integrated circuit (ASIC). Of course, the processor and the readable storage medium can also exist in the device as discrete components.
[0203] An embodiment of the present application also provides a computer program product, which includes a computer program stored in a computer-readable storage medium. At least one processor can read the computer program from the computer-readable storage medium, and when the at least one processor executes the computer program, it can implement the above-mentioned vertical federation model training method and / or information recommendation method.
[0204] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A training method for a vertical federated model, characterized in that: The training method of the vertical federation model is applied to a first electronic device, and the method includes: In response to a user operation, acquiring streaming data generated by the operation; Processing the streaming data to generate a first streaming data sample of a longitudinal federated model, wherein the first streaming data sample includes a sample label, a sample time, at least one sample feature, and a user identifier; performing sample alignment processing on the plurality of first streaming data samples according to a preset time period and user identifiers of the plurality of second streaming data samples in the second electronic device, and filtering processing on the plurality of aligned first streaming data samples to obtain a plurality of target streaming data samples, wherein the preset time period is determined based on a time difference between the streaming data being transferred to disks of the first electronic device and the second electronic device; The longitudinal federation model is trained multiple times using the multiple target streaming data samples to obtain a trained longitudinal federation model, which is used to obtain a prediction result or classification result of the user based on the user's feature information.
2. The method according to claim 1, characterized in that After generating the first streaming data sample of the federated model, the method further includes: Using a hash algorithm, the user identifiers of the first streaming data sample are stored in a plurality of pre-established partitions; Accordingly, performing sample alignment processing on the plurality of first streaming data samples according to the preset time period and the user identifiers of the plurality of second streaming data samples in the second electronic device includes: Acquire a plurality of first user identifiers in each partition whose sample time is within the preset time period; receiving a plurality of second user identifiers in each partition sent by the second electronic device; For each partition, performing sample alignment processing on the multiple first user identifiers in the partition and the multiple second user identifiers obtained for the partition corresponding to the second electronic device to obtain multiple target user identifiers; According to the multiple target user identifiers, multiple aligned first streaming data samples are obtained.
3. The method according to claim 1 or 2, characterized in that The filtering process includes at least one of an outlier detection process, a missing value detection process, and a normalization process.
4. The method according to claim 3, characterized in that Before performing multiple rounds of training on the longitudinal federation model using multiple target streaming data samples, the method further includes: The initial federation model is trained using local data samples stored in the longitudinal federation model training database to obtain the longitudinal federation model.
5. The method according to claim 2, characterized in that The obtaining of a plurality of first user identifiers in each partition whose sample times are within the preset time period includes: Encryption processing is performed on multiple user identifiers whose sample times are within the preset time period to obtain multiple first user identifiers.
6. An information recommendation method, characterized in that: include: Obtain user feature information; Inputting the user's feature information into a pre-acquired trained longitudinal federation model to obtain a prediction result or classification result for the user, wherein the trained longitudinal federation model is obtained by training the longitudinal federation model multiple times based on multiple streaming data acquired in response to operations of multiple users, a preset time period, and user identifiers of multiple second streaming data samples, wherein the preset time period is determined based on a time difference between the streaming data being downloaded to the first electronic device and the second electronic device; Recommend information to the user based on the prediction result or the classification result.
7. The method according to claim 6, characterized in that The obtaining of user characteristic information includes: According to the user identifier of the user, characteristic information of the user is obtained from a user information database.
8. A training device for a vertical federation model, characterized in that: The training device of the vertical federation model is applied to a first electronic device, and the device includes: An acquisition module, configured to acquire streaming data generated by a user operation in response to the user operation; a processing module, configured to process the streaming data to generate a first streaming data sample of a longitudinal federated model, wherein the first streaming data sample includes a sample label, a sample time, at least one sample feature, and a user identifier; The processing module is further configured to perform sample alignment processing on the plurality of first streaming data samples according to a preset time period and user identifiers of the plurality of second streaming data samples in the second electronic device, and filter the plurality of aligned first streaming data samples to obtain a plurality of target streaming data samples, wherein the preset time period is determined based on a time difference between the streaming data being transferred to disks of the first electronic device and the second electronic device; The processing module is further used to perform multiple rounds of training on the longitudinal federation model using the multiple target streaming data samples to obtain a trained longitudinal federation model, and the longitudinal federation model is used to obtain the prediction result or classification result of the user based on the user's feature information.
9. An information recommendation device, characterized in that: include: Acquisition module, used to obtain user feature information; a processing module, configured to input the user's feature information into a pre-acquired trained longitudinal federation model to obtain a prediction result or classification result for the user, wherein the trained longitudinal federation model is obtained by performing multiple rounds of training on the longitudinal federation model based on a plurality of streaming data acquired in response to operations of a plurality of users, a preset time period, and user identifiers of a plurality of second streaming data samples, wherein the preset time period is determined based on a time difference between the streaming data being downloaded to the first electronic device and the second electronic device; The processing module is further configured to recommend information to the user based on the prediction result or the classification result.
10. An electronic device comprising: A processor, a memory, and computer program instructions stored in the memory and executable on the processor, wherein the processor is used to implement the training method of the vertical federation model as described in any one of claims 1 to 5 when executing the computer program instructions.
11. An electronic device comprising: A processor, a memory, and computer program instructions stored in the memory and executable on the processor, wherein the processor is used to implement the information recommendation method according to claim 6 or 7 when executing the computer program instructions.
12. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the training method of the vertical federation model as described in any one of claims 1 to 5.
13. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the information recommendation method according to claim 6 or 7.
14. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, it is used to implement the training method of the vertical federation model as described in any one of claims 1 to 5.
15. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, it is used to implement the information recommendation method according to claim 6 or 7.
Citation Information
Patent Citations
Data processing method and device, medium and electronic equipment
CN112434064A
Behavior prediction method, device and equipment and computer readable storage medium
CN112700281A