Model building optimization method, device, medium and computer program product
Through comparative learning technology, the feature extraction model is optimized by using the second party overlapping samples in the second device, and the problem of insufficient information on the sample characterization generated by feature extraction in the prior art is solved, and more efficient feature extraction and sample distinction capabilities are achieved. .
Patent Information
- Application Number
- CN202110277698.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-03-15
- Publication Date
- 2025-02-07
- Estimated Expiration
- 2041-03-15
AI Technical Summary
In the prior art, the sample characterization generated by feature extraction contains a low amount of information, resulting in insufficient information input from the model.
By obtaining the feature extraction model and based on the sample alignment results associated with the second device, the first-party overlapping sample and the first-party non-overlapping sample are extracted, and then the first-party non-overlapping sample is interacted with the second device by comparing and learning interaction with the second device, and the second device is combined with the second device. The two-party overlapped samples, generated comparative learning losses, and optimized the feature extraction model to obtain the target feature extraction model.
The amount of information contained in the sample characterization generated by feature extraction is improved, so that the feature extraction model can more effectively distinguish different types of samples, and improve the performance and accuracy of the model.
Smart Images

Figure CN112785002B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of machine learning technology in financial technology (Fintech), and in particular to a model building optimization method, device, medium and computer program product. Background Art
[0002] With the continuous development of financial technology, especially Internet technology finance, more and more technologies (such as distributed, artificial intelligence, etc.) are applied in the financial field, but the financial industry also puts forward higher requirements on technology, such as higher requirements on the distribution of corresponding to-do items in the financial industry.
[0003] With the continuous development of computer technology, the application of machine learning is becoming more and more extensive. When constructing a model, samples are often mapped to the latent space for dimensionality reduction and then used as model input. That is, the sample is feature extracted through the feature extraction model to obtain the sample representation, and then the sample representation is used as the model input. At present, the feature extraction model is usually constructed in the form of a generative adversarial network. However, since the encoder usually produces a certain amount of information loss during encoding, the amount of information contained in the sample representation generated based on feature extraction will be low. Summary of the invention
[0004] The main purpose of this application is to provide a model building optimization method, device, medium and computer program product, aiming to solve the technical problem of low information content contained in sample representation generated by feature extraction in the prior art.
[0005] To achieve the above-mentioned purpose, the present application provides a model building optimization method, which is applied to a first device and includes:
[0006] Acquire a feature extraction model, and extract first-party overlapping samples and first-party non-overlapping samples based on a sample alignment result associated with the second device;
[0007] Based on the first-party overlapping samples and the first-party non-overlapping samples, by performing contrastive learning interaction with the second device, combined with the second-party overlapping samples in the second device, generating a contrastive learning loss corresponding to the feature extraction model;
[0008] Based on the contrastive learning loss, the feature extraction model is optimized to obtain a target feature extraction model.
[0009] To achieve the above-mentioned purpose, the present application further provides a model building optimization method, which is applied to a second device and includes:
[0010] Acquire a second-party feature extraction model and second-party overlapping samples, and map the second-party overlapping samples to second-party overlapping sample representations based on the second-party feature extraction model;
[0011] The second-party overlapping sample representation is sent to the first device, so that the first device calculates the contrastive learning loss based on the second-party overlapping sample representation, the generated first-party overlapping sample representation, and the generated first-party non-overlapping sample representation.
[0012] To achieve the above object, the present application further provides a sample category prediction method, which is applied to a first device and includes:
[0013] Acquire a sample to be predicted, and extract features from the sample to be predicted based on a target feature extraction model to obtain a sample representation to be predicted corresponding to the sample to be predicted, wherein the target feature extraction model is constructed by performing comparative learning and federated learning based on first-party overlapping samples and first-party non-overlapping samples in the first device and second-party overlapping samples in the second device;
[0014] Based on the target category prediction model, by performing vertical federated prediction interaction with the second device, sample category prediction is performed on the representation of the sample to be predicted, and a target category prediction result corresponding to the sample to be predicted is obtained.
[0015] The present application also provides a model building optimization device, which is a virtual device and is applied to a first device. The model building optimization device includes:
[0016] an acquisition module, configured to acquire a feature extraction model and extract first-party overlapping samples and first-party non-overlapping samples based on a sample alignment result associated with a second device;
[0017] A contrastive learning module, configured to generate a contrastive learning loss corresponding to the feature extraction model based on the first-party overlapping samples and the first-party non-overlapping samples, by performing contrastive learning interaction with the second device, and combining the second-party overlapping samples in the second device;
[0018] An optimization module is used to optimize the feature extraction model based on the contrastive learning loss to obtain a target feature extraction model.
[0019] To achieve the above-mentioned purpose, the present application further provides a model building optimization device, which is a virtual device and is applied to a second device. The model building optimization device includes:
[0020] A feature extraction module, used to obtain a second-party feature extraction model and second-party overlapping samples, and map the second-party overlapping samples to second-party overlapping sample representations based on the second-party feature extraction model;
[0021] The sending module is used to send the second-party overlapping sample representation to the first device, so that the first device calculates the contrastive learning loss based on the second-party overlapping sample representation, the generated first-party overlapping sample representation and the generated first-party non-overlapping sample representation.
[0022] To achieve the above object, the present application further provides a sample category prediction device, wherein the sample category prediction is a virtual device, and the sample category prediction device is applied to a first device, and the sample category prediction includes:
[0023] A feature extraction module, used to obtain a sample to be predicted, and based on a target feature extraction model, perform feature extraction on the sample to be predicted to obtain a sample representation to be predicted corresponding to the sample to be predicted, wherein the target feature extraction model is constructed by performing comparative learning and federated learning based on first-party overlapping samples and first-party non-overlapping samples in the first device and second-party overlapping samples in the second device;
[0024] The sample category prediction module is used to perform sample category prediction on the representation of the sample to be predicted based on the target category prediction model, by performing vertical federated prediction interaction with the second device, to obtain a target category prediction result corresponding to the sample to be predicted.
[0025] The present application also provides a model building optimization device, which is a physical device, and includes: a memory, a processor, and a program of the model building optimization method stored in the memory and executable on the processor. When the program of the model building optimization method is executed by the processor, the steps of the model building optimization method as described above can be implemented.
[0026] The present application also provides a sample category prediction device, which is a physical device. The sample category prediction device includes: a memory, a processor, and a program of the sample category prediction method stored in the memory and executable on the processor. When the program of the sample category prediction method is executed by the processor, the steps of the sample category prediction method as described above can be implemented.
[0027] The present application also provides a medium, which is a readable storage medium, on which is stored a program for implementing the model building optimization method, and when the program of the model building optimization method is executed by a processor, the steps of the model building optimization method as described above are implemented.
[0028] The present application also provides a medium, which is a readable storage medium. The readable storage medium stores a program for implementing a sample category prediction method. When the program of the sample category prediction method is executed by a processor, the steps of the sample category prediction method as described above are implemented.
[0029] The present application also provides a computer program product, including a computer program, which implements the steps of the above-mentioned model building optimization method when executed by a processor.
[0030] The present application also provides a computer program product, including a computer program, which implements the steps of the sample category optimization method as described above when executed by a processor.
[0031] The present application provides a model construction optimization method, device, medium and computer program product. Compared with the technical means used in the prior art to construct a feature extraction model in a generative adversarial network manner, the present application first obtains a feature extraction model, and based on the sample alignment result associated with the second device, extracts the first-party overlapping samples and the first-party non-overlapping samples, and then based on the first-party overlapping samples and the first-party non-overlapping samples, through comparative learning interaction with the second device, combined with the second-party overlapping samples in the second device, generates a comparative learning loss corresponding to the feature extraction model. Therefore, the purpose of comparative learning based on the second-party overlapping samples of the second device and the first-party overlapping samples of the own party and the first-party non-overlapping samples of the own party is achieved, and then based on the comparative learning loss, the feature extraction model is optimized to obtain the target feature. The feature extraction model can achieve the purpose of constructing a target feature extraction model based on contrastive learning, and further achieves the purpose of utilizing the second overlapping samples in the second device to increase the distance between the feature extraction results of the feature extraction model for the first overlapping samples and the feature extraction results for the first non-overlapping samples, thereby giving the feature extraction model the ability to distinguish different types of samples, so that the similarity of the feature extraction results generated by the feature extraction model for different types of samples is extremely low, and thus the feature extraction results generated by the feature extraction model have the category information of the samples. Therefore, the technical defect in the prior art that the encoder usually loses a certain amount of information when encoding, which will lead to a low amount of information contained in the sample representation generated based on feature extraction, is overcome, so the amount of information contained in the sample representation generated by feature extraction is improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0033] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0034] Figure 1 A schematic diagram of the flow chart of the first embodiment of the model building optimization method of the present application;
[0035] Figure 2 A schematic diagram of the flow chart of the second embodiment of the model building optimization method of the present application;
[0036] Figure 3 A schematic diagram of an interaction process in which the first device and the second device calculate the category prediction loss by performing a federated interaction in an embodiment of the model construction optimization method of the present application when the category prediction model is a Poisson regression model;
[0037] Figure 4 A schematic diagram of the flow chart of the third embodiment of the model building optimization method of the present application;
[0038] Figure 5 A schematic diagram of the flow chart of the fourth embodiment of the model building optimization method of the present application;
[0039] Figure 6 A schematic diagram of the device structure of the hardware operating environment involved in the model building optimization method in the embodiment of the present application;
[0040] Figure 7 A schematic diagram of the device structure of the hardware operating environment involved in the sample category prediction method in the embodiment of the present application;
[0041] Figure 8 Schematic diagram of the hardware architecture of federated learning involved in the embodiment of the present application.
[0042] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0043] It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0044] The present application embodiment provides a model building optimization method. In the first embodiment of the model building optimization method of the present application, refer to Figure 1 , the model building optimization method is applied to a first device, and the model building optimization method includes:
[0045] Step S10, acquiring a feature extraction model, and extracting first-party overlapping samples and first-party non-overlapping samples based on a sample alignment result associated with the second device;
[0046] In this embodiment, it should be noted that the model building optimization method is applied to vertical federated learning, the feature extraction model is an untrained machine learning model, which is used to extract features from samples to map the samples into sample representations in a latent space, wherein the sample representations are encoding vectors representing the samples, the first device is a label provider for vertical federated learning, and the second device is a feature provider for vertical federated learning, wherein the label provider is a participant who provides samples with sample labels in vertical federated learning, and the feature provider is a participant who provides samples without sample labels in vertical federated learning.
[0047] In addition, it should be noted that before performing the step of obtaining the first-party overlapping samples and the first-party non-overlapping samples in the sample alignment result with the second device, the first device and the second device perform sample alignment, that is, the first device and the second device compare their respective sample IDs to determine the common sample ID between the first device and the second device, and obtain the sample alignment result, wherein the sample alignment result includes at least one common sample ID.
[0048] A feature extraction model is obtained, and based on the sample alignment result associated with the second device, first-party overlapping samples and first-party non-overlapping samples are extracted. Specifically, a feature extraction model is obtained, and based on each public sample ID in the sample alignment result associated with the second device, wherein the public sample ID is an identity identifier of overlapping samples between the first device and the second device, for example, the public sample ID may be a mobile phone number or an ID card number, etc., and then based on each public sample ID, first-party overlapping samples and a preset number of first-party non-overlapping samples are extracted, wherein the first-party overlapping samples are samples in the first device having the public sample ID, and the first-party non-overlapping samples are samples in the first device not having the public sample ID.
[0049] Step S20, based on the first-party overlapping samples and the first-party non-overlapping samples, by performing contrastive learning interaction with the second device, combined with the second-party overlapping samples in the second device, generating a contrastive learning loss corresponding to the feature extraction model;
[0050] In this embodiment, based on the first-party overlapping samples and the first-party non-overlapping samples, by performing contrastive learning interaction with the second device, the contrastive learning loss corresponding to the feature extraction model is generated in combination with the second-party overlapping samples in the second device. Specifically, the first-party overlapping samples are input into the feature extraction model, and feature extraction is performed on the first-party overlapping samples to map the first-party overlapping samples to first-party overlapping sample representations, and each first-party non-overlapping sample is input into the feature extraction model, and feature extraction is performed on each first-party non-overlapping sample to map each first-party non-overlapping sample to first-party non-overlapping sample representation, and then the second-party overlapping sample representation sent by the second device is received, wherein the second-party overlapping sample representation is a representation generated by the second device by extracting features from the second-party overlapping samples based on its own feature extraction model. The second-party overlapping samples are samples in the second device that have the same public sample ID as the first-party overlapping samples, and then the first-party overlapping sample representation is used as a positive example of the second-party overlapping sample representation, and the first-party very overlapping sample representation is used as a negative example of the second-party overlapping sample representation, and the contrastive learning loss is calculated, and then the first-party overlapping sample representation is sent to the second device, so that the second device uses the second-party overlapping sample representation as a positive example of the first-party overlapping sample representation, and uses the second-party non-overlapping sample representation as a negative example of the first-party overlapping sample representation, and calculates the second-party contrastive learning loss, wherein the second-party non-overlapping sample representation is a representation generated by the second device by extracting features from the second-party non-overlapping samples based on its own feature extraction model, and the second-party non-overlapping samples are samples in the second device that do not have a public sample ID.
[0051] The step of generating a contrastive learning loss corresponding to the feature extraction model based on the first-party overlapping samples and the first-party non-overlapping samples by performing contrastive learning interaction with the second device and combining the second-party overlapping samples in the second device includes:
[0052] Step S21, mapping the first-party overlapping samples to first-party overlapping sample representations, and mapping the first-party non-overlapping samples to first-party non-overlapping sample representations based on the feature extraction model;
[0053] In this embodiment, it should be noted that the number of the second-party non-overlapping samples is at least 1.
[0054] Based on the feature extraction model, the first-party overlapping samples are mapped to first-party overlapping sample representations, and the first-party non-overlapping samples are mapped to first-party non-overlapping sample representations. Specifically, the first-party overlapping samples are input into the feature extraction model, and data processing is performed on the first-party overlapping samples, wherein the data processing method includes but is not limited to convolution, pooling, and full connection, etc., and the first-party overlapping samples are mapped to a preset latent space to obtain a first-party overlapping sample representation, wherein the first-party overlapping sample representation is represented as a vector in the preset latent space. Similarly, each of the first-party non-overlapping samples is input into the feature extraction model, and data processing is performed on each of the first-party overlapping samples, wherein the data processing method includes but is not limited to convolution, pooling, and full connection, etc., and each of the first-party overlapping samples is mapped to a preset latent space to obtain a first-party non-overlapping sample representation corresponding to each of the first non-overlapping samples, wherein the first-party non-overlapping sample representation is represented as a vector in the preset latent space.
[0055] Step S22, sending the first-party overlapping sample representation to the second device, so that the second device calculates the second-party contrastive learning loss based on the first-party overlapping sample representation, the generated second-party overlapping sample representation, and the second-party non-overlapping sample representation;
[0056] In this embodiment, the first-party overlapping sample representation is sent to the second device so that the second device can calculate the second-party contrastive learning loss based on the first-party overlapping sample representation, the generated second-party overlapping sample representation, and the second-party non-overlapping sample representation. Specifically, the first-party overlapping sample representation is sent to the second device so that the second device can use the second-party overlapping sample representation as the second-party positive sample representation of the first-party overlapping sample representation, and use the second-party non-overlapping sample representation as the second-party negative sample representation of the first-party overlapping sample representation, and then substitute the first-party overlapping sample representation, the second-party positive sample representation, and the second-party negative sample representation into a preset second contrastive learning loss calculation formula to calculate the second-party contrastive learning loss, wherein the preset second contrastive learning loss calculation formula is as follows:
[0057]
[0058] in, is the second-party contrastive learning loss, u A is the first overlapping sample representation, u B For the second positive sample characterization, is the second-party negative sample representation, M is the number of second-party negative sample representations, and when the distance between the second-party positive sample representation and the first-party overlapping sample representation is small enough, and the distance between the second-party negative sample representation and the first-party overlapping sample representation is large enough, the second contrastive learning loss can converge, and the feature extraction model updated based on the second-party contrastive learning loss can have the ability to shorten the distance between the first-party overlapping sample representation and the second-party positive sample representation, and to increase the distance between the first-party overlapping sample representation and the second-party negative sample representation. The feature extraction model can generate different sample representations based on samples of different sample types (positive or negative), so that the generated sample representation has sample type information, thereby improving the amount of information contained in the sample representation generated by feature extraction.
[0059] Step S23: receiving the second-party overlapping sample representation, and generating the contrastive learning loss corresponding to the feature extraction model by using the first-party overlapping sample representation as the positive sample representation corresponding to the second-party overlapping sample representation, and by using the first-party non-overlapping sample representation as the negative sample representation corresponding to the second-party overlapping sample representation.
[0060] In this embodiment, the second-party overlapping sample representation is received, and the contrastive learning loss corresponding to the feature extraction model is generated by taking the first-party overlapping sample representation as the positive sample representation corresponding to the second-party overlapping sample representation, and taking the first-party non-overlapping sample representation as the negative sample representation corresponding to the second-party overlapping sample representation. Specifically, the second-party overlapping sample representation is received, and the first-party overlapping sample representation is taken as the positive sample representation corresponding to the second-party overlapping sample representation, and the first-party non-overlapping sample representation is taken as the negative sample representation corresponding to the second-party overlapping sample representation, and then the positive sample representation, the negative sample representation and the second-party overlapping sample representation are input into a preset first contrastive learning loss calculation formula to calculate the contrastive learning loss, wherein the preset first contrastive learning loss calculation formula is as follows:
[0061]
[0062] Among them, among them, is the contrastive learning loss, u B is the second overlapping sample representation, u A is the representation of the positive sample, is the negative sample representation, N is the number of negative sample representations, and when the distance between the first-party positive sample representation and the second-party overlapping sample representation is large enough, and the distance between the first-party negative sample representation and the second-party overlapping sample representation is small enough, the contrastive learning loss can converge, and the feature extraction model updated based on the contrastive learning loss can have the ability to shorten the distance between the second-party overlapping sample representation and the first-party positive sample representation, and to increase the distance between the second-party overlapping sample representation and the first-party negative sample representation. The feature extraction model can generate different sample representations based on samples of different sample types (positive or negative), so that the generated sample representation has sample type information, thereby improving the amount of information contained in the sample representation generated by feature extraction.
[0063] Step S30: optimizing the feature extraction model based on the contrastive learning loss to obtain a target feature extraction model.
[0064] In this embodiment, based on the contrastive learning loss, the feature extraction model is optimized to obtain a target feature extraction model. Specifically, based on the contrastive learning loss, the model update gradient corresponding to the feature extraction model is calculated, and then based on the model update gradient, the feature extraction model is updated, and it is determined whether the updated feature extraction model meets the preset iterative training end condition. If so, the feature extraction model is used as the target feature extraction model. If not, the step of extracting the first-party overlapping samples and the first-party non-overlapping samples based on the sample alignment result associated with the second device is returned.
[0065] The embodiment of the present application provides a model construction optimization method. Compared with the technical means used in the prior art to construct a feature extraction model in a generative adversarial network manner, the embodiment of the present application first obtains a feature extraction model, and based on the sample alignment result associated with the second device, extracts the first-party overlapping samples and the first-party non-overlapping samples, and then based on the first-party overlapping samples and the first-party non-overlapping samples, through comparative learning interaction with the second device, combined with the second-party overlapping samples in the second device, generates a comparative learning loss corresponding to the feature extraction model. Therefore, the purpose of comparative learning based on the second-party overlapping samples of the second device and the first-party overlapping samples of the own party and the first-party non-overlapping samples of the own party is achieved, and then based on the comparative learning loss, the feature extraction model is optimized to obtain the target feature extraction model. The type can achieve the purpose of building a target feature extraction model based on contrastive learning, and further achieve the purpose of utilizing the second-party overlapping samples in the second device to distance the feature extraction results of the feature extraction model for the first-party overlapping samples from the feature extraction results for the first-party non-overlapping samples, thereby giving the feature extraction model the ability to distinguish different types of samples, so that the similarity of feature extraction results generated by the feature extraction model for different types of samples is extremely low, and thus the feature extraction results generated by the feature extraction model have the category information of the samples. Therefore, the technical defect in the prior art that the encoder usually loses a certain amount of information when encoding, which will lead to a low amount of information contained in the sample representation generated based on feature extraction, is overcome, so the amount of information contained in the sample representation generated by feature extraction is improved.
[0066] Further, refer to Figure 2 Based on the first embodiment of the present application, in another embodiment of the present application, after the contrastive learning loss corresponding to the feature extraction model is generated by performing contrastive learning interaction with the second device based on the first-party overlapping samples and the first-party non-overlapping samples, and combining the second-party overlapping samples in the second device, the model construction optimization method further includes:
[0067] Step A10, based on the first-party overlapping samples and preset sample labels, by performing federated learning with the second device, combined with the second-party overlapping samples, iteratively training the prediction model to be trained including the feature extraction model, and generating a category prediction loss;
[0068] In this embodiment, it should be noted that the preset sample label is a pre-set label of the first-party overlapping sample, which is used to identify the first-party overlapping sample, such as identifying the category, purpose and identity information of the first-party overlapping sample, and the prediction model to be trained includes a feature extraction model and a category prediction model, wherein the category prediction model is an untrained machine learning model, which is used to predict the category of the sample.
[0069] Based on the first-party overlapping samples and preset sample labels, by performing federated learning with the second device, the second-party overlapping samples are combined to iteratively train the prediction model to be trained including the feature extraction model to generate a category prediction loss. Specifically, the first-party overlapping sample representation corresponding to the first-party overlapping samples generated by the feature extraction model is obtained, and then the first-party overlapping sample representation is input into the category prediction model to perform model prediction to generate a first category prediction result, and the first category prediction result is homomorphically encrypted to generate a first encrypted category prediction result, and then the first encrypted category prediction result is aggregated with the second encrypted category prediction result sent by the second device to generate an aggregated encrypted category prediction result, wherein the second encrypted category prediction result is generated by the second device performing homomorphic encryption on the generated second category prediction result, and the second category prediction result is generated by the second device performing model prediction on the second-party overlapping sample representation using its own second-party feature extraction model and the second-party category prediction model, and then based on the The aggregated encrypted category prediction result and the preset sample label of homomorphic encryption are used to calculate the encrypted category prediction loss, and then based on the encrypted label loss and the first-party overlapping samples, the encrypted category prediction loss is calculated, and the encrypted category prediction loss is sent to the federal server for the federal server to decrypt the encrypted category prediction loss to obtain the category prediction loss, and then receive the category prediction loss sent by the federal server. In addition, the encrypted category prediction loss is sent to the second device, so that the second device can calculate the second-party encrypted category prediction loss based on the encrypted category prediction loss and the second-party overlapping samples, and send the second-party encrypted category prediction loss to the federal server, so that the federal server can decrypt the second-party encrypted category prediction loss to obtain the second-party category prediction loss, and then the second device receives the second-party category prediction loss sent by the federal server. It should be noted that the public key of homomorphic encryption exists in the first device and the second device, and the private key of homomorphic encryption exists in the federal server. Figure 3 The figure shows a schematic diagram of the interaction process of calculating the category prediction loss by the first device and the second device through federated interaction when the category prediction model is a Poisson regression model, wherein the label provider A is the second device, the feature provider B is the first device, Weizhong C is the federated server, and wx A and exp(wx A ) are the second category prediction results, where x A For the second overlapping sample representation, wx A The w in the equation is the model parameter of the second-party category prediction model, and wx B and exp(wx B ) are the prediction results of the first category, xB is the first overlapping sample representation, wx B Where w is the model parameter of the category prediction model, y is the preset sample label, and d is the category prediction loss. B The prediction loss for the class, g A Predict the loss for the second party category, [] is an encryption symbol, indicating that the data within the symbol is homomorphically encrypted.
[0070] Step A20: optimizing the prediction model to be trained based on the contrastive learning loss and the category prediction loss to obtain a target prediction model.
[0071] In this embodiment, based on the contrastive learning loss and the category prediction loss, the prediction model to be trained is optimized to obtain a target prediction model. Specifically, based on the contrastive learning loss, the contrastive learning loss gradient is calculated, and then based on the category prediction loss, the category prediction loss gradient is calculated, and based on the category prediction loss gradient, the model parameters of the category prediction model are optimized and updated, and based on the contrastive learning loss gradient and the category prediction loss gradient, the model parameters of the feature extraction model are jointly optimized and updated, and then it is determined whether the optimized and updated feature extraction model and the optimized and updated category prediction model both meet the preset iterative training end conditions. If both meet the conditions, the optimized and updated feature extraction model and the optimized and updated category prediction model are used as the target prediction model together. If both do not meet the conditions, the sample alignment result based on the association with the second device is returned, and the first overlapping samples and the second overlapping samples are extracted. The step of one party non-overlapping samples, wherein it should be noted that if the feature extraction model is not optimized based on contrastive learning, the feature extraction model is more likely to generate similar or identical sample representations for different types of samples, thereby resulting in poor model effect of the category prediction model, that is, the category prediction accuracy of the category prediction model with the feature extraction model is low. The embodiment of the present application utilizes the second party overlapping samples in the second device to increase the distance between the feature extraction results of the feature extraction model for the first party overlapping samples and the feature extraction results for the first party non-overlapping samples, thereby giving the feature extraction model the ability to distinguish different types of samples, so that the similarity of the sample representations generated by the feature extraction model for different types of samples is extremely low, thereby improving the model effect of the category prediction model, that is, improving the category prediction accuracy of the category prediction model with the feature extraction model.
[0072] The prediction model to be trained includes a feature extraction model and a category prediction model, and the target prediction model includes a target feature extraction model and a target category prediction model.
[0073] The step of optimizing the prediction model to be trained based on the contrastive learning loss and the category prediction loss to obtain a target prediction model comprises:
[0074] Step A21, optimizing the category prediction model based on the category prediction loss to obtain the target category prediction model;
[0075] In this embodiment, it should be noted that the method for optimizing the category prediction model includes a gradient descent method and a gradient ascent method.
[0076] Based on the category prediction loss, the category prediction model is optimized to obtain the target category prediction model. Specifically, based on the category prediction loss, the category prediction loss gradient is calculated, and then based on the category prediction loss gradient, the model parameters of the category prediction model are optimized and updated, and it is determined whether the optimized and updated federated prediction model meets the preset iterative training end condition. If so, the category prediction model is used as the target category prediction model. If not, the step of extracting the first-party overlapping samples and the first-party non-overlapping samples based on the sample alignment result associated with the second device is returned.
[0077] Step A22: asynchronously optimize the feature extraction model based on the contrastive learning loss and the category prediction loss to obtain the target feature extraction model.
[0078] In this embodiment, based on the contrastive learning loss and the category prediction loss, the feature extraction model is asynchronously optimized to obtain the target feature extraction model. Specifically, based on the contrastive learning loss, the contrastive learning loss gradient is calculated, and then based on the contrastive learning loss gradient, the model parameters of the feature extraction model are optimized and updated, and based on the category prediction loss, the category prediction loss gradient is calculated, and then based on the category prediction loss gradient, the model parameters of the optimized and updated feature extraction model are secondary optimized and updated, and it is determined whether the secondary optimized and updated feature extraction model meets the preset iterative training end condition. If so, the secondary optimized and updated feature extraction model is used as the target feature extraction model. If not, the step of extracting the first-party overlapping samples and the first-party non-overlapping samples based on the sample alignment result associated with the second device is returned.
[0079] In another embodiment, step A22 further includes:
[0080] Based on the contrastive learning loss, the contrastive learning loss gradient is calculated, and then according to the category prediction loss gradient generated by the category prediction loss, the model parameters of the feature extraction model are optimized and updated, and according to the contrastive learning loss gradient, the model parameters of the optimized and updated feature extraction model are secondary optimized and updated to obtain the target feature extraction model.
[0081] The target prediction model includes a target feature extraction model and a target category prediction model.
[0082] After the step of optimizing the prediction model to be trained based on the contrastive learning loss and the category prediction loss to obtain a target prediction model, the model construction optimization method further includes:
[0083] Step A30, obtaining a sample to be predicted, and performing feature extraction on the sample to be predicted based on the target feature extraction model to obtain a sample representation to be predicted corresponding to the sample to be predicted, wherein the target feature extraction model is constructed by performing comparative learning and federated learning based on the first-party overlapping samples and the first-party non-overlapping samples in the first device and the second-party overlapping samples in the second device;
[0084] In this embodiment, it should be noted that the model construction process of the target feature extraction model can refer to the contents of steps S10 to S30 and steps A10 to A20, which will not be repeated here. Since the target feature extraction model is constructed based on comparative learning and federated learning of the first-party overlapping samples and the first-party non-overlapping samples in the first device and the second-party overlapping samples in the second device, the target feature extraction model has a good ability to distinguish between positive samples and negative samples. That is, the distance between the sample representation corresponding to the positive sample generated by the target feature extraction model and the sample representation corresponding to the generated negative sample will be greater than the preset distance threshold, so that the positive sample and the negative sample can be distinguished according to the sample representation of the positive sample and the sample representation of the negative sample. The federated learning is vertical federated learning or vertical federated transfer learning.
[0085] Acquire a sample to be predicted, and based on the target feature extraction model, perform feature extraction on the sample to be predicted, and obtain a sample representation to be predicted corresponding to the sample to be predicted. Specifically, acquire the sample to be predicted, and input the sample to be predicted into the target feature extraction model, perform feature extraction on the sample to be predicted, so as to map the sample to be predicted to a preset latent space, and obtain the sample representation to be predicted corresponding to the sample to be predicted.
[0086] Step A40, based on the target category prediction model, by performing vertical federated prediction interaction with the second device, the model prediction is performed on the representation of the sample to be predicted to obtain the target category prediction result corresponding to the sample to be predicted.
[0087] In this embodiment, based on the target category prediction model, by performing vertical federated prediction interaction with the second device, the model prediction is performed on the representation of the sample to be predicted to obtain the target category prediction result corresponding to the sample to be predicted. Specifically, the representation of the sample to be predicted is input into the target category prediction model, and the model prediction is performed on the representation of the sample to be predicted to obtain a first category prediction result, and then the first category prediction result is homomorphically encrypted to obtain a first encrypted category prediction result, and then the first encrypted category prediction result is sent to the federated server, and then the federated server receives the first encrypted category prediction result and the second encrypted category prediction result sent by the second device, wherein the encrypted category prediction result is generated by the second device for the second encrypted category prediction result. The category prediction result is obtained by homomorphic encryption, and the second category prediction result is generated by the second device inputting the second party's sample to be predicted into its own target category prediction model to perform model prediction. The second party's sample to be predicted is an aligned sample with the same public sample ID as the sample to be predicted. Then, the federal server aggregates the first encrypted category prediction result and the second encrypted category prediction result based on a preset aggregation rule to obtain an encrypted aggregated category prediction result, wherein the preset aggregation rule includes weighted summation and weighted average, etc. Then, the first device receives the encrypted aggregated category prediction result, decrypts the encrypted aggregated category prediction result, obtains an aggregated category prediction result, and uses the aggregated category prediction result as the target category prediction result.
[0088] The embodiment of the present application provides a method for optimizing the construction of a category prediction model. Specifically, after generating a contrastive learning loss, based on the first-party overlapping samples and preset sample labels, federated learning is performed with the second device, and the second-party overlapping samples are combined to iteratively train the prediction model to be trained including the feature extraction model to generate a category prediction loss. Based on the contrastive learning loss and the category prediction loss, the prediction model to be trained is optimized to obtain a target prediction model, thereby achieving the purpose of constructing a target feature extraction model based on contrastive learning, and utilizing the second-party overlapping samples in the second device to increase the distance between the feature extraction results of the feature extraction model for the first-party overlapping samples and the feature extraction results for the first-party non-overlapping samples, so that the feature extraction model has the ability to distinguish different types of samples, and the target prediction model generated with the feature extraction model has a stronger category distinction ability, a better model prediction effect, and a higher recognition accuracy of the model for different types of samples.
[0089] Further, refer to Figure 4 Based on the first and second embodiments of the present application, in another embodiment of the present application, the model building optimization method is applied to a second device, and the model building optimization method includes:
[0090] Step B10, obtaining a second-party feature extraction model and second-party overlapping samples, and mapping the second-party overlapping samples to second-party overlapping sample representations based on the second-party feature extraction model;
[0091] In this embodiment, it should be noted that the first device is a label provider for vertical federated learning, and the second device is a feature provider for vertical federated learning, wherein the label provider is a participant who provides samples with sample labels in vertical federated learning, and the feature provider is a participant who provides samples without sample labels in vertical federated learning, and the second-party feature extraction model is an untrained machine learning model in the second device, which is used to extract features from samples to map the samples into sample representations in a latent space, wherein the sample representations are encoding vectors representing the samples.
[0092] A second-party feature extraction model and second-party overlapping samples are obtained, and based on the second-party feature extraction model, the second-party overlapping samples are mapped to second-party overlapping sample representations. Specifically, the second-party feature extraction model is obtained, and based on each public sample ID in the sample alignment result associated with the second device, the second-party overlapping samples are extracted, wherein the public sample ID is the identity of the overlapping samples between the first device and the second device, and the second-party overlapping samples and the first-party overlapping samples have the same public sample ID, and then based on the second-party feature extraction model, the second-party overlapping samples are mapped to a preset latent space to obtain the second-party overlapping sample representations corresponding to the second-party overlapping samples.
[0093] Wherein, after the step of mapping the second-party overlapping samples to second-party overlapping sample representations based on the second-party feature extraction model, the model construction optimization method further includes:
[0094] Step C10, obtaining second-party non-overlapping samples, and mapping the second-party non-overlapping samples to second-party non-overlapping sample representations based on the second-party feature extraction model;
[0095] In this embodiment, it should be noted that the second-party non-overlapping samples are samples in the second device that do not have the public sample ID.
[0096] Obtain second-party non-overlapping samples, and based on the second-party feature extraction model, map the second-party non-overlapping samples to second-party non-overlapping sample representations. Specifically, obtain a preset number of second-party non-overlapping samples, and based on the second-party feature extraction model, map the second-party non-overlapping samples to a preset latent space to obtain second-party non-overlapping sample representations.
[0097] Step C20, receiving the first-party overlapping sample representation sent by the first device, and generating a second-party contrastive learning loss of the second-party feature extraction model by using the second-party overlapping sample representation as the second-party positive sample representation of the first-party overlapping sample representation, and by using the second-party non-overlapping sample representation as the second-party negative sample representation of the first-party overlapping sample representation;
[0098] In this embodiment, it should be noted that the first-party overlapping sample representation is a sample representation generated by the first device by mapping the first-party overlapping samples to a preset latent space based on a feature extraction model.
[0099] Receive the first-party overlapping sample representation sent by the first device, and generate the second-party contrastive learning loss of the second-party feature extraction model by taking the second-party overlapping sample representation as the second-party positive sample representation of the first-party overlapping sample representation, and taking the second-party non-overlapping sample representation as the second-party negative sample representation of the first-party overlapping sample representation. Specifically, receive the first-party overlapping sample representation sent by the first device, and take the second-party overlapping sample representation as the positive sample representation of the first-party overlapping sample representation, and take the second-party non-overlapping sample representation as the negative sample representation of the first-party overlapping sample representation, and then substitute the first-party overlapping sample representation, the second-party positive sample representation and the second-party negative sample representation into a preset second contrastive learning loss calculation formula to calculate the second-party contrastive learning loss, wherein the preset second contrastive learning loss calculation formula is as follows:
[0100]
[0101] in, is the second-party contrastive learning loss, u A is the first overlapping sample representation, u B For the second positive sample characterization, is the second-party negative sample representation, M is the number of second-party negative sample representations, and when the distance between the second-party positive sample representation and the first-party overlapping sample representation is large enough, and the distance between the second-party negative sample representation and the first-party overlapping sample representation is small enough, the second contrastive learning loss can converge, and the feature extraction model updated based on the second-party contrastive learning loss can have the ability to shorten the distance between the first-party overlapping sample representation and the second-party positive sample representation, and to increase the distance between the first-party overlapping sample representation and the second-party negative sample representation. The feature extraction model can generate different sample representations based on samples of different sample types (positive or negative), so that the generated sample representation has sample type information, which improves the amount of information contained in the sample representation generated by feature extraction.
[0102] Step C30: optimizing the second-party feature extraction model based on the second-party contrastive learning loss to obtain a second-party target feature extraction model.
[0103] In this embodiment, based on the second-party contrastive learning loss, the second-party feature extraction model is optimized to obtain the second-party target feature extraction model. Specifically, based on the second-party contrastive learning loss, the second-party model update gradient corresponding to the second-party feature extraction model is calculated, and according to the second-party model update gradient, the second-party feature extraction model is updated, and it is determined whether the updated second-party feature extraction model meets the preset iterative training end condition. If so, the updated second-party feature extraction model is used as the second-party target feature extraction model. If not, the step of extracting the second-party overlapping samples based on each public sample ID in the sample alignment result associated with the second device is returned.
[0104] Step B20: Send the second-party overlapping sample representation to the first device, so that the first device calculates the contrastive learning loss based on the second-party overlapping sample representation, the generated first-party overlapping sample representation, and the generated first-party non-overlapping sample representation.
[0105] In this embodiment, it should be noted that the first-party non-overlapping sample representation is a sample representation corresponding to the first-party non-overlapping samples in a preset latent space, and the first-party non-overlapping samples are samples in the first device that do not have a public sample ID.
[0106] The second-party overlapping sample representation is sent to the first device, so that the first device calculates the contrastive learning loss based on the second-party overlapping sample representation, the generated first-party overlapping sample representation, and the generated first-party non-overlapping sample representation. Specifically, the second-party overlapping sample representation is sent to the first device, so that the first device uses the first-party overlapping sample representation as the positive sample representation corresponding to the second-party overlapping sample representation, and uses the first-party non-overlapping sample representation as the negative sample representation corresponding to the second-party overlapping sample representation, and then inputs the positive sample representation, the negative sample representation, and the second-party overlapping sample representation into a preset first contrastive learning loss calculation formula to calculate the contrastive learning loss, wherein the preset first contrastive learning loss calculation formula is as follows:
[0107]
[0108] Among them, among them, is the contrastive learning loss, u B is the second overlapping sample representation, u A is the representation of the positive sample, is the negative sample representation, N is the number of negative sample representations, and when the distance between the first-party positive sample representation and the second-party overlapping sample representation is large enough, and the distance between the first-party negative sample representation and the second-party overlapping sample representation is small enough, the contrastive learning loss can converge, and the feature extraction model updated based on the contrastive learning loss can have the ability to shorten the distance between the second-party overlapping sample representation and the first-party positive sample representation, and to increase the distance between the second-party overlapping sample representation and the first-party negative sample representation. The feature extraction model can generate different sample representations based on samples of different sample types (positive or negative), so that the generated sample representation has sample type information, thereby improving the amount of information contained in the sample representation generated by feature extraction.
[0109] Wherein, after the step of generating a second contrastive learning loss of the second-party feature extraction model by using the second-party overlapping sample representation as the positive sample representation of the first-party overlapping sample representation, and by using the second-party non-overlapping sample representation as the negative sample representation of the first-party overlapping sample representation, the model construction optimization method further includes:
[0110] Step D10, based on the second-party overlapping samples, by performing federated learning with the first device, combining the first-party overlapping samples and preset sample labels in the first device, iteratively training the second-party prediction model to be trained with the second-party feature extraction model, and generating a second-party category prediction loss;
[0111] In this embodiment, it should be noted that the second model to be trained includes a second-party feature extraction model for feature extraction and a second-party category prediction model for performing model prediction.
[0112] Based on the second-party overlapping samples, by performing federated learning with the first device, the first-party overlapping samples and preset sample labels in the first device are combined, and the second-party to-be-trained prediction model with the second-party feature extraction model is iteratively trained to generate a second-party category prediction loss. Specifically, the second-party overlapping sample representation corresponding to the second-party overlapping samples generated by the second-party feature extraction model is obtained, and then the second-party overlapping sample representation is input into the second-party category prediction model to perform model prediction to obtain a second category prediction result, and then based on the second output sample label, the second-party category prediction loss is generated by performing federated interaction with the first device and the federated server, so as to provide the first device with a category prediction loss, wherein the specific generation process of the category prediction loss and the second-party category prediction loss can refer to the specific content in step A10.
[0113] Step D20: optimizing the second-party prediction model to be trained based on the second-party category prediction loss and the second-party comparative learning loss to obtain a second-party target prediction model.
[0114] Based on the second-party category prediction loss and the second-party contrastive learning loss, the second-party prediction model to be trained is optimized to obtain the second-party target prediction model. Specifically, based on the second-party contrastive learning loss, the second-party contrastive learning loss gradient is calculated, and then based on the second-party category prediction loss gradient generated by the second-party category prediction loss, the model parameters of the second-party category prediction model are optimized and updated, and based on the second-party contrastive learning loss gradient and the second-party category prediction loss gradient, the model parameters of the second-party feature extraction model are jointly optimized and updated, wherein the joint optimization includes synchronous optimization and asynchronous optimization, and then it is determined whether the optimized and updated second-party feature extraction model and the optimized and updated second-party category prediction model both meet the preset iterative training end condition. If so, the optimized and updated second-party feature extraction model and the optimized and updated second-party category prediction model are used together as the second-party target prediction model. If not, the step of extracting the second-party overlapping samples based on each public sample ID in the sample alignment result associated with the second device is returned.
[0115] Further, refer to Figure 5 Based on the first embodiment, the second embodiment and the third embodiment of the present application, in another embodiment of the present application, the sample category prediction method is applied to a first device, and the sample category prediction method includes:
[0116] Step E10, obtaining a sample to be predicted, and performing feature extraction on the sample to be predicted based on a target feature extraction model to obtain a sample representation to be predicted corresponding to the sample to be predicted, wherein the target feature extraction model is constructed by performing comparative learning and federated learning based on first-party overlapping samples and first-party non-overlapping samples in the first device and second-party overlapping samples in the second device;
[0117] In this embodiment, it should be noted that the model construction process of the target feature extraction model can refer to the contents of steps S10 to S30 and steps A10 to A20, which will not be repeated here. Moreover, since the target feature extraction model is constructed based on comparative learning and federated learning of the first-party overlapping samples and the first-party non-overlapping samples in the first device and the second-party overlapping samples in the second device, the target feature extraction model has a good ability to distinguish between positive samples and negative samples. That is, the distance between the sample representation corresponding to the positive sample generated by the target feature extraction model and the sample representation corresponding to the generated negative sample will be greater than the preset distance threshold, so that the positive sample and the negative sample can be distinguished according to the sample representation of the positive sample and the sample representation of the negative sample.
[0118] Acquire a sample to be predicted, and based on a target feature extraction model, perform feature extraction on the sample to be predicted, and obtain a sample representation to be predicted corresponding to the sample to be predicted. Specifically, acquire the sample to be predicted, and input the sample to be predicted into a target feature extraction model, perform feature extraction on the sample to be predicted, so as to map the sample to be predicted to a preset latent space, and obtain a sample representation to be predicted corresponding to the sample to be predicted.
[0119] Wherein, before the step of extracting features from the sample to be predicted based on the target feature extraction model to obtain a sample representation to be predicted corresponding to the sample to be predicted, wherein the target feature extraction model is constructed by performing comparative learning and federated learning based on the first-party overlapping samples and the first-party non-overlapping samples in the first device and the second-party overlapping samples in the second device, the sample category prediction method further includes:
[0120] Step F10, mapping the first-party overlapping samples to first-party overlapping sample representations, and mapping the first-party non-overlapping samples to first-party non-overlapping sample representations based on a feature extraction model;
[0121] In this embodiment, based on the feature extraction model, the first-party overlapping samples are mapped to the first-party overlapping sample representation, and the first-party non-overlapping samples are mapped to the first-party non-overlapping sample representation. Specifically, the first-party overlapping samples are input into the feature extraction model, and feature extraction is performed on the first-party overlapping samples to map the first-party overlapping samples to a preset latent space to obtain the first-party overlapping sample representation, and the first-party non-overlapping samples are input into the feature extraction model, and feature extraction is performed on the first-party non-overlapping samples to map the first-party non-overlapping samples to a preset latent space to obtain the first non-overlapping sample representation.
[0122] Step F20, receiving the second overlapping sample representation sent by the second device, and generating the contrastive learning loss corresponding to the feature extraction model by taking the first overlapping sample representation as the positive sample representation corresponding to the second overlapping sample representation, and taking the first non-overlapping sample representation as the negative sample representation corresponding to the second overlapping sample representation;
[0123] In this embodiment, the second-party overlapping sample representation sent by the second device is received, and the contrastive learning loss corresponding to the feature extraction model is generated by taking the first-party overlapping sample representation as the positive sample representation corresponding to the second-party overlapping sample representation, and taking the first-party non-overlapping sample representation as the negative sample representation corresponding to the second-party overlapping sample representation. Specifically, the second-party overlapping sample representation sent by the second device is received, and the first-party overlapping sample representation is taken as the positive sample representation corresponding to the second-party overlapping sample representation, and the first-party non-overlapping sample representation is taken as the negative sample representation corresponding to the second-party overlapping sample representation, and then based on the positive sample representation, the negative sample representation and the second-party overlapping sample representation, the contrastive learning loss is generated, wherein the specific process of generating the contrastive learning loss can refer to the contents of steps S21 to S23, which will not be repeated here.
[0124] Step F30: optimizing the feature extraction model based on the contrastive learning loss to obtain the target feature extraction model.
[0125] In this embodiment, based on the contrastive learning loss, the feature extraction model is optimized to obtain the target feature extraction model. Specifically, based on the contrastive learning loss, the model update gradient corresponding to the feature extraction model is calculated, and then based on the model update gradient, the feature extraction model is updated, and it is determined whether the updated feature extraction model meets the preset iterative training end condition. If so, the feature extraction model is used as the target feature extraction model. If not, the step of extracting the first-party overlapping samples and the first-party non-overlapping samples based on the sample alignment result associated with the second device is returned.
[0126] Step E20, based on the target category prediction model, by performing vertical federated prediction interaction with the second device, sample category prediction is performed on the representation of the sample to be predicted, and a target category prediction result corresponding to the sample to be predicted is obtained.
[0127] In this embodiment, based on the target category prediction model, by performing vertical federated prediction interaction with the second device, sample category prediction is performed on the representation of the sample to be predicted, and a target category prediction result corresponding to the sample to be predicted is obtained. Specifically, the representation of the sample to be predicted is input into the target category prediction model, model prediction is performed on the representation of the sample to be predicted, and a first category prediction result is obtained. The first category prediction result is then homomorphically encrypted to obtain a first encrypted category prediction result, and the first encrypted category prediction result is then sent to a federal server, and the federal server receives the first encrypted category prediction result and the second encrypted category prediction result sent by the second device, wherein the encrypted category prediction result is generated by the second device for the second category The second category prediction result is obtained by homomorphically encrypting the second prediction result, and the second category prediction result is generated by the second device inputting the second party's sample to be predicted into its own target category prediction model to perform model prediction. The second party's sample to be predicted is an aligned sample with the same public sample ID as the sample to be predicted. Then the federal server aggregates the first encrypted category prediction result and the second encrypted category prediction result based on a preset aggregation rule to obtain an encrypted aggregate category prediction result, wherein the preset aggregation rule includes weighted summation and weighted average, etc., and then the first device receives the encrypted aggregate category prediction result, decrypts the encrypted aggregate category prediction result, obtains an aggregate category prediction result, and uses the aggregate category prediction result as the target category prediction result.
[0128] Wherein, before the step of performing sample category prediction on the representation of the sample to be predicted by performing vertical federated prediction interaction with the second device based on the target category prediction model to obtain the target category prediction result corresponding to the sample to be predicted, the sample category prediction method further includes:
[0129] Step H10, obtaining a prediction model to be trained, and extracting first-party overlapping samples and first-party non-overlapping samples based on a sample alignment result associated with the second device;
[0130] In this embodiment, it should be noted that the prediction model to be trained includes a feature extraction model and a category prediction model, wherein the feature extraction model is a machine learning model for feature extraction, which can map samples into sample representations in a latent space, wherein the sample representation is an encoding vector representing the sample, and the category prediction model is a machine learning model for predicting the category of the sample. The first device is a label provider for vertical federated learning, and the second device is a feature provider for vertical federated learning, wherein the label provider is a participant who provides samples with sample labels in vertical federated learning, and the feature provider is a participant who provides samples without sample labels in vertical federated learning.
[0131] In addition, it should be noted that before performing the step of obtaining the first-party overlapping samples and the first-party non-overlapping samples in the sample alignment result with the second device, the first device and the second device perform sample alignment, that is, the first device and the second device compare their respective sample IDs to determine the common sample ID between the first device and the second device, and obtain the sample alignment result, wherein the sample alignment result includes at least one common sample ID.
[0132] Obtain a prediction model to be trained, and based on the sample alignment result associated with the second device, extract first-party overlapping samples and first-party non-overlapping samples. Specifically, obtain a prediction model to be trained, and based on each public sample ID in the sample alignment result associated with the second device, wherein the public sample ID is an identity identifier of overlapping samples between the first device and the second device, for example, the public sample ID may be a mobile phone number or an ID card number, and then based on each public sample ID, extract first-party overlapping samples and a preset number of first-party non-overlapping samples, wherein the first-party overlapping samples are samples in the first device having the public sample ID, and the first-party non-overlapping samples are samples in the first device that do not have the public sample ID.
[0133] Step H20, based on the first-party overlapping samples and the first-party non-overlapping samples, performing contrastive learning interaction through a preset second device, combining the second-party overlapping samples in the second device, and generating a contrastive learning loss corresponding to the feature extraction model in the prediction model to be trained;
[0134] In this embodiment, based on the first-party overlapping samples and the first-party non-overlapping samples, a comparative learning interaction is performed by presetting a second device, and the second-party overlapping samples in the second device are combined to generate a comparative learning loss corresponding to the feature extraction model in the prediction model to be trained. Specifically, the first-party overlapping samples are input into the feature extraction model, and feature extraction is performed on the first-party overlapping samples to map the first-party overlapping samples to a first-party overlapping sample representation, and each first-party non-overlapping sample is input into the feature extraction model, and feature extraction is performed on each first-party non-overlapping sample to map each first-party non-overlapping sample to a first-party non-overlapping sample representation, and then the second-party overlapping sample representation sent by the second device is received, wherein the second-party overlapping sample representation is a representation generated by the second device by extracting features from the second-party overlapping samples based on its own feature extraction model, and the second-party overlapping samples are second-party overlapping samples. The device uses the samples with the same public sample ID as the first-party overlapping samples, and then uses the first-party overlapping sample representation as a positive example of the second-party overlapping sample representation, and uses the first-party very overlapping sample representation as a negative example of the second-party overlapping sample representation, calculates the contrastive learning loss, and then sends the first-party overlapping sample representation to the second device, so that the second device uses the second-party overlapping sample representation as a positive example of the first-party overlapping sample representation, and uses the second-party non-overlapping sample representation as a negative example of the first-party overlapping sample representation, and calculates the second-party contrastive learning loss, wherein the second-party non-overlapping sample representation is a representation generated by the second device based on its own feature extraction model to extract features from the second-party non-overlapping samples, and the second-party non-overlapping samples are samples in the second device that do not have a public sample ID, wherein the specific process of generating the contrastive learning loss can refer to the specific process in steps S21 to S23.
[0135] Step H30, based on the first-party overlapping samples and preset sample labels, by performing federated learning with the second device, combined with the second-party overlapping samples, iteratively training the prediction model to be trained, and generating a category prediction loss;
[0136] In this embodiment, it should be noted that the preset sample label is a preset label of the first-party overlapping sample, which is used to identify the first-party overlapping sample, for example, to identify the category, purpose and identity information of the first-party overlapping sample.
[0137] Based on the first-party overlapping samples and preset sample labels, the prediction model to be trained is iteratively trained in conjunction with the second-party overlapping samples through federated learning with the second device to generate a category prediction loss. Specifically, the first-party overlapping sample representation corresponding to the first-party overlapping samples generated by the feature extraction model is obtained, and then the first-party overlapping sample representation is input into the category prediction model to perform model prediction to generate a first category prediction result, and the first category prediction result is homomorphically encrypted to generate a first encrypted category prediction result, and then the first encrypted category prediction result is aggregated with the second encrypted category prediction result sent by the second device to generate an aggregated encrypted category prediction result, wherein the second encrypted category prediction result is generated by the second device performing homomorphic encryption on the generated second category prediction result, and the second category prediction result is generated by the second device performing model prediction on the second-party overlapping sample representation using its own second-party feature extraction model and the second-party category prediction model, and then based on the aggregated encrypted category prediction result and The method comprises the following steps: first, calculating the encrypted category prediction loss based on the preset sample label of the homomorphic encryption, and then calculating the encrypted category prediction loss based on the encrypted label loss and the first-party overlapping sample, and sending the encrypted category prediction loss to the federal server for the federal server to decrypt the encrypted category prediction loss to obtain the category prediction loss, and then receiving the category prediction loss sent by the federal server. In addition, the encrypted category prediction loss is sent to the second device for the second device to calculate the second-party encrypted category prediction loss based on the encrypted category prediction loss and the second-party overlapping sample, and sending the second-party encrypted category prediction loss to the federal server for the federal server to decrypt the second-party encrypted category prediction loss to obtain the second-party category prediction loss, and then the second device receives the second-party category prediction loss sent by the federal server. It should be noted that the public key of the homomorphic encryption exists in the first device and the second device, and the private key of the homomorphic encryption exists in the federal server. In a specific implementation manner, reference can be made to Figure 3 The process of interaction between the first device, the second device, and the federated server generates a category prediction loss, Figure 3 The specific interaction process can refer to the content in step A10, which will not be repeated here.
[0138] Step H40, based on the contrastive learning loss and the category prediction loss, optimize the feature extraction model and the category prediction model in the prediction model to be trained to obtain the target feature extraction model and the target category prediction model.
[0139] In this embodiment, based on the contrastive learning loss and the category prediction loss, the feature extraction model and the category prediction model in the prediction model to be trained are optimized to obtain the target feature extraction model and the target category prediction model. Specifically, based on the contrastive learning loss, the contrastive learning loss gradient is calculated, and then based on the category prediction loss, the model parameters of the category prediction model are optimized and updated, and based on the contrastive learning loss gradient and the category prediction loss gradient generated based on the category prediction loss, the model parameters of the feature extraction model are jointly optimized and updated, and then it is determined whether the optimized and updated feature extraction model and the optimized and updated category prediction model both meet the preset iterative training end condition. If both meet, the optimized and updated feature extraction model and the optimized and updated category prediction model are used as the target prediction model together. If both do not meet, the step of extracting the first-party overlapping samples and the first-party non-overlapping samples based on the sample alignment result associated with the second device is returned, wherein it is required It should be noted that if the feature extraction model is not optimized based on contrastive learning, the feature extraction model is more likely to generate similar or identical sample representations for different types of samples, thereby resulting in poor model effect of the category prediction model, that is, the sample category prediction accuracy of the category prediction model with the feature extraction model is low. The embodiment of the present application utilizes the second-party overlapping samples in the second device to increase the distance between the feature extraction results of the feature extraction model for the first-party overlapping samples and the feature extraction results for the first-party non-overlapping samples, thereby giving the feature extraction model the ability to distinguish different types of samples, so that the similarity of the sample representations generated by the feature extraction model for different types of samples is extremely low, thereby improving the model effect of the category prediction model, that is, improving the category prediction accuracy of the category prediction model with the feature extraction model. The specific refinement process of step H40 can refer to the specific contents of steps A21 to A22, which will not be repeated here.
[0140] The embodiment of the present application provides a sample category prediction method, that is, obtaining a sample to be predicted, and based on a target feature extraction model, extracting features from the sample to be predicted, and obtaining a sample representation to be predicted corresponding to the sample to be predicted, wherein, since the target feature extraction model is constructed based on comparative learning and federated learning of first-party overlapping samples and first-party non-overlapping samples in a first device and second-party overlapping samples in a second device, the feature extraction model has the ability to distinguish different types of samples, so that the similarity of sample representations generated by the feature extraction model for different types of samples is extremely low, avoiding the feature extraction model from having a high probability of generating similar or identical sample representations for different types of samples, and improving the accuracy of the sample representation in representing the sample, and then based on the target category prediction model, through vertical federated prediction interaction with the second device, predicting the sample category of the sample representation to be predicted, achieving the purpose of predicting the sample category based on a more accurate sample representation corresponding to the sample, and then obtaining a target category prediction result corresponding to the sample to be predicted, overcoming the technical defect of inaccurate sample category prediction due to the high probability of the feature extraction model generating similar or identical sample representations for different types of samples, and improving the accuracy of sample category prediction.
[0141] Reference Figure 6 , Figure 6 It is a schematic diagram of the device structure of the hardware operating environment involved in the embodiment of the present application.
[0142] like Figure 6 As shown, the model building optimization device may include: a processor 1001, such as a CPU, a memory 1005, and a communication bus 1002. The communication bus 1002 is used to realize the connection and communication between the processor 1001 and the memory 1005. The memory 1005 may be a high-speed RAM memory or a stable memory (non-volatile memory), such as a disk memory. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.
[0143] Optionally, the model building optimization device may also include a rectangular user interface, a network interface, a camera, an RF (Radio Frequency) circuit, a sensor, an audio circuit, a WiFi module, etc. The rectangular user interface may include a display screen (Display), an input submodule such as a keyboard (Keyboard), and the optional rectangular user interface may also include a standard wired interface and a wireless interface. The network interface may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface).
[0144] Those skilled in the art will understand that Figure 6The structure of the model building optimization device shown in the figure does not constitute a limitation of the model building optimization device, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.
[0145] like Figure 6 As shown, the memory 1005 as a computer storage medium may include an operating system, a network communication module, and a model building optimization program. The operating system is a program that manages and controls the hardware and software resources of the model building optimization device, and supports the operation of the model building optimization program and other software and / or programs. The network communication module is used to realize the communication between the components inside the memory 1005, and the communication with other hardware and software in the model building optimization system.
[0146] exist Figure 6 In the model building optimization device shown, the processor 1001 is used to execute the model building optimization program stored in the memory 1005 to implement the steps of any of the above-mentioned model building optimization methods.
[0147] The specific implementation methods of the model building optimization device of the present application are basically the same as the embodiments of the above-mentioned model building optimization method, and will not be repeated here.
[0148] Reference Figure 7 , Figure 7 It is a schematic diagram of the device structure of the hardware operating environment involved in the embodiment of the present application.
[0149] like Figure 7 As shown, the sample category prediction device may include: a processor 1001, such as a CPU, a memory 1005, and a communication bus 1002. The communication bus 1002 is used to realize the connection and communication between the processor 1001 and the memory 1005. The memory 1005 may be a high-speed RAM memory or a stable memory (non-volatile memory), such as a disk memory. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.
[0150] Optionally, the sample category prediction device may also include a rectangular user interface, a network interface, a camera, an RF (Radio Frequency) circuit, a sensor, an audio circuit, a WiFi module, etc. The rectangular user interface may include a display screen (Display), an input submodule such as a keyboard (Keyboard), and the optional rectangular user interface may also include a standard wired interface and a wireless interface. The network interface may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface).
[0151] Those skilled in the art will understand that Figure 7The sample category prediction device structure shown in the figure does not constitute a limitation on the sample category prediction device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0152] like Figure 7 As shown, the memory 1005 as a computer storage medium may include an operating system, a network communication module, and a sample category prediction program. The operating system is a program that manages and controls the hardware and software resources of the sample category prediction device, and supports the operation of the sample category prediction program and other software and / or programs. The network communication module is used to realize the communication between the components inside the memory 1005, and the communication with other hardware and software in the sample category prediction system.
[0153] exist Figure 7 In the sample category prediction device shown, the processor 1001 is used to execute the sample category prediction program stored in the memory 1005 to implement the steps of any of the sample category prediction methods described above.
[0154] The specific implementation of the sample category prediction device of the present application is basically the same as the various embodiments of the above-mentioned sample category prediction method, and will not be repeated here.
[0155] The embodiment of the present application further provides a model building optimization device, which is applied to a first device and includes:
[0156] an acquisition module, configured to acquire a feature extraction model and extract first-party overlapping samples and first-party non-overlapping samples based on a sample alignment result associated with a second device;
[0157] A contrastive learning module, configured to generate a contrastive learning loss corresponding to the feature extraction model based on the first-party overlapping samples and the first-party non-overlapping samples, by performing contrastive learning interaction with the second device, and combining the second-party overlapping samples in the second device;
[0158] An optimization module is used to optimize the feature extraction model based on the contrastive learning loss to obtain a target feature extraction model.
[0159] Optionally, the model building optimization device is also used for:
[0160] Based on the first-party overlapping samples and preset sample labels, by performing federated learning with a second device, combined with the second-party overlapping samples, iteratively training the prediction model to be trained including the feature extraction model, and generating a category prediction loss;
[0161] Based on the contrastive learning loss and the category prediction loss, the prediction model to be trained is optimized to obtain a target prediction model.
[0162] Optionally, the model building optimization device is also used for:
[0163] Based on the category prediction loss, optimizing the category prediction model to obtain the target category prediction model;
[0164] Based on the contrastive learning loss and the category prediction loss, the feature extraction model is asynchronously optimized to obtain the target feature extraction model.
[0165] Optionally, the contrastive learning module is further used for:
[0166] Based on the feature extraction model, mapping the first-party overlapping samples to first-party overlapping sample representations, and mapping the first-party non-overlapping samples to first-party non-overlapping sample representations;
[0167] Sending the first-party overlapping sample representation to the second device, so that the second device calculates a second-party contrastive learning loss based on the first-party overlapping sample representation, the generated second-party overlapping sample representation, and the second-party non-overlapping sample representation;
[0168] The second-party overlapping sample representation is received, and the contrastive learning loss corresponding to the feature extraction model is generated by using the first-party overlapping sample representation as the positive sample representation corresponding to the second-party overlapping sample representation, and by using the first-party non-overlapping sample representation as the negative sample representation corresponding to the second-party overlapping sample representation.
[0169] Optionally, the model building optimization device is also used for:
[0170] Acquire a sample to be predicted, and extract features from the sample to be predicted based on the target feature extraction model to obtain a sample representation to be predicted corresponding to the sample to be predicted, wherein the target feature extraction model is constructed by performing comparative learning and federated learning based on first-party overlapping samples and first-party non-overlapping samples in the first device and second-party overlapping samples in the second device;
[0171] Based on the target category prediction model, by performing vertical federated prediction interaction with the second device, the model prediction is performed on the representation of the sample to be predicted to obtain a target category prediction result corresponding to the sample to be predicted.
[0172] The specific implementation of the model building optimization device of the present application is basically the same as the various embodiments of the above-mentioned model building optimization method, and will not be repeated here.
[0173] The embodiment of the present application further provides a model building optimization device, which is applied to a second device and includes:
[0174] A feature extraction module, used to obtain a second-party feature extraction model and second-party overlapping samples, and map the second-party overlapping samples to second-party overlapping sample representations based on the second-party feature extraction model;
[0175] The sending module is used to send the second-party overlapping sample representation to the first device, so that the first device calculates the contrastive learning loss based on the second-party overlapping sample representation, the generated first-party overlapping sample representation and the generated first-party non-overlapping sample representation.
[0176] Optionally, the model building optimization device is also used for:
[0177] Acquire second-party non-overlapping samples, and map the second-party non-overlapping samples to second-party non-overlapping sample representations based on the second-party feature extraction model;
[0178] receiving a first-party overlapping sample representation sent by a first device, and generating a second-party contrastive learning loss of the second-party feature extraction model by using the second-party overlapping sample representation as a second-party positive sample representation of the first-party overlapping sample representation, and by using the second-party non-overlapping sample representation as a second-party negative sample representation of the first-party overlapping sample representation;
[0179] Based on the second-party contrastive learning loss, the second-party feature extraction model is optimized to obtain a second-party target feature extraction model.
[0180] Optionally, the model building optimization device is also used for:
[0181] Based on the second-party overlapping samples, by performing federated learning with the first device, combining the first-party overlapping samples and preset sample labels in the first device, iteratively training the second-party prediction model to be trained with the second-party feature extraction model, and generating a second-party category prediction loss;
[0182] Based on the second-party category prediction loss and the second-party contrastive learning loss, the second-party prediction model to be trained is optimized to obtain a second-party target prediction model.
[0183] The specific implementation of the model building optimization device of the present application is basically the same as the various embodiments of the above-mentioned model building optimization method, and will not be repeated here.
[0184] The embodiment of the present application further provides a sample category prediction device, which is applied to a second device and includes:
[0185] A feature extraction module, used to obtain a sample to be predicted, and based on a target feature extraction model, perform feature extraction on the sample to be predicted to obtain a sample representation to be predicted corresponding to the sample to be predicted, wherein the target feature extraction model is constructed by performing comparative learning and federated learning based on first-party overlapping samples and first-party non-overlapping samples in the first device and second-party overlapping samples in the second device;
[0186] The sample category prediction module is used to perform sample category prediction on the representation of the sample to be predicted based on the target category prediction model, by performing vertical federated prediction interaction with the second device, to obtain a target category prediction result corresponding to the sample to be predicted.
[0187] Optionally, the sample category prediction device is further used for:
[0188] Obtaining a prediction model to be trained, and extracting first-party overlapping samples and first-party non-overlapping samples based on a sample alignment result associated with the second device;
[0189] Based on the first-party overlapping samples and the first-party non-overlapping samples, performing contrastive learning interaction through a preset second device, and combining the second-party overlapping samples in the second device to generate a contrastive learning loss corresponding to the feature extraction model in the prediction model to be trained;
[0190] Based on the first-party overlapping samples and preset sample labels, by performing federated learning with a second device, combined with the second-party overlapping samples, iteratively training the prediction model to be trained to generate a category prediction loss;
[0191] Based on the contrastive learning loss and the category prediction loss, the feature extraction model and the category prediction model in the prediction model to be trained are optimized to obtain the target feature extraction model and the target category prediction model.
[0192] Optionally, the sample category prediction device is further used for:
[0193] Based on the feature extraction model, mapping the first-party overlapping samples to first-party overlapping sample representations, and mapping the first-party non-overlapping samples to first-party non-overlapping sample representations;
[0194] receiving the second overlapping sample representation sent by the second device, and generating the contrastive learning loss corresponding to the feature extraction model by taking the first overlapping sample representation as the positive sample representation corresponding to the second overlapping sample representation, and by taking the first non-overlapping sample representation as the negative sample representation corresponding to the second overlapping sample representation;
[0195] Based on the contrastive learning loss, the feature extraction model is optimized to obtain the target feature extraction model.
[0196] The specific implementation of the sample category prediction device of the present application is basically the same as the various embodiments of the above-mentioned sample category prediction method, and will not be repeated here.
[0197] An embodiment of the present application provides a medium, which is a readable storage medium, and the readable storage medium stores one or more programs, and the one or more programs can also be executed by one or more processors to implement the steps of any of the above-mentioned model building optimization methods.
[0198] The specific implementation of the readable storage medium of the present application is basically the same as the embodiments of the above-mentioned model building optimization method, and will not be repeated here.
[0199] An embodiment of the present application also provides a medium, which is a readable storage medium, and the readable storage medium stores one or more programs, and the one or more programs can also be executed by one or more processors to implement the steps of any of the sample category prediction methods described above.
[0200] The specific implementation of the readable storage medium of the present application is basically the same as the above-mentioned embodiments of the sample category prediction method, and will not be repeated here.
[0201] An embodiment of the present application provides a computer program product, and the computer program product includes one or more computer programs, and the one or more computer programs can also be executed by one or more processors to implement the steps of any of the above-mentioned model building optimization methods.
[0202] The specific implementation methods of the computer program product of the present application are basically the same as the embodiments of the above-mentioned model building optimization method, and will not be repeated here.
[0203] An embodiment of the present application further provides a computer program product, and the computer program product includes one or more computer programs, and the one or more computer programs can also be executed by one or more processors to implement the steps of any of the above-mentioned sample category prediction methods.
[0204] The specific implementation of the computer program product of the present application is basically the same as the various embodiments of the above-mentioned sample category prediction method, and will not be repeated here.
[0205] The above are only preferred embodiments of the present application, and are not intended to limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent processing scope of the present application.
Claims
1. A model building optimization method, applied in the field of financial technology, characterized in that: The model building optimization method is applied to a first device, and the model building optimization method includes: Acquire a feature extraction model, and extract first-party overlapping samples and first-party non-overlapping samples based on a sample alignment result associated with the second device, wherein the first-party overlapping samples include category, purpose, and identity information, and the sample alignment result includes at least one public sample ID, and the public sample ID is a mobile phone number and an ID card number; Based on the first-party overlapping samples and the first-party non-overlapping samples, by performing contrastive learning interaction with the second device, combined with the second-party overlapping samples in the second device, generating a contrastive learning loss corresponding to the feature extraction model, wherein the data exchanged between the first device and the second device during the federated learning process is encrypted using a homomorphic encryption algorithm; Based on the first-party overlapping samples and preset sample labels, by performing federated learning with a second device, combined with the second-party overlapping samples, iteratively training the prediction model to be trained including the feature extraction model, and generating a category prediction loss; Based on the category prediction loss, optimizing the category prediction model to obtain a target category prediction model; Based on the contrastive learning loss and the category prediction loss, the feature extraction model is asynchronously optimized to obtain a target feature extraction model, wherein the target prediction model includes a target feature extraction model and a target category prediction model.
2. The model building optimization method according to claim 1, characterized in that: The step of generating a contrastive learning loss corresponding to the feature extraction model based on the first-party overlapping samples and the first-party non-overlapping samples by performing contrastive learning interaction with the second device and combining the second-party overlapping samples in the second device comprises: Based on the feature extraction model, mapping the first-party overlapping samples to first-party overlapping sample representations, and mapping the first-party non-overlapping samples to first-party non-overlapping sample representations; Sending the first-party overlapping sample representation to the second device, so that the second device calculates a second-party contrastive learning loss based on the first-party overlapping sample representation, the generated second-party overlapping sample representation, and the second-party non-overlapping sample representation; The second-party overlapping sample representation is received, and the contrastive learning loss corresponding to the feature extraction model is generated by using the first-party overlapping sample representation as the positive sample representation corresponding to the second-party overlapping sample representation, and by using the first-party non-overlapping sample representation as the negative sample representation corresponding to the second-party overlapping sample representation.
3. The model building optimization method according to claim 1, characterized in that: The target prediction model includes a target feature extraction model and a target category prediction model. After the step of optimizing the prediction model to be trained based on the contrastive learning loss and the category prediction loss to obtain a target prediction model, the model construction optimization method further includes: Acquire a sample to be predicted, and extract features from the sample to be predicted based on the target feature extraction model to obtain a sample representation to be predicted corresponding to the sample to be predicted, wherein the target feature extraction model is constructed by performing comparative learning and federated learning based on first-party overlapping samples and first-party non-overlapping samples in the first device and second-party overlapping samples in the second device; Based on the target category prediction model, by performing vertical federated prediction interaction with the second device, the model prediction is performed on the representation of the sample to be predicted to obtain a target category prediction result corresponding to the sample to be predicted.
4. A model building optimization method, characterized in that: The model building optimization method is applied to the second device, and the model building optimization method includes: Acquire a second-party feature extraction model and second-party overlapping samples, and map the second-party overlapping samples to second-party overlapping sample representations based on the second-party feature extraction model; Sending the second-party overlapping sample representation to the first device, so that the first device calculates the contrastive learning loss based on the second-party overlapping sample representation, the generated first-party overlapping sample representation, and the generated first-party non-overlapping sample representation, wherein the data exchanged between the first device and the second device during the federated learning process is encrypted using a homomorphic encryption algorithm; After the step of mapping the second-party overlapping samples to second-party overlapping sample representations based on the second-party feature extraction model, the model construction optimization method further includes: Acquire second-party non-overlapping samples, and map the second-party non-overlapping samples to second-party non-overlapping sample representations based on the second-party feature extraction model; receiving a first-party overlapping sample representation sent by a first device, and generating a second-party contrastive learning loss of the second-party feature extraction model by using the second-party overlapping sample representation as a second-party positive sample representation of the first-party overlapping sample representation, and by using the second-party non-overlapping sample representation as a second-party negative sample representation of the first-party overlapping sample representation; Based on the second-party contrastive learning loss, the second-party feature extraction model is optimized to obtain a second-party target feature extraction model.
5. The model building optimization method according to claim 4, characterized in that: After the step of generating a second contrastive learning loss of the second-party feature extraction model by using the second-party overlapping sample representation as a positive sample representation of the first-party overlapping sample representation, and by using the second-party non-overlapping sample representation as a negative sample representation of the first-party overlapping sample representation, the model construction optimization method further includes: Based on the second-party overlapping samples, by performing federated learning with the first device, combining the first-party overlapping samples and preset sample labels in the first device, iteratively training the second-party prediction model to be trained with the second-party feature extraction model, and generating a second-party category prediction loss; Based on the second-party category prediction loss and the second-party contrastive learning loss, the second-party prediction model to be trained is optimized to obtain a second-party target prediction model.
6. A sample category prediction method, characterized in that: The sample category prediction method is applied to a first device, and the sample category prediction method includes: Acquire a sample to be predicted, and extract features from the sample to be predicted based on a target feature extraction model to obtain a sample representation to be predicted corresponding to the sample to be predicted, wherein the target feature extraction model is constructed by performing comparative learning and federated learning based on first-party overlapping samples and first-party non-overlapping samples in the first device and second-party overlapping samples in the second device; Based on the target category prediction model, by performing vertical federated prediction interaction with the second device, sample category prediction is performed on the representation of the sample to be predicted, and a target category prediction result corresponding to the sample to be predicted is obtained, wherein the data exchanged between the first device and the second device during the federated learning process is encrypted using a homomorphic encryption algorithm; Wherein, before the step of performing sample category prediction on the representation of the sample to be predicted by performing vertical federated prediction interaction with the second device based on the target category prediction model to obtain the target category prediction result corresponding to the sample to be predicted, the sample category prediction method further includes: Obtaining a prediction model to be trained, and extracting first-party overlapping samples and first-party non-overlapping samples based on a sample alignment result associated with the second device; Based on the first-party overlapping samples and the first-party non-overlapping samples, a contrastive learning interaction is performed by presetting a second device, and the second-party overlapping samples in the second device are combined to generate a contrastive learning loss corresponding to the feature extraction model in the prediction model to be trained, wherein the data interacted during the federated learning between the first device and the second device is encrypted using a homomorphic encryption algorithm; Based on the first-party overlapping samples and preset sample labels, by performing federated learning with a second device, combined with the second-party overlapping samples, iteratively training the prediction model to be trained to generate a category prediction loss; Based on the contrastive learning loss and the category prediction loss, the feature extraction model and the category prediction model in the prediction model to be trained are optimized to obtain the target feature extraction model and the target category prediction model.
7. The sample category prediction method according to claim 6, characterized in that: Before the step of extracting features from the sample to be predicted based on the target feature extraction model to obtain a sample representation to be predicted corresponding to the sample to be predicted, wherein the target feature extraction model is constructed by performing comparative learning and federated learning based on first-party overlapping samples and first-party non-overlapping samples in the first device and second-party overlapping samples in the second device, the sample category prediction method further includes: Based on the feature extraction model, mapping the first-party overlapping samples to first-party overlapping sample representations, and mapping the first-party non-overlapping samples to first-party non-overlapping sample representations; receiving a second overlapping sample representation sent by the second device, and generating a contrastive learning loss corresponding to the feature extraction model by using the first overlapping sample representation as a positive sample representation corresponding to the second overlapping sample representation, and by using the first non-overlapping sample representation as a negative sample representation corresponding to the second overlapping sample representation; Based on contrastive learning loss, the feature extraction model is optimized to obtain the target feature extraction model.
8. A model building optimization device, characterized in that: The model building optimization device includes: a memory, a processor, and a program stored in the memory for implementing the model building optimization method. The memory is used to store a program for implementing a model building optimization method; The processor is used to execute a program for implementing the model building optimization method to implement the steps of the model building optimization method as described in any one of claims 1 to 3 or 4 to 5.
9. A sample category prediction device, characterized in that: The sample category prediction device comprises: a memory, a processor, and a program stored in the memory for implementing the sample category prediction method. The memory is used to store a program for implementing a sample category prediction method; The processor is used to execute a program for implementing the sample category prediction method to implement the steps of the sample category prediction method as claimed in claim 6.
10. A medium, the medium being a readable storage medium, characterized in that: The readable storage medium stores a program for implementing the model building optimization method, and the program for implementing the model building optimization method is executed by a processor to implement the steps of the model building optimization method as described in any one of claims 1 to 3 or 4 to 5.
11. A medium, the medium being a readable storage medium, characterized in that: The readable storage medium stores a program for implementing the sample category prediction method, and the program for implementing the sample category prediction method is executed by a processor to implement the steps of the sample category prediction method according to any one of claims 6 to 7.
12. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the model building optimization method as described in any one of claims 1 to 3 or 4 to 5 are implemented, or when the computer program is executed by a processor, the steps of the sample category prediction method as described in any one of claims 6 to 7 are implemented.
Citation Information
Patent Citations
Longitudinal federated learning method and system based on secret sharing and storage medium
CN111241567A
Training sample construction method, device and equipment and computer readable storage medium
CN111860868A