Calibration Method, Device, Equipment and Medium for Label Data Used in Model Training

By using offline tag data to correct real-time tag data in tag data processing, the problem of high timeliness but low accuracy of real-time tag data is solved, and higher data accuracy and timeliness are achieved.

CN114970742BActive Publication Date: 2025-05-30CHINA PING AN LIFE INSURANCE CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202210682208.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-16
Publication Date
2025-05-30
Estimated Expiration
2042-06-16

AI Technical Summary

Technical Problem

When the timeliness of tag data are high, the accuracy of tag data is low, especially when the amount of data is large, real-time tag data is easily lost or unavailable, resulting in a decrease in accuracy.

Method used

By obtaining real-time tag table and offline tag data, detect the type of offline tag data and determine whether the current time point reaches the preset time point. If the conditions are met, the similarity between the offline tag data and the real-time tag data is calculated. If the maximum similarity meets the preset correction conditions, the real-time tag data is corrected by offline tag data, the correction tag data is obtained and the real-time tag table is updated.

Benefits of technology

While ensuring the timeliness of real-time tag data, it improves the accuracy of real-time tag data, avoids data loss and unavailability issues, and enhances the effect of model training.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114970742B_ABST
    Figure CN114970742B_ABST
Patent Text Reader

Abstract

The present invention relates to the technical field of data processing, and in particular, to a method, apparatus, device, and medium for correcting labeled data for model training. The method obtains a real-time label table and offline label data. When it detects that the type is a real-time type and the current time point reaches a preset time point, it calculates the similarity between the offline label data and each piece of real-time label data in the real-time label table. If the maximum similarity meets the preset correction condition, it corrects the corresponding real-time label data, obtains the corrected label data, and updates the real-time label table. By correcting the real-time label data with the offline label data, while ensuring the timeliness of the real-time label data, the accuracy of the real-time label data is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data processing, and in particular, to a method, device, equipment and medium for correcting label data for model training. Background Art

[0002] At present, with the development of big data technology and artificial intelligence technology, model label data can be divided into real-time label data and offline label data. Offline label data usually refers to label data with a T+1 timeliness, that is, the label data collected on the Tth day can be applied on the (T + 1)th day. Using model label data to dynamically provide label parameters for an artificial intelligence model can effectively improve the accuracy of the artificial intelligence model.

[0003] However, although using offline label data can ensure the accuracy of the model, its timeliness is T+1 timeliness, which is relatively long and will result in poor user experience. While using real-time label data has high timeliness, but when the data volume is large, there will be situations where real-time label data is lost or unavailable, and the accuracy is relatively low. Therefore, how to improve the accuracy of label data under the condition of high timeliness of label data has become an urgent problem to be solved. Summary of the Invention

[0004] In view of this, embodiments of the present invention provide a method, device, equipment and medium for correcting label data for model training to solve the problem of low accuracy of label data under the condition of high timeliness of label data.

[0005] In a first aspect, an embodiment of the present invention provides a method for correcting label data for model training, and the correction method includes:

[0006] Obtain a real-time label table and offline label data, where the real-time label table includes at least one real-time label data;

[0007] Detect the type of the offline label data, and when it is detected that the type is a real-time enabled type, determine whether the current time point reaches a preset time point;

[0008] If the current time point reaches the preset time point, calculate the similarity between the offline label data and each real-time label data in the real-time label table, and detect whether the maximum similarity meets a preset correction condition;

[0009] If the maximum similarity meets the preset correction condition, correct the real-time label data corresponding to the maximum similarity according to the offline label data to obtain corrected label data, and update the real-time label table with the corrected label data.

[0010] In a second aspect, an embodiment of the present invention provides a device for correcting label data for model training, and the correction device includes:

[0011] A data acquisition module, configured to obtain a real-time tag table and offline tag data, where the real-time tag table includes at least one real-time tag data;

[0012] A time point detection module, configured to detect the type of the offline tag data, and when it is detected that the type is a real-time enabled type, determine whether the current time point reaches a preset time point;

[0013] A similarity calculation module, configured to calculate the similarity between the offline tag data and each real-time tag data in the real-time tag table if the current time point reaches the preset time point, and detect whether the maximum similarity meets a preset correction condition;

[0014] A data correction module, configured to correct the real-time tag data corresponding to the maximum similarity according to the offline tag data to obtain corrected tag data if the maximum similarity meets the preset correction condition, and update the real-time tag table with the corrected tag data.

[0015] In a third aspect, an embodiment of the present invention provides a computer device, which includes a processor, a memory, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the correction method described in the first aspect is implemented.

[0016] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the correction method described in the first aspect is implemented.

[0017] The beneficial effects of the embodiments of the present invention compared with the prior art are as follows:

[0018] Obtain a real-time tag table and offline tag data. The real-time tag table includes at least one real-time tag data. Detect the type of the offline tag data. When it is detected that the type is a real-time enabled type, determine whether the current time point reaches a preset time point. If the current time point reaches the preset time point, calculate the similarity between the offline tag data and each real-time tag data in the real-time tag table, and detect whether the maximum similarity meets a preset correction condition. If the maximum similarity meets the preset correction condition, correct the real-time tag data corresponding to the maximum similarity according to the offline tag data to obtain corrected tag data, and update the real-time tag table with the corrected tag data. The real-time tag data is corrected by using the offline tag data of the real-time enabled type, which improves the accuracy of the real-time tag data while ensuring the timeliness of the real-time tag data. Description of the Drawings

[0019] To more clearly illustrate the technical solutions in the embodiments of the present invention, the following will briefly introduce the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.

[0020] Figure 1 It is a schematic diagram of an application environment of a method for correcting label data for model training provided in Embodiment 1 of the present invention;

[0021] Figure 2 It is a schematic flowchart of a method for correcting label data for model training provided in Embodiment 1 of the present invention;

[0022] Figure 3 It is a schematic flowchart of a method for correcting label data for model training provided in Embodiment 2 of the present invention;

[0023] Figure 4 It is a schematic structural diagram of a device for correcting label data for model training provided in Embodiment 3 of the present invention;

[0024] Figure 5 It is a schematic structural diagram of a computer device provided in Embodiment 4 of the present invention. Detailed implementation manners

[0025] In the following description, for the purpose of illustration rather than limitation, specific details such as specific system structures and technologies are presented to thoroughly understand the embodiments of the present invention. However, those skilled in the art should clearly understand that the present invention can also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to avoid unnecessary details from interfering with the description of the present invention.

[0026] It should be understood that when used in the specification and the appended claims of the present invention, the term "comprising" indicates the presence of the described features, wholes, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components, and / or their combinations.

[0027] It should also be understood that the term " / and" as used in the specification and the appended claims of the present invention refers to any combination and all possible combinations of one or more of the associated listed items, and includes these combinations.

[0028] As used in the specification of the present invention and the appended claims, the term "if" can be interpreted as "when" or "once" or "in response to determining" or "in response to detecting" depending on the context. Similarly, the phrase "if determined" or "if [the described condition or event] is detected" can be interpreted as meaning "once determined" or "in response to determining" or "once [the described condition or event] is detected" or "in response to detecting [the described condition or event]" depending on the context.

[0029] In addition, in the description of the specification of the present invention and the appended claims, the terms "first", "second", "third", etc. are only used for distinguishing descriptions and cannot be understood as indicating or implying relative importance.

[0030] Reference to "one embodiment" or "some embodiments" or the like described in the specification of the present invention means that a specific feature, structure, or characteristic described in connection with that embodiment is included in one or more embodiments of the present invention. Thus, statements such as "in one embodiment", "in some embodiments", "in other some embodiments", "in still other embodiments", etc. that appear in different places in this specification do not necessarily all refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "comprising", "including", "having" and their variants all mean "including but not limited to", unless otherwise specifically emphasized in other ways.

[0031] It should be understood that the magnitudes of the sequence numbers of the steps in the following embodiments do not mean the order of execution is prior or subsequent. The execution order of each process should be determined according to its function and internal logic, and should not constitute any limitation to the implementation process of the embodiments of the present invention.

[0032] In order to illustrate the technical solution of the present invention, the following specific embodiments are used for illustration.

[0033] A method for correcting label data for model training provided in the first embodiment of the present invention can be applied in an application environment such as Figure 1 where the client communicates with the server. Among them, the client includes but is not limited to computer devices such as a palm computer, a desktop computer, a laptop computer, an ultra-mobile personal computer (UMPC), a netbook, a cloud terminal device, a personal digital assistant (PDA), etc. The server can be implemented by an independent server or a server cluster composed of multiple servers.

[0034] See Figure 2, which is a schematic flowchart of a method for correcting labeled data for model training provided in the first embodiment of the present invention. The above correction method can be applied to Figure 1 the client in. The client accesses the server to obtain a real-time label table and offline label data. The real-time label table is composed of real-time label data. The server has a storage function and can store real-time label data and offline label data. As Figure 2 shown, the correction method may include the following steps:

[0035] Step S201, obtain a real-time label table and offline label data.

[0036] Among them, the real-time label table is composed of real-time label data. The real-time label table includes at least one real-time label data. The real-time label data may refer to label data generated by real-time operations. The offline label data may refer to label data stored in a database. The label data may include demographic attributes and behavioral characteristics, etc. The demographic attributes may include the user's age, gender, province and city where they are located, education level, marital status, fertility status, industry and occupation where they work, etc. The behavioral characteristics may include the user's activity and loyalty to the product, etc.

[0037] Specifically, usually the timeliness of real-time label data is T+0 timeliness. T+0 timeliness means that the label data can be directly used on the Tth day after being collected on the Tth day, while the timeliness of offline label data includes T+0 timeliness and T+1 timeliness. T+1 timeliness means that the label data needs to be used on the (T + 1)th day after being collected on the Tth day.

[0038] The real-time label data is obtained and stored from the message queue. The message queue may refer to a distributed publish-subscribe message system (such as Kafka), MQ (Message Queue), etc. Specifically, after the messages in the message queue are consumed by the processing framework, the information is inserted into the real-time label table in the database as real-time label data. The processing framework may refer to a stream processing framework, such as the flink framework. Consumption may refer to the process of data processing on the messages, such as data cleaning, data screening, data sorting, etc. The database is deployed on the server side. The database may refer to a distributed database, such as the Hbase database.

[0039] After the offline label data is collected, tools such as OGG (Oracle GoldenGate) and Sqoop are used to process the offline label data. OGG can be used for capturing, transforming, and delivering large amounts of data. Sqoop can be used for data transfer, and the processed offline label data is synchronized to the data warehouse of the server. The data warehouse may refer to hive, etc. The data warehouse can be used for data extraction, transformation, and loading.

[0040] The above steps of obtaining the real-time label table and offline label data provide rich label data for model training, and provide real-time label data with strong timeliness and offline label data with high accuracy for subsequent label data correction.

[0041] Step S202: Detect the type of the offline label data. When it is detected that the type is a real-time enabled type, determine whether the current time point reaches the preset time point.

[0042] Among them, the offline label data includes the data type, and the data type can refer to the basic attribute of the offline label data. The data type can include a real-time enabled type and a non-real-time enabled type. The real-time enabled type can refer to the timeliness of the offline label data being T+0 timeliness, and the non-real-time enabled type can refer to the timeliness of the offline label data being T+1 timeliness.

[0043] The current time point can refer to the actual time point when the model training process requests label data, and the preset time point can refer to the time point set manually at the start of the label data correction process.

[0044] Specifically, in this embodiment, the preset time point is set to 24:00 every day. The purpose of setting the preset time point is to ensure that when the model training process requests label data at any time point, label data with strong timeliness and high accuracy can be obtained.

[0045] For example, if the model training process requests label data before 24:00 on the target day, real-time label data of the target day and corrected real-time label data of the day before the target day can be obtained; if the model training process requests label data after 24:00 on the target day, corrected real-time label data of the target day can be obtained.

[0046] It should be noted that in this embodiment, after the model training process requests label data at any time point on the target day, the obtained label data can be the real-time label data of the target day and the real-time label data of the day before the target day, and the real-time label data of the day before the target day has been corrected by the offline label data, so as to avoid the situation that when requesting label data near 0:00 on the target day, the real-time label data of the target day has not been collected or only a small amount of real-time label data of the target day has been collected, resulting in the abnormal execution of the model training process.

[0047] In one implementation manner, after the model training process requests label data at any time point on the target day, the obtained label data can be the real-time label data of the target day, the real-time label data of the day before the target day, and the offline label data, or can also be the real-time label data of the target day and the offline label data. Obtaining the offline label data at the same time can effectively improve the richness of the label data, and further improve the model training effect.

[0048] For the above-mentioned types of offline label data, when the detected type is a type that can be made real-time, the step of determining whether the current time point reaches the preset time point. After reaching the preset time point, using the offline label data to correct the real-time label data can improve the accuracy of the real-time label data, and at each time point, label data with strong timeliness and high accuracy can be provided for model training.

[0049] Step S203, if the current time point reaches the preset time point, calculate the similarity between the offline label data and each real-time label data in the real-time label table, and detect whether the maximum similarity meets the preset correction condition.

[0050] Among them, the similarity can refer to metric values such as cosine similarity and Euclidean distance. The maximum similarity can refer to the maximum value among the N similarities calculated between N real-time label data and the offline label data, where N is an integer greater than zero.

[0051] The preset correction condition can refer to the condition that the maximum similarity is greater than the maximum similarity threshold. The maximum similarity threshold is used to determine whether the real-time label data and the offline label data are similar, and the maximum similarity threshold is usually set manually.

[0052] Specifically, in this embodiment, the cosine similarity is used as the similarity. The calculation method of the cosine similarity is: Where P is the offline label data, Q is the real-time label data, and Q n is the nth real-time label data, n is an integer and the value range of n is [1, N], |P| is the modulus of the offline label data, and |Q n | is the modulus of the real-time label data, and cos(P, Q n ) represents the similarity calculated between the offline label data and the nth real-time label data. Then the value range of the similarity is [0, 1], 0 means completely dissimilar, 1 means completely similar, and the larger the value of the cosine similarity, the more similar it is. The maximum similarity threshold is set to 0.8, and the implementer can adjust this maximum similarity threshold according to the actual situation.

[0053] Due to the poor calculation and conversion efficiency of real-time label data, in the case of a large amount of data, there may be data missing in the real-time label data. Such a situation leads to low accuracy of the real-time label data. In the process of using the offline label data to correct the real-time label data in this embodiment, the missing part in the real-time label data is filled with the corresponding part of the offline label data. Therefore, it is necessary to ensure that the real-time label data and the offline label data used for correction are the same data, that is, when the real-time label data and the offline label data are similar enough, the real-time label data and the offline label data are recognized as the same label data, and the offline label data is used to correct the corresponding real-time label data.

[0054] Optionally, the real-time tag data corresponds to a real-time timestamp;

[0055] After the current time point reaches the preset time point, it further includes:

[0056] Configuring the offline tag data as a preset timestamp;

[0057] Detecting whether the real-time timestamp corresponding to each real-time tag data in the real-time tag table is less than the preset timestamp;

[0058] Accordingly, calculating the similarity between the offline tag data and each real-time tag data in the real-time tag table includes:

[0059] Determining the real-time tag data with a real-time timestamp less than the preset timestamp as the target tag data;

[0060] Calculating the similarity between the offline tag data and each target tag data in the real-time tag table.

[0061] Wherein, the real-time timestamp may refer to the time point mark when the real-time tag data is collected, the preset timestamp may refer to the time point mark set artificially, and the target tag data may refer to the real-time tag data that needs to be corrected.

[0062] Specifically, the preset timestamp is set to one millisecond before 24:00, to ensure that the timestamp of the offline tag data is greater than the real-time timestamp of any real-time tag data on the target day.

[0063] Since the preset time point in this embodiment is 24:00 on the target day, there is not enough offline tag data to correct the real-time tag data collected after 24:00 on the target day. Therefore, after 24:00 on the target day, the real-time tag data before 24:00 on the target day is corrected with the offline tag data, and the real-time tag data before 24:00 on the target day is the real-time tag data corresponding to the real-time timestamp less than the preset timestamp.

[0064] This embodiment determines the real-time tag data that needs to be corrected by the timestamp, avoiding the situation of incorrect correction, and further ensuring the accuracy of the real-time tag data.

[0065] In the above steps, if the current time point reaches the preset time point, then calculate the similarity between the offline tag data and each real-time tag data in the real-time tag table, and detect whether the maximum similarity meets the preset correction condition. Only when the real-time tag data and the offline tag data are similar enough, the real-time tag data is corrected, ensuring the accuracy of the tag data correction and avoiding the situation of abnormal data after correction.

[0066] Step S204: If the maximum similarity meets the preset correction condition, correct the real-time tag data corresponding to the maximum similarity according to the offline tag data to obtain corrected tag data, and update the real-time tag table with the corrected tag data.

[0067] In this embodiment, correction may refer to using the offline tag data to supplement the missing part in the real-time tag data. Correspondingly, the tag data obtained after supplementation is the corrected tag data.

[0068] In this embodiment, update may refer to inserting the corrected tag data into the real-time tag table as the real-time tag data.

[0069] Specifically, for the real-time tag data with missing information, correcting it by supplementation can maximize the retention of the original information of the real-time tag data, avoiding the situation where the information that is not missing in the real-time tag data is changed, thereby improving the authenticity of the real-time tag data.

[0070] In one embodiment, correction may refer to directly replacing the real-time tag data with the offline tag data. Correspondingly, the offline tag data is the corrected tag data. This method has a simple process and high correction efficiency, and is suitable for scenarios with a large correction task.

[0071] In one embodiment, update may refer to replacing the corresponding real-time tag data with the corrected tag data in the real-time tag table.

[0072] Optionally, updating the real-time tag table with the corrected tag data includes:

[0073] Configuring the corrected tag data as a preset timestamp;

[0074] Updating the real-time tag table with the corrected tag data according to the preset timestamp.

[0075] Among them, the preset timestamp may refer to a time point mark set artificially. In this embodiment, the preset timestamp is set to one millisecond before 24:00.

[0076] Specifically, inserting the corrected tag data into the real-time tag table according to the preset timestamp completes the update of the real-time tag table. Since there may be repeated acquisitions of real-time tag data, to avoid reading the same tag data, which may lead to sample bias in the model training process, that is, the same sample is repeated, resulting in inconsistent impacts of samples on model training. In this embodiment, the timestamp is used to determine the content to be read. That is, for the real-time tag data with a high similarity, only the real-time tag data with the largest timestamp is read. Here, the corrected tag data is set as the preset timestamp, aiming to ensure that the corrected tag data will not be overwritten when being read.

[0077] The judgment of high similarity of real-time tag data can adopt a threshold method. In this embodiment, the similarity threshold is set to 0.95. If the similarity between any two real-time tag data is greater than 0.95, then the real-time tag data with the larger timestamp is retained, and the other real-time tag data is discarded, so as to avoid the mutual coverage of similar real-time tag data and only perform coverage processing on the same real-time tag data. It should be noted that since the calibration tag data updates the real-time tag table as real-time tag data, the real-time tag data includes calibration tag data at this time.

[0078] This embodiment avoids the situation of repeated reading of tag data, which is beneficial to avoiding the influence of sample deviation on model parameters and improving the accuracy of model training.

[0079] Optionally, calibrating the real-time tag data corresponding to the maximum similarity according to the offline tag data to obtain the calibration tag data includes:

[0080] Input the real-time tag data corresponding to the maximum similarity and the offline tag data into the encoder in the trained calibration model to extract features, and obtain an intermediate representation;

[0081] Perform Gaussian sampling on the intermediate representation, input the sampling result into the decoder in the trained calibration model for reconstruction, and determine the reconstruction result as the calibration tag data.

[0082] Among them, the calibration model can refer to an autoencoder model. The autoencoder model includes an encoder and a decoder. The encoder is used to extract the features of the input, that is, the intermediate representation, and the decoder is used to reconstruct the features from the sampling result of the intermediate representation to obtain the reconstructed input, that is, the calibration tag data.

[0083] Gaussian sampling can refer to sampling the Gaussian distribution corresponding to the intermediate representation, and the sampling result can refer to features that are similar but not exactly the same as the intermediate representation.

[0084] Specifically, the autoencoder model adopts a variational autoencoder model. The process of the encoder extracting the input features can refer to the process of fitting the input distribution. The input distribution fitted is the intermediate representation, and the input distribution can be represented by the mean and variance. Since the purpose of the variational autoencoder model is to reconstruct an output that is similar but not exactly the same as the input, it fits the purpose of calibration in this embodiment, that is, the calibration tag data should be similar to the real-time tag data but not exactly the same.

[0085] In this embodiment, calibrating the real-time tag data according to the offline tag data using the calibration model can ensure that the calibration tag data is as similar as possible to the offline tag data on the premise of ensuring that the calibration tag data is similar to the real-time tag data, thereby ensuring the authenticity and effectiveness of the calibration tag data.

[0086] Optionally, use the offline sample data and the real-time sample data as the training samples for training the calibration model, and use the calibration loss function as the loss function for training the calibration model;

[0087] The training process of the calibration model includes:

[0088] Input the offline sample data and the real-time sample data into the encoder for feature extraction to obtain sample representations;

[0089] Perform Gaussian sampling on the sample representations to obtain sample sampling results, and input the sample sampling results into the decoder for reconstruction to obtain calibrated sample data;

[0090] Calculate the calibration loss function based on the calibrated sample data, the real-time sample data, and the offline sample data. Based on the calibration loss function, reverse-correct the parameters of the encoder and the decoder according to the gradient descent method until the calibration loss function converges to obtain the trained calibration model.

[0091] Among them, the real-time sample data can refer to historical label data with missing values, the offline sample data can refer to historical label data without missing values, and the calibration loss function can refer to the loss function used for training the calibration model.

[0092] The sample representation can refer to the feature distribution corresponding to the offline sample data and the real-time sample. The sample sampling result can be the result after sampling the feature distribution. The calibrated sample data can refer to the data after reconstructing the sampling result.

[0093] The gradient descent method can refer to the stochastic gradient descent method, the batch gradient descent method, etc., which is used to provide an optimization direction for the calibration model parameters. Convergence can refer to that the calibration loss function stabilizes at a certain value after iteration.

[0094] Specifically, in this embodiment, the implementer can directly obtain the historical real-time label data with missing values and the corresponding historical offline label data without missing values. The historical real-time label data can refer to the real-time label data used during historical model training, and the historical offline data can refer to the offline label data used during historical model training to ensure that the missing values are as close to the real situation as possible. It should be noted that the historical real-time label data and the historical offline label data are actually the same label data, but due to different acquisition methods, there are missing values when used as real-time label data, while there are no missing values when used as offline label data.

[0095] Since in the variational autoencoder, the sample representation is the feature distribution, the encoder can be regarded as a mean predictor and a variance predictor, so that the feature distribution can be obtained according to the predicted mean and variance, that is, the feature distribution can be expressed as N(μ, σ 2) The predicted mean is used to reconstruct the input, and the predicted variance is used to add noise to the reconstruction process, thereby obtaining a reconstructed output that is similar to but not exactly the same as the input.

[0096] Since the basic task of the variational autoencoder is reconstruction, that is, to recover the original input based on the sampling results, the supervision during training should include the reconstruction loss. However, in the case of only the reconstruction loss, the predicted variance will gradually tend to 0 to ensure that the model can reconstruct correctly each time. To retain the generative ability of the model, it is necessary to ensure that the predicted variance is not 0. At this time, the KL divergence is used for supervision, that is, L kl = KL(N(μ, σ 2 ) || N(0, I)), where KL is the KL divergence calculation, N(μ, σ 2 ) is the sample representation, and N(0, I) is the standard normal distribution.

[0097] At the same time, the training process of the autoencoder includes a sampling process, but the conventional sampling process is not differentiable. To ensure that the sampling process is differentiable, the reparameterization trick needs to be used, directly involving the sampling results in the gradient operation and not taking the sampling process as part of the training process. That is, sample an ε from N(0, I). ε can be preset by the implementer or determined by using a random number generation method. Then, through the mapping Z = μ + ε * σ, the result Z sampled from N(μ, σ 2 ) is obtained, and the sampling result Z is directly applied to the training process.

[0098] In one implementation, after the implementer obtains the historical real-time label data without missing values, the historical real-time label data without missing values can be used as offline sample data, and the historical real-time label data without missing values is randomly occluded. The occlusion can be performed in the form of a sliding window. For example, the sliding window is set to a size of 1 * 3, that is, a size of one row and three columns. The sliding window contains three elements, and all three elements are set to 0. The sliding window is slid on the historical real-time label data without missing values according to a preset step size, and stops at a random moment. The preset step size can be set to 1, and the random moment can be determined by using the random number generation result. Multiply the corresponding elements of the stopped sliding window and the historical real-time label data without missing values. Substantially, it is an element setting to 0 operation, and the historical real-time label data with missing values after random occlusion can be obtained. Using the historical real-time label data with missing values after random occlusion as real-time sample data, this method can be used when the training samples are few, for amplifying the training samples and improving the generalization ability of the calibration model.

[0099] In this embodiment, the KL divergence is used as the training constraint term, and the reparameterization trick is used to train the calibration model. The reparameterization trick ensures that the training process does not include the sampling process, thus ensuring that the training process is completely differentiable, which is beneficial to the implementation of gradient backpropagation during training. Moreover, by using the KL divergence as the training constraint term, the generation ability of the calibration model is guaranteed, and it can generate a reconstructed output that is similar to but not exactly the same as the input.

[0100] Optionally, the calibration loss function includes a reconstruction loss term and a calibration loss term. The reconstruction loss term corresponds to the reconstruction weight, and the calibration loss term corresponds to the calibration weight.

[0101] The calibration loss function is:

[0102] L = w 1 *dis(A, C * A′) + w 2 *dis(B, C)

[0103] where L is the calibration loss function, dis(A, C * A′) is the reconstruction loss term, dis(B, C) is the calibration loss term, w 1 is the reconstruction weight, w 2 is the calibration weight, A is the real-time sample data, B is the offline sample data, C is the calibration sample data, A′ is the binarization result corresponding to the real-time sample data, and dis is the Euclidean distance.

[0104] Among them, the reconstruction loss term can be a loss used to constrain the calibration sample data to be sufficiently consistent with the real-time sample data, and the calibration loss term can be a loss used to constrain the calibration sample data to be sufficiently consistent with the offline sample data.

[0105] Specifically, the calibration loss function in this embodiment is essentially equivalent to the reconstruction loss in the training process of a conventional autoencoder. Therefore, the calibration loss function in this embodiment also includes the KL divergence, which has been described in detail in the above steps.

[0106] Since the real-time sample data contains missing parts and non-missing parts, and the non-missing parts are the true and reliable content in the real-time sample data, the non-missing parts in the real-time sample data should be retained as much as possible after calibration to ensure the authenticity of the calibration sample data. In this embodiment, the real-time sample data is thresholded to obtain the binarization result corresponding to the real-time sample data. As a reference, the threshold can be set to 0. At this time, it is default that the element values corresponding to the missing parts are 0, then the elements with element values greater than 0 are assigned 1, and the elements with element values of 0 are assigned 0 to obtain the binarization result corresponding to the real-time sample data. The implementer can adjust the above threshold according to the actual situation. For example, setting the threshold to 2 can achieve the effect of filtering out noise.

[0107] Multiplying the calibration sample data point by point with the binarization result can serve the purpose of focusing on the non-missing parts. That is, under the constraint of the reconstruction loss term, the elements in the calibration sample data corresponding to the non-missing parts of the real-time sample data should be as consistent as possible with the elements in the non-missing parts of the real-time sample data.

[0108] Meanwhile, since the offline sample data is relatively accurate, the calibration sample data should be as consistent as possible with the offline sample data to ensure the accuracy of the calibration sample data.

[0109] To ensure that the above constraints all play their corresponding roles during the training process, in this embodiment, the reconstruction weight is set to 10 and the calibration weight is set to 5, so as to ensure that the output results of the model parameters can first meet the reconstruction loss constraint and then meet the calibration loss constraint.

[0110] This embodiment designs a corresponding calibration loss function according to the characteristics of the label data calibration task, so as to ensure the authenticity and accuracy of the output results of the calibration model.

[0111] In the above, if the maximum similarity meets the preset calibration condition, then the real-time label data corresponding to the maximum similarity is calibrated according to the offline label data to obtain the calibrated label data, and the real-time label table is updated using the calibrated label data. By calibrating the real-time label data with the offline label data, the accuracy of the real-time label data is improved, which is beneficial to improving the model training effect.

[0112] This embodiment calibrates the real-time label data using the offline label data of the real-time type, which improves the accuracy of the real-time label data while ensuring the timeliness of the real-time label data.

[0113] See Figure 3 , which is a schematic flowchart of a method for calibrating label data for model training provided in Embodiment 2 of the present invention. In this calibration method, after detecting whether the maximum similarity meets the preset calibration condition, the usage mode of the offline label data is determined according to the detection result.

[0114] If the detection result is that the maximum similarity meets the preset calibration condition, then the real-time label data corresponding to the maximum similarity is calibrated according to the offline label data to obtain the calibrated label data. The above process can be referred to in Embodiment 1 and will not be elaborated here.

[0115] If the detection result is that the maximum similarity does not meet the preset calibration condition, then the usage process of the offline label data is as follows:

[0116] Step S301, detect whether the maximum similarity is less than the preset threshold;

[0117] Step S302, if the maximum similarity is less than the preset threshold, store the offline label data as real-time label data in the real-time label table;

[0118] Step S303, if the maximum similarity is greater than or equal to the preset threshold, store the offline label data in the offline label table.

[0119] Among them, the preset threshold may refer to a storage threshold for determining whether to store the offline label data as real-time label data in the real-time label table.

[0120] Specifically, in this embodiment, the preset threshold is set to 0.3. When the maximum similarity is less than the preset threshold, that is, the similarity between the offline label data and each real-time label data is less than the preset threshold. At this time, it can be considered that the offline label data is new label data not included in the real-time label table, and this offline label data is stored as real-time label data in the real-time label table.

[0121] When the maximum similarity is greater than the preset threshold and does not meet the preset correction condition, it can be considered that the real-time label table contains data similar to the offline label data. At this time, the offline data can be read according to the needs of the implementer. Therefore, this offline data is stored in the offline label table. If the implementer needs relatively rich label data, the offline label table is also read during reading. If the implementer does not need relatively rich label data, only the real-time label table is read during reading.

[0122] In this embodiment, the offline label data less than the preset threshold is also stored as real-time label data in the real-time label table, which can enrich the data content in the real-time label table, thereby improving the generalization ability of the model for subsequent model training.

[0123] Corresponding to the method for correcting label data for model training in the above-mentioned Embodiment 1, Figure 4 The structural block diagram of the device for correcting label data for model training provided in Embodiment 3 of the present invention is shown. The above-mentioned correction device is applied to a computer device. The client corresponding to the computer device accesses the server to obtain a real-time label table and offline label data. The real-time label table is composed of real-time label data. The server has a storage function and can store real-time label data and offline label data.

[0124] See Figure 4 , the correction device includes:

[0125] A data acquisition module 41, configured to obtain a real-time label table and offline label data, and the real-time label table includes at least one real-time label data;

[0126] A time point detection module 42, configured to detect the type of the offline label data, and when it is detected that the type is a real-time enabled type, determine whether the current time point reaches a preset time point;

[0127] A similarity calculation module 43, configured to calculate the similarity between the offline label data and each piece of real-time label data in the real-time label table if the current time point reaches a preset time point, and detect whether the maximum similarity meets a preset correction condition;

[0128] A data correction module 44, configured to correct the real-time label data corresponding to the maximum similarity according to the offline label data to obtain corrected label data if the maximum similarity meets the preset correction condition, and update the real-time label table with the corrected label data.

[0129] Optionally, the real-time label data corresponds to a real-time timestamp;

[0130] The above-mentioned correction device further includes:

[0131] A timestamp preset module, configured to configure the offline label data as a preset timestamp;

[0132] A timestamp detection module, configured to detect whether the real-time timestamp corresponding to each piece of real-time label data in the real-time label table is less than the preset timestamp;

[0133] Correspondingly, the above-mentioned similarity calculation module 43 includes:

[0134] A target data determination unit, configured to determine the real-time label data corresponding to a real-time timestamp less than the preset timestamp as target label data;

[0135] A similarity calculation unit, configured to calculate the similarity between the offline label data and each piece of target label data in the real-time label table.

[0136] Optionally, the above-mentioned data correction module 44 includes:

[0137] A timestamp configuration unit, configured to configure the corrected label data as a preset timestamp;

[0138] A label update unit, configured to update the real-time label table with the corrected label data according to the preset timestamp.

[0139] Optionally, the above-mentioned data correction module 44 includes:

[0140] A feature extraction unit, configured to input the real-time label data and the offline label data corresponding to the maximum similarity into an encoder in a trained correction model to extract features and obtain an intermediate representation;

[0141] A feature reconstruction unit, configured to perform Gaussian sampling on the intermediate representation, input the sampling result into a decoder in the trained correction model for reconstruction, and determine the reconstruction result as the corrected label data.

[0142] Optionally, the offline sample data and the real-time sample data are used as the training samples for training the calibration model, and the calibration loss function is used as the loss function for training the calibration model;

[0143] The above calibration device further includes:

[0144] A sample encoding module, configured to input the offline sample data and the real-time sample data into an encoder for feature extraction to obtain a sample representation;

[0145] A sample reconstruction module, configured to perform Gaussian sampling on the sample representation to obtain a sample sampling result, and input the sample sampling result into a decoder for reconstruction to obtain calibrated sample data;

[0146] A model training module, configured to calculate a calibration loss function according to the calibrated sample data, the real-time sample data, and the offline sample data, and based on the calibration loss function, reversely correct the parameters of the encoder and the decoder according to the gradient descent method until the calibration loss function converges to obtain a trained calibration model.

[0147] Optionally, the calibration loss function includes a reconstruction loss term and a calibration loss term, the reconstruction loss term corresponds to a reconstruction weight, and the calibration loss term corresponds to a calibration weight;

[0148] The above calibration loss function is:

[0149] L = w 1 *dis(A, C * A') + w 2 *dis(B, C)

[0150] where L is the calibration loss function, dis(A, C * A') is the reconstruction loss term, dis(B, C) is the calibration loss term, w 1 is the reconstruction weight, w 2 is the calibration weight, A is the real-time sample data, B is the offline sample data, C is the calibrated sample data, A' is the binary result corresponding to the real-time sample data, and dis is the Euclidean distance.

[0151] Optionally, the above calibration device further includes:

[0152] A threshold detection module, configured to detect whether the maximum similarity is less than a preset threshold if the maximum similarity does not meet the preset calibration condition;

[0153] A data storage unit, configured to store the offline label data as the real-time label data in the real-time label table if the maximum similarity is less than the preset threshold.

[0154] It should be noted that for the information interaction, execution process, etc. between the above-mentioned modules and units, since they are based on the same concept as the method embodiment of the present invention, for their specific functions and the technical effects brought about, reference can be specifically made to the method embodiment part, and details will not be elaborated here.

[0155] Figure 5 This is a schematic structural diagram of a computer device provided in Embodiment 4 of the present invention. As Figure 5 shown, the computer device of this embodiment includes: at least one processor ( Figure 5 only one is shown in the figure), a memory, and a computer program stored in the memory and executable on at least one processor. When the processor executes the computer program, it implements the steps in any of the above-mentioned calibration method embodiments.

[0156] The computer device may include, but is not limited to, a processor and a memory. Those skilled in the art can understand that Figure 5 this is only an example of a computer device and does not constitute a limitation on the computer device. The computer device may include more or fewer components than those shown in the figure, or combine some components, or different components. For example, it may also include a network interface, a display screen, and an input device, etc.

[0157] The so-called processor may be a CPU, and this processor may also be other general-purpose processors, digital signal processors (DSPs), application specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or this processor may also be any conventional processor, etc.

[0158] The memory includes a readable storage medium, an internal memory, etc. Among them, the internal memory can be the memory of a computer device, and the internal memory provides an environment for the operation of the operating system and computer-readable instructions in the readable storage medium. The readable storage medium can be the hard disk of a computer device, and in some other embodiments, it can also be an external storage device of a computer device. For example, a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) card, a Flash Card, etc. equipped on the computer device. Further, the memory can also include both the internal storage unit of the computer device and the external storage device. The memory is used to store an operating system, application programs, a BootLoader, data, and other programs, etc. The other programs such as the program code of a computer program, etc. The memory can also be used to temporarily store the data that has been output or will be output.

[0159] Those skilled in the art can clearly understand that, for the convenience and brevity of description, only the above-mentioned division of each functional unit and module is used as an example. In practical applications, the above-mentioned functions can be allocated to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. Each functional unit and module in the embodiment can be integrated into a processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of a software functional unit. In addition, the specific names of each functional unit and module are only for the convenience of mutual distinction and do not limit the protection scope of the present invention. The specific working process of the units and modules in the above-mentioned device can refer to the corresponding process in the foregoing method embodiment and will not be elaborated here. If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, to implement all or part of the processes in the above-mentioned method embodiments of the present invention, a computer program can be used to instruct the relevant hardware to complete. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by a processor, the steps of the above-mentioned method embodiments can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in the form of source code, object code, executable file or some intermediate form, etc. The computer-readable medium can at least include: any entity or device that can carry the computer program code, recording medium, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, telecommunication signal, and software distribution medium. For example, a USB flash drive, a mobile hard disk, a magnetic disk or an optical disc, etc. In some jurisdictions, according to legislation and patent practice, the computer-readable medium cannot be an electrical carrier signal and a telecommunication signal.

[0160] All or part of the processes in the above-mentioned method embodiments of the present invention can also be completed by a computer program product. When the computer program product runs on a computer device, the computer device can be made to execute the steps in the above-mentioned method embodiments.

[0161] In the above embodiments, the descriptions of each embodiment have their own emphases. For the parts not detailed or recorded in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0162] Those of ordinary skill in the art can realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods for each specific application to implement the described functions, but such implementation should not be considered to exceed the scope of the present invention.

[0163] In the embodiments provided by the present invention, it should be understood that the disclosed device / computer equipment and method can be implemented in other ways. For example, the device / computer equipment embodiments described above are only illustrative. For example, the division of modules or units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed couplings or direct couplings or communication connections to each other can be through some interfaces. The indirect couplings or communication connections of the device or unit can be in electrical, mechanical or other forms.

[0164] The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they can be located in one place, or can be distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0165] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements for some of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included in the protection scope of the present invention.

Claims

1. A method for correcting label data for model training, characterized in that, the method includes: Obtain a real-time label table and offline label data, where the real-time label table includes at least one real-time label data; Detect the type of the offline label data. When it is detected that the type is a real-time enabled type, determine whether the current time point reaches a preset time point. The real-time enabled type indicates that the timeliness of the offline label data is T+0 timeliness; If the current time point reaches the preset time point, calculate the similarity between the offline label data and each real-time label data in the real-time label table, and detect whether the maximum similarity meets a preset correction condition; If the maximum similarity meets the preset correction condition, supplement the real-time label data corresponding to the maximum similarity according to the offline label data to obtain corrected label data, and update the real-time label table with the corrected label data.

2. The correction method according to claim 1, characterized in that, the real-time label data corresponds to a real-time timestamp; After the current time point reaches the preset time point, it further includes: Configure the offline label data as a preset timestamp; Detect whether the real-time timestamp corresponding to each real-time label data in the real-time label table is less than the preset timestamp; Correspondingly, the calculation of the similarity between the offline label data and each real-time label data in the real-time label table includes: Determine the real-time label data with a real-time timestamp less than the preset timestamp as the target label data; Calculate the similarity between the offline label data and each target label data in the real-time label table.

3. The correction method according to claim 2, characterized in that, The updating of the real-time label table with the corrected label data includes: Configure the corrected label data as a preset timestamp; According to the preset timestamp, update the real-time label table with the corrected label data.

4. The correction method according to claim 1, characterized in that, The supplementing of the real-time label data corresponding to the maximum similarity according to the offline label data to obtain corrected label data includes: Input the real-time label data corresponding to the maximum similarity and the offline label data into the encoder in the trained correction model to extract features, and obtain an intermediate representation; Perform Gaussian sampling on the intermediate representation, input the sampling result into the decoder in the trained correction model for reconstruction, and determine the reconstruction result as the corrected label data.

5. The correction method according to claim 4, characterized in that, Use offline sample data and real-time sample data as the training samples for training the correction model, and use a correction loss function as the loss function for training the correction model; The training process of the correction model includes: Input the offline sample data and the real-time sample data into the encoder for feature extraction to obtain a sample representation; Perform Gaussian sampling on the sample representation to obtain a sample sampling result, and input the sample sampling result into the decoder for reconstruction to obtain corrected sample data; Calculate the calibration loss function based on the calibration sample data, the real-time sample data, and the offline sample data. Based on the calibration loss function, reverse-correct the parameters of the encoder and the decoder according to the gradient descent method until the calibration loss function converges, and obtain the trained calibration model.

6. The calibration method according to claim 5, wherein, the calibration loss function includes a reconstruction loss term and a calibration loss term, the reconstruction loss term corresponds to a reconstruction weight, and the calibration loss term corresponds to a calibration weight; the calibration loss function is: where L is the correction loss function, is the reconstruction loss term, is the correction loss term, is the reconstruction weight, is the correction weight, A is the real-time sample data, B is the offline sample data, C is the correction sample data, is the binarization result corresponding to the real-time sample data, and dis is the Euclidean distance.

7. The calibration method according to any one of claims 1 to 6, wherein, after detecting whether the maximum similarity meets a preset calibration condition, it further includes: if the maximum similarity does not meet the preset calibration condition, then detect whether the maximum similarity is less than a preset threshold; if the maximum similarity is less than the preset threshold, then store the offline label data as real-time label data in the real-time label table.

8. A calibration device for label data used in model training, wherein, the calibration device includes: a data acquisition module, configured to obtain a real-time label table and offline label data, and the real-time label table includes at least one real-time label data; a time point detection module, configured to detect the type of the offline label data, and when detecting that the type is a real-time type, determine whether the current time point reaches a preset time point, and the real-time type indicates that the timeliness of the offline label data is T+0 timeliness; a similarity calculation module, configured to if the current time point reaches the preset time point, then calculate the similarity between the offline label data and each real-time label data in the real-time label table, and detect whether the maximum similarity meets a preset calibration condition; a data calibration module, configured to if the maximum similarity meets the preset calibration condition, then supplement the real-time label data corresponding to the maximum similarity according to the offline label data to obtain calibrated label data, and update the real-time label table with the calibrated label data.

9. A computer device, wherein, the computer device includes a processor, a memory, and a computer program stored in the memory and executable on the processor, and when the processor executes the computer program, it implements the calibration method according to any one of claims 1 to 7.

10. A computer-readable storage medium storing a computer program, wherein, when the computer program is executed by a processor, it implements the calibration method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • User tag acquisition method and device based on streaming data processing

    CN113010536A

  • User strategy automatic deployment method and device and electronic equipment

    CN113297287A

  • Live streaming recommendation method and device, equipment, storage medium and computer program product

    CN113382279A