A sample data detection method and device, electronic equipment and storage medium

By training the detection model in longitudinal federated learning and selecting appropriate partners for joint training, the problem of insufficient data quality from the initiator is solved, thereby improving the model's accuracy and the prediction efficiency of data labels.

CN116050538BActive Publication Date: 2026-04-24IFLYTEK CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
IFLYTEK CO LTD
Filing Date
2022-12-26
Publication Date
2026-04-24

AI Technical Summary

Technical Problem

In vertical federated learning, the lack of feature space or label space by the initiator makes it difficult to guarantee the quality of the training dataset, which may result in incorrect labeling and affect the model training effect.

Method used

By training the detection model, it is determined whether the loss is greater than the threshold. If it is greater than the threshold, a target partner is selected from the federated learning system for joint training until the loss of the detection model is no greater than the threshold. The label of the data to be tested is detected based on multiple detection models.

Benefits of technology

This improved the quality of sample data, ensured the accuracy of the detection model, reduced model training costs, and increased the prediction speed and accuracy of data labels.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116050538B_ABST
    Figure CN116050538B_ABST
Patent Text Reader

Abstract

The application discloses a sample data detection method and device, an electronic device and a storage medium. The method comprises the following steps: training a detection model based on sample data of an initiator in a federal learning system, and saving the detection model; determining whether the training loss of the latest saved detection model is greater than a loss threshold; in response to the training loss being greater than the loss threshold, selecting a target partner from unselected partners in the federal learning system, training the latest saved detection model based on sample data of the target partner and the initiator to obtain a new detection model, and saving the new detection model; re-executing the step of determining whether the training loss of the latest saved detection model is greater than the loss threshold and subsequent steps until the training loss of the latest saved detection model is not greater than the loss threshold; and detecting to-be-detected data based on each detection model to determine a data label to which the to-be-detected data belongs. The above method can improve the data quality of sample data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data processing technology, and in particular to a sample data detection method and apparatus, electronic equipment and storage device. Background Technology

[0002] Federated learning is a distributed machine learning technique. Its core idea is to train models in a distributed manner across multiple data sources that have local data. Without exchanging local individual or sample data, it constructs a global model based on virtual fused data by exchanging model parameters or intermediate results, thereby achieving a balance between data privacy protection and data sharing computation.

[0003] Vertical federated learning is typically used in scenarios where data samples from different participants have significant overlap, but the overlap in sample features is not high. In practical applications, the initiator often lacks feature or label spaces, making it difficult to guarantee the quality of the training dataset. This can lead to mislabeling, directly impacting the training performance of the vertical federated learning model. Therefore, improving the quality of the sample data is a pressing issue. Summary of the Invention

[0004] The main technical problem addressed by this application is to provide a sample data detection method and apparatus, electronic device and storage medium that can improve the data quality of sample data.

[0005] To address the aforementioned technical problems, the first aspect of this application provides a sample data detection method, comprising: training a detection model based on sample data from an initiator in a federated learning system, and saving the detection model; wherein the detection model is used to detect the probability that sample data belongs to several data labels, including unknown categories; determining whether the training loss of the latest saved detection model is greater than a loss threshold; in response to the training loss being greater than the loss threshold, selecting a target collaborator from among the unselected collaborators in the federated learning system, and training the latest saved detection model based on the sample data of the target collaborator and the initiator to obtain a new detection model, and saving the new detection model; re-executing the step of determining whether the training loss of the latest saved detection model is greater than the loss threshold and subsequent steps until the training loss of the latest saved detection model is no greater than the loss threshold; detecting the test data based on each detection model to determine the data label to which the test data belongs; wherein the test data is used for federated learning, and the test data includes at least one of sample data and newly collected sample data.

[0006] To address the aforementioned technical problems, a second aspect of this application provides a sample data detection device, comprising: a training module for training a detection model based on sample data from an initiator in a federated learning system, and saving the detection model; wherein the detection model is used to detect the probability that sample data belongs to several data labels, including unknown categories; a judgment module for judging whether the training loss of the latest saved detection model is greater than a loss threshold; a selection module for selecting a target collaborator from unselected collaborators within the federated learning system in response to the training loss being greater than the loss threshold, training the latest saved detection model based on the sample data of the target collaborator and the initiator to obtain a new detection model, and saving the new detection model; a looping module for re-executing the step of judging whether the training loss of the latest saved detection model is greater than the loss threshold and subsequent steps until the training loss of the latest saved detection model is not greater than the loss threshold; and a determination module for detecting the data to be tested based on each detection model and determining the data label to which the data to be tested belongs; wherein the data to be tested is used for federated learning, and the data to be tested includes at least one of sample data and newly collected sample data.

[0007] To address the aforementioned technical problems, a third aspect of this application provides an electronic device, including a memory and a processor coupled to each other. The memory stores program instructions, and the processor executes the program instructions to implement the sample data detection method of the first aspect described above.

[0008] To address the aforementioned technical problems, a fourth aspect of this application provides a computer-readable storage medium storing program instructions executable by a processor, the program instructions being used to implement the sample data detection method of the first aspect described above.

[0009] The above method, based on sample data from the initiator in the federated learning system, can train a detection model to detect the probability that sample data belongs to several data labels, including known and unknown categories. The detection model is then saved to a database. The quality of the current detection model is judged based on the relationship between its training loss and a preset loss threshold. If the training loss exceeds the loss threshold, it indicates that the quality of the current detection model has not met expectations. Federated training using sample data from other collaborators can improve the quality of the detection model. From multiple collaborators not selected within the federated learning system, one is chosen as the target collaborator for this round of training. The training process is then based on the target collaborator and the initiator. The newly saved detection model in the database is trained using sample data to obtain a new detection model, which is then saved to the database. The training loss of the newly saved detection model in the database is then checked against a loss threshold. If the training loss is greater than the loss threshold, a new partner is selected, and steps exceeding the loss threshold and subsequent steps are executed until the training loss of the newly saved detection model is no greater than the loss threshold. This indicates that the quality of the newly saved detection model has reached the desired level. The test data can be detected separately based on each detection model saved in the database. The test data is used for federated learning and includes at least one of the sample data and newly collected sample data, thereby determining the sample data to be tested. Using the above method, based on the current sample data of the initiator, a federated learning-based detection model is constructed and trained. The output of the model is the probability that the detected sample data belongs to several data labels. The training loss of the detection model determines whether it is necessary to continue searching for federated learning partners. When the quality of the detection model is not ideal, a new detection model is constructed and trained again based on the sample data of the selected partners and the existing sample data. This process is repeated until the quality of the latest detection model reaches the expected value. Finally, the correctness of the data label is judged by comprehensively considering the output of multiple models, thus improving the data quality of the sample data. Attached Figure Description

[0010] Figure 1 This is a flowchart illustrating an embodiment of the sample data detection method of this application;

[0011] Figure 2 This is a schematic diagram of the framework of an embodiment of the sample data detection method for determining data labels in this application;

[0012] Figure 3 This is a schematic diagram of the framework of an embodiment of the sample data detection device of this application;

[0013] Figure 4 This is a schematic diagram of the framework of an embodiment of the electronic device of this application;

[0014] Figure 5This is a schematic diagram of a framework of an embodiment of the computer-readable storage medium of this application. Detailed Implementation

[0015] The technical methods in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. Based on the embodiments in this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.

[0016] In this paper, the terms "system" and "network" are often used interchangeably. The term "and / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. Additionally, the character " / " generally indicates that the preceding and following related objects have an "or" relationship. Furthermore, "many" in this paper means two or more.

[0017] Please see Figure 1 , Figure 1 This is a flowchart illustrating an embodiment of the sample data detection method of this application. Specifically, it may include the following steps:

[0018] Step S10: Based on the sample data from the initiator in the federated learning system, train the detection model and save the detection model.

[0019] In this embodiment, vertical federated learning is typically used in scenarios where the sample data of different participants have significant overlap, but the overlap of sample data features is not high. For example, consider two different institutions: a bank in one location and an e-commerce platform in the same location. Their user groups are likely to include most residents of that area, and the overlap of their user features may be large. However, since the bank records users' income and expenditure behavior and credit ratings, while the e-commerce platform retains users' browsing and purchase history, the overlap of their user features is relatively small. The federated learning system includes sample data from one initiator and sample data from several collaborators. The initiator possesses some features of the sample data and the data labels to which the sample data belongs, while other collaborators possess other features of the sample data but do not have the corresponding data labels.

[0020] In one implementation scenario, the initiator's sample data includes data features and data labels. The sample data can be structured or unstructured and can be used to construct a general longitudinal federated learning task. The data labels of the sample data are categorical variables, which can be binary classification, multi-class classification, or multi-label classification, etc. The detection model is trained based on the initiator's sample data and can be effectively applied to various label classification scenarios, showing strong versatility.

[0021] In one implementation scenario, the initiator specifies the learning model and hyperparameters to construct a detection model. Sample data is input into the detection model, and the model is trained based on the feedback from the training loss. The trained detection model can be used to detect the probability that sample data belongs to several data labels, including unknown categories and several known categories. For each sample data, the output of the detection model is either to classify the sample data into the unknown category or to classify it into the known category. This method constructs a highly versatile detection model structure that can classify sample data in binary, multi-class, and multi-label classification scenarios. Furthermore, the detection model is optimized based on the training loss of its loss function, thus improving the data quality of the sample data.

[0022] Step S20: Determine whether the training loss of the latest saved detection model is greater than the loss threshold.

[0023] In this embodiment, the loss function of the detection model is used for parameter estimation in machine learning. The training loss obtained based on the loss function can be used to characterize the quality of the current detection model. By obtaining the relationship between the training loss and a preset loss threshold, it can be determined whether the currently trained detection model has achieved a good effect to meet the user's needs. When the training loss is greater than the loss threshold, it is considered that the effect of the currently trained detection model has not met the expected value, and it is necessary to obtain sample data from other partners for training to improve the accuracy of the detection model. When the training loss is not greater than the loss threshold, it is considered that the effect of the currently trained detection model has met the expected value and can meet the user's needs. In scenarios considering cost, more sample data from other partners is not required. Through the above method, the training loss of the latest saved detection model is obtained, the relationship between the training loss and the loss threshold is judged to obtain the quality of the current detection model, and it is determined whether it is necessary to obtain sample data from other partners to continue training a new detection model based on the quality of the current detection model. Therefore, it can improve the accuracy of the detection model in predicting the data label of the sample data.

[0024] In one implementation scenario, the initiator may lack data features or data labels, making it difficult to guarantee the quality of sample data. There is a high possibility of incorrectly labeled data. For example, community hospitals, due to limited equipment and manpower, may be unable to diagnose complex diseases, resulting in all their sample data being labeled only with common illnesses. Similarly, when the insurance industry creates user profiles, it may lack sufficient user features, such as social data, credit data, and location data, making it difficult to accurately label user types. Community hospitals may also lack sophisticated instruments, hindering the accurate differentiation of some common diseases. This directly impacts the training effect of the detection model, leading to low accuracy. Increasing the training with sample data from relevant partners can improve the accuracy of the detection model.

[0025] Step S30: Select a target partner from the unselected partners in the federated learning system, train the latest saved detection model based on the sample data of the target partner and the initiator, obtain a new detection model, and save the new detection model.

[0026] In this embodiment of the disclosure, the federated learning system contains sample data corresponding to multiple candidate partners. In response to the latest detection model training loss in the database being greater than the loss threshold, indicating that the training result of this detection model has not met the preset requirements, it is necessary to select a partner as the target partner from the unselected partners, and to train a new detection model together based on the sample data of the target partner and the sample data in the latest detection model in the database, so as to improve the accuracy of the detection model.

[0027] In one implementation scenario, the partner with the highest benefit among the candidate partners is selected as the target partner. The benefit of the target partner represents the performance improvement of the new detection model obtained by using the sample data of the partner for model training. Therefore, by selecting high-quality partners as much as possible, the detection model can achieve the expected accuracy while reducing the model training cost.

[0028] In one implementation scenario, there is a pre-defined budget for searching new target partners, and the expenditure required for each training session is specified. The ratio of expenditure to budget determines the number of rounds for searching target partners. Since the sample data of each partner is large, training on all sample data requires high cost and computing power. Therefore, when searching for target partners, a preset number of sample data is obtained from the data of each candidate partner for training, based on the specified expenditure required for each training session. The expenditure is positively correlated with the preset number; the more expenditure specified, the more sample data is obtained, thereby improving the accuracy of the training results. Based on the number of searchable rounds for selecting target partners and the total number of unselected partners, candidate partners are selected from the unselected partners. When the number of searchable rounds is less than the total number, partners with a searchable round count of that number are randomly selected from the unselected partners as candidate partners. Alternatively, when the number of searchable rounds is not less than the total number, all unselected partners are used as candidate partners for searching for target partners. Using the above method, before selecting data from partners to build the detection model, the number of search rounds is determined based on the budget provided by the partners and the expenditure for each training session. Based on the number of search rounds, a corresponding number of candidate partners are identified from the unselected partners. Based on the given training expenditure, a preset number of sample data is extracted from each candidate partner for training. Based on the training results, the candidate partner that provides the greatest benefit for training the new detection model is selected as the target partner. The new detection model is trained using all sample data from the target partner. Under the premise of limited budget, the partner that can improve the model performance as much as possible is selected to improve the performance of the detection model.

[0029] In one implementation scenario, the model loss when attempting to train the detection model using sample data from candidate partners is used to obtain the benefit of selecting a candidate partner as the target partner. Based on the benefits of each candidate partner as the target partner, the partner with the highest benefit is selected as the target partner. Therefore, under the premise of limited budget, the partner that can maximize the model performance can be selected to improve the performance of the detection model and reduce the training cost of the detection model.

[0030] In a specific implementation scenario, when the number of searchable rounds is less than the total number of rounds, a sample data of a corresponding number of candidate partners is randomly selected based on the number of search rounds to attempt to train the detection model. For example, if there are 50 searchable rounds and 70 unselected partners in the federated learning system, 50 partners are randomly selected as candidate partners. Alternatively, the relevant information of each round's candidate partner selection is stored in a database and retrieved in the next round when selecting a target partner. The stored information is then used to obtain the next round's candidate partners to improve the accuracy of data selection. For example, in the previous round, 50 partners were randomly selected as candidate partners. The partner with the highest profit was chosen as the target partner. At this point, 49 partners remain as candidates. The remaining 20 partners from the previous 70 are selected as candidates for this round. From the remaining 49 selected partners, the 30 partners with the highest profits from the previous round are chosen as candidates for this round, and this profit calculation information is saved to the relevant database. This method allows for the selection of target partners based on profit within a limited budget, thus improving the accuracy of selecting high-quality partners. The profit of each candidate partner is obtained by subtracting the difference in model loss between each candidate partner when attempting to train the detection model from the model loss of the latest saved detection model. The candidate partner with the highest profit is then selected as the target partner. For example, the profit calculation formula is as follows:

[0031] r j =Ioss before -loss j ……(1)

[0032] In formula (1), r j For the benefit of the candidate partner, loss before The loss is the model loss of the latest saved detection model. j The model loss when attempting to train the detection model for candidate partners. j The larger the value, the smaller the model loss when the candidate partner tries to train the detection model, the better the effect on improving the quality of the detection model, that is, the higher the benefit.

[0033] In another specific implementation scenario, when the number of searchable rounds is not less than the total number of candidates, all unselected partners are first chosen as candidate partners. Then, the difference between the model losses of each candidate partner when attempting to train the detection model is subtracted from the model loss of the latest saved detection model to obtain the gain of each candidate partner. At this point, the number of searched rounds is equal to the total number of candidate partners. Therefore, the remaining search rounds can be obtained based on the difference between the number of search rounds and the total number of candidates. Since training with partial sample data from candidate partners cannot fully reflect the quality of the candidate partner data, the remaining search rounds can be used to calculate the remaining search rounds. The process involves retrieving unselected data from one or more candidate partners with high returns in the previous round and using this data as the training sample for the current round. It also involves calculating the returns of each candidate partner attempting training again. Based on the remaining search rounds, the process continues to search for the candidate partner with the highest return in each round and calculates their returns for attempting training again. An average return is calculated based on the returns and the number of training attempts. Based on these average returns and the number of training attempts, a score is awarded to each candidate partner. A higher score indicates that the corresponding data is more beneficial to improving the detection model's performance; therefore, the candidate partner with the highest score is selected as the target partner. This method selects the best possible partner within a given budget and reduces the probability that the selected sample data does not accurately reflect the data quality of the corresponding partner, thus improving the quality of the detection model. For example, the formula for calculating the candidate partner's score is as follows:

[0034]

[0035] In formula (2), score j,t Let r be the score of participant j in round t. j,t Let T be the average payout of participant j in round t, where t is the current round number. j This represents the number of times participant j was selected.

[0036] In one implementation scenario, training the latest saved detection model based on sample data from the target collaborator and the initiator yields a new detection model. The training loss of this new model is lower than that of the model trained in the previous round, indicating better performance. This new model is then saved to a database used for storing detection models. By using the target collaborator's sample data and the sample data from the previous training round together to learn and train the new detection model, the performance of the new model is improved, thus enhancing the quality of the sample data.

[0037] It should be noted that, depending on the amount and quality of the sample data from the initiator and the partners, in each round, one partner with the highest profit can be selected as the target partner, or multiple partners with relatively high profits can be selected as the target partners. This application does not impose any restrictions. For the specific profit calculation method, please refer to the above steps, which will not be repeated here.

[0038] In this embodiment, the step of determining whether the training loss of the latest saved detection model is greater than the loss threshold, and subsequent steps, are re-executed until the training loss of the latest saved detection model is no greater than the loss threshold. Specific steps are described above and will not be repeated here for brevity.

[0039] Step S40: Detect the data to be tested based on each detection model and determine the data label to which the data to be tested belongs.

[0040] In this embodiment, in response to the latest saved detection model training loss not exceeding a loss threshold, indicating that the quality of the latest saved detection model has met the requirements, the data label of the data to be tested can be determined based on the saved detection models. The data to be tested is used for federated learning and includes at least one of sample data and newly collected sample data. The detection model can correct the data label of the sample data and predict the data of the newly collected sample data. Through the above method, the performance of the detection model is improved. It can not only correct the data label of existing sample data but also predict the data label of newly collected sample data. Prediction utilizes external data and computing resources as little as possible, improving the prediction speed of the detection model. This reduces the time overhead of data upload by partners and effectively utilizes the user's own features, thus improving the data quality of sample data while reducing model training costs.

[0041] In one implementation scenario, when the test data includes sample data, a detection model is used to detect the test data, yielding the probability values ​​of each test data point belonging to several label values. The detection model extracts data features from the sample data and fuses these features. The fused data is then classified to obtain output results: known category data labels and unknown category data labels. Based on these output results, the probability of each test data point belonging to several label values ​​can be obtained. Different calculation methods are used for different classification tasks to obtain the output probabilities. For example, the output probability calculation formula is as follows:

[0042]

[0043]

[0044]

[0045] In formulas (3) to (5), formula (3) is the formula for calculating the output probability of binary classification, formula (4) is the formula for calculating the output probability of multi-class classification, and formula (5) is the formula for calculating the output probability of multi-label classification. rej Output the probability y for the unknown category. label-i and y label Output probabilities for known classes, sigmoid is the activation function, and fc is the maximum number of classes. rej Output results for unknown categories, fc label The output of the detection model is for known categories. The output of the detection model is converted into a probability value by the sigmoid activation function. If the probability value is greater than a given threshold, the data label of the sample data is determined to be an unknown category. In multi-label classification scenarios, the data label of the sample data is determined to include an unknown category.

[0046] In a specific implementation scenario, in a binary classification scenario, fc label In a single-class classification scenario, after passing through the sigmoid activation function, if the value is greater than a given threshold, the sample is classified as a known class; otherwise, it is considered an unknown sample. In a multi-class classification scenario, after passing through the sigmoid activation function, the class with the highest probability is identified as the data label of the sample data. In a multi-label classification scenario, after passing through the sigmoid activation function, each node is compared with a given threshold after passing through the sigmoid activation function. If the value is greater than the threshold, it indicates that the data label of the sample data contains that label; otherwise, it indicates that the data does not contain that label.

[0047] In one implementation scenario, the loss function can provide an optimization strategy for the detection model. After the detection model outputs results, the initiator can calculate the corresponding loss function based on the output results. For example, the formula for calculating the loss function is as follows:

[0048]

[0049]

[0050] In formulas (6) to (7), formula (6) is the formula for calculating the loss function for binary or multi-class classification, and formula (7) is the formula for calculating the loss function for multi-label classification. y is the label value, θ is the model rejection threshold, and y is the label value. rej Output probability for unknown categories, LogLoss is the log loss function, k is the number of categories, and y label and y label-i Output probabilities for known categories. The training loss of the detection model can be obtained based on the loss function.

[0051] In a specific implementation scenario, the weight coefficients of the detection model can be determined based on the training loss of the detection model. The weight coefficients are negatively correlated with the training loss; the smaller the training loss, the higher the accuracy of the corresponding detection model. During training, the more sample data from the collaborating parties used, the better the detection model will generally be. The better the detection model, the smaller the training loss. For each data label, the final probability of the data label can be obtained based on the probability values ​​output by each detection model and the weight coefficients of each detection model. Based on the final probabilities of several data labels, the data label to which the test data belongs can be determined. The inverse value of the training loss of each detection model can be obtained, and the corresponding inverse value can be normalized to obtain the weight coefficients of each detection model. Therefore, a more accurate data label can be obtained based on the weight coefficients of each detection model and the sample data.

[0052] Please see Figure 2 , Figure 2 This is a flowchart illustrating an embodiment of the sample data detection method for determining data labels according to this application. Figure 2 As shown, in one implementation scenario, by cascading the detection models based on their storage time, a federated learning model can be obtained. By sequentially traversing the federated learning models with the data to be tested, the data label to which the data belongs can be determined. Using the above method, all detection models are cascaded according to their construction order. Sample data is passed through each detection model sequentially to obtain its data label. If the first stored detection model determines it to be of an unknown category, it proceeds to the next detection model, and so on. If a detection model determines it to be of a known category, the corresponding data label is directly output. Therefore, this reduces the computational power required for sample data label detection and effectively utilizes sample data from various sources.

[0053] In a specific implementation scenario, in response to the discovery that the data label of the data to be tested in any detection model in the federated learning model belongs to a known category, the data label is determined and the search stops.

[0054] In another specific implementation scenario, in response to the fact that no data label belonging to the test data in all detection models in the federated learning model is found to belong to a known category, the data label is determined to be an unknown category label, and the data label belonging to the unknown category label is output.

[0055] The above method, based on sample data from the initiator in the federated learning system, can train a detection model to detect the probability that sample data belongs to several data labels, including known and unknown categories. The detection model is then saved to a database. The quality of the current detection model is judged based on the relationship between its training loss and a preset loss threshold. If the training loss exceeds the loss threshold, it indicates that the quality of the current detection model has not met expectations. Federated training using sample data from other collaborators can improve the quality of the detection model. From multiple collaborators not selected within the federated learning system, one is chosen as the target collaborator for this round of training. The training process is then based on the target collaborator and the initiator. The newly saved detection model in the database is trained using sample data to obtain a new detection model, which is then saved to the database. The training loss of the newly saved detection model in the database is then checked against a loss threshold. If the training loss is greater than the loss threshold, a new partner is selected, and steps exceeding the loss threshold and subsequent steps are executed until the training loss of the newly saved detection model is no greater than the loss threshold. This indicates that the quality of the newly saved detection model has reached the desired level. The test data can be detected separately based on each detection model saved in the database. The test data is used for federated learning and includes at least one of the sample data and newly collected sample data, thereby determining the sample data to be tested. Using the above method, based on the current sample data of the initiator, a federated learning-based detection model is constructed and trained. The output of the model is the probability that the detected sample data belongs to several data labels. The training loss of the detection model determines whether it is necessary to continue searching for federated learning partners. When the quality of the detection model is not ideal, a new detection model is constructed and trained again based on the sample data of the selected partners and the existing sample data. This process is repeated until the quality of the latest detection model reaches the expected value. Finally, the correctness of the data label is judged by comprehensively considering the output of multiple models, thus improving the data quality of the sample data.

[0056] Please see Figure 3 , Figure 3 This is a schematic diagram of the framework of an embodiment of the sample data detection device 30 of this application. Figure 3As shown, the sample data detection device 30 includes: a training module 31, a judgment module 32, a selection module 33, a loop module 34, and a determination module 35. The training module 31 is used to train a detection model based on the sample data of the initiator in the federated learning system and save the detection model. The detection model is used to detect the probability that the sample data belongs to several data labels, including unknown categories. The judgment module 32 is used to determine whether the training loss of the latest saved detection model is greater than the loss threshold. The selection module 33 is used to select a target partner from the unselected partners in the federated learning system in response to the training loss being greater than the loss threshold, and to train the latest saved detection model based on the sample data of the target partner and the initiator to obtain a new detection model and save the new detection model. The loop module 34 is used to re-execute the step of determining whether the training loss of the latest saved detection model is greater than the loss threshold and subsequent steps until the training loss of the latest saved detection model is not greater than the loss threshold. The determination module 35 detects the test data based on each detection model and determines the data label to which the test data belongs. The test data is used for federated learning and includes at least one of sample data and newly collected sample data.

[0057] The above method, based on sample data from the initiator in the federated learning system, can train a detection model to detect the probability that sample data belongs to several data labels, including known and unknown categories. The detection model is then saved to a database. The quality of the current detection model is judged based on the relationship between its training loss and a preset loss threshold. If the training loss exceeds the loss threshold, it indicates that the quality of the current detection model has not met expectations. Federated training using sample data from other collaborators can improve the quality of the detection model. From multiple collaborators not selected within the federated learning system, one is chosen as the target collaborator for this round of training. The training process is then based on the target collaborator and the initiator. The newly saved detection model in the database is trained using sample data to obtain a new detection model, which is then saved to the database. The training loss of the newly saved detection model in the database is then checked against a loss threshold. If the training loss is greater than the loss threshold, a new partner is selected, and steps exceeding the loss threshold and subsequent steps are executed until the training loss of the newly saved detection model is no greater than the loss threshold. This indicates that the quality of the newly saved detection model has reached the desired level. The test data can be detected separately based on each detection model saved in the database. The test data is used for federated learning and includes at least one of the sample data and newly collected sample data, thereby determining the sample data to be tested. Using the above method, based on the current sample data of the initiator, a federated learning-based detection model is constructed and trained. The output of the model is the probability that the detected sample data belongs to several data labels. The training loss of the detection model determines whether it is necessary to continue searching for federated learning partners. When the quality of the detection model is not ideal, a new detection model is constructed and trained again based on the sample data of the selected partners and the existing sample data. This process is repeated until the quality of the latest detection model reaches the expected value. Finally, the correctness of the data label is judged by comprehensively considering the output of multiple models, thus improving the data quality of the sample data.

[0058] In some disclosed embodiments, the sample data detection device 30 further includes a probability determination module, which is used to detect the data to be tested based on the detection model, obtain the probability values ​​of the data to be tested belonging to several data labels, and determine the weight coefficients of the detection model based on the training loss of the detection model; wherein the weight coefficients are negatively correlated with the training loss; for each data label, the final probability of the data label is obtained based on the probability values ​​of the data label output by each detection model and the weight coefficients of each detection model; and the data label to which the data to be tested belongs is determined based on the final probabilities of the several data labels.

[0059] Therefore, by obtaining the final probability of a data label based on the probability values ​​of the data to be tested belonging to several data labels and the weight coefficients of the detection model, and by determining the data label to which the data to be tested belongs based on the final probabilities of each of the several data labels, the accuracy of the data label to which the data belongs can be improved, thus improving the data quality of the sample data.

[0060] In some disclosed embodiments, the probability determination module further includes a weight coefficient determination submodule, used to obtain the reciprocal of the training loss of the detection model; and to normalize the reciprocal values ​​corresponding to the detection model to obtain the weight coefficients of the detection model.

[0061] Therefore, the weight coefficients of the detection model are determined based on the reciprocal of the training loss. The smaller the training loss, the higher the accuracy of the detection model, and the higher the weight coefficients assigned, thus improving the data quality of the sample data.

[0062] In some disclosed embodiments, the sample data detection device 30 further includes a label determination module, which is used to cascade the detection models based on the storage time of each detection model to obtain a federated learning model; and to sequentially traverse the federated learning models based on the data to be tested to determine the data label to which the data to be tested belongs; wherein, in response to finding that the data label to which the data to be tested belongs in any detection model of the federated learning model is a known category, the data label is determined and the search is stopped; or, in response to not finding that the data label to which the data to be tested belongs in any detection model of the federated learning model is a known category, the data label is determined to be an unknown category label.

[0063] Therefore, by cascading various detection models based on the storage time of the detection models to obtain a federated learning model, and by traversing the federated learning model to determine the data label to which the detection data belongs, the computational power of determining the data label can be reduced and the accuracy of the searched data label can be improved.

[0064] In some disclosed embodiments, the sample data detection device 30 further includes a partner determination module, which is used to select a candidate partner from the unselected partners based on the number of searchable rounds for selecting a target partner and the total number of unselected partners; to obtain the benefit of selecting a candidate partner as a target partner based on the model loss when attempting to train the detection model using the sample data of the candidate partners; and to select a candidate partner as a target partner based on the benefits of each candidate partner as a target partner.

[0065] Therefore, selecting the candidate partner with the highest benefit from all unselected candidate partners as the target partner can improve the accuracy of the detection model.

[0066] In some disclosed embodiments, the partner determination module further includes a first search submodule, which, when the number of search rounds is less than the total number, randomly selects a corresponding number of candidate partner sample data to attempt to train the detection model based on the number of search rounds; and obtains the benefit of each candidate partner by subtracting the difference between the model losses of each candidate partner when attempting to train the detection model from the model loss of the latest saved detection model, and selects the candidate partner with the largest benefit as the target partner.

[0067] Therefore, given a limited budget, choose a partner that can maximize the performance of the model.

[0068] In some disclosed embodiments, the partner determination module further includes a second search submodule, configured to, when the number of searchable rounds is not less than the total number, obtain the gain of each candidate partner by subtracting the difference between the model losses of each candidate partner when they attempt to train the detection model from the model loss of the latest saved detection model, and obtain the remaining search rounds based on the difference between the number of search rounds and the total number; search for the candidate partner with the highest gain in each round based on the remaining search rounds, and obtain the gain of the candidate partner when it attempts to train again; obtain the average gain of each candidate partner based on the number of times each candidate partner is selected for training and the corresponding gain, and select the candidate partner with the highest average gain as the target partner.

[0069] Therefore, given a limited budget, choose a partner that can maximize the performance of the model.

[0070] In some disclosed embodiments, the partner determination module further includes a sample selection submodule, used to select candidate partners from unselected partners after selecting candidate partners based on the number of searchable rounds for selecting a target partner and the total number of unselected partners, and before obtaining the benefit of selecting a candidate partner as a target partner based on the model loss when attempting to train the detection model using sample data from candidate partners. The method further includes: obtaining a preset number of sample data from candidate partners to attempt to train the detection model based on the expenditure determination for each training session; wherein the expenditure determination for each training session is proportional to the preset number.

[0071] Therefore, a small number of data samples are collected from each participant for training to determine the performance improvement of the model after selecting a particular participant. Under the premise of limited budget, the partner that can improve the model performance as much as possible is selected.

[0072] Please see Figure 4 , Figure 4This is a schematic diagram of a framework of an embodiment of the electronic device 40 of this application. The electronic device 40 includes a memory 41 and a processor 42 coupled to each other. The memory 41 stores program instructions, and the processor 42 is used to execute the program instructions to implement the steps in any of the above-described sample data detection method embodiments. Specifically, the electronic device 40 may include, but is not limited to, servers, desktop computers, laptops, tablets, smartphones, etc., and is not limited thereto.

[0073] Specifically, processor 42 controls itself and memory 41 to implement the steps in any of the above-described sample data detection method embodiments. Processor 42 can also be referred to as a CPU (Central Processing Unit). Processor 42 may be an integrated circuit chip with signal processing capabilities. Processor 42 can also be a general-purpose processor, digital signal processor (DSP), application-specific integrated circuit (ASIC), field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. A general-purpose processor can be a microprocessor or any conventional processor. Furthermore, processor 42 can be implemented using integrated circuit chips.

[0074] The above method, based on sample data from the initiator in the federated learning system, can train a detection model to detect the probability that sample data belongs to several data labels, including known and unknown categories. The detection model is then saved to a database. The quality of the current detection model is judged based on the relationship between its training loss and a preset loss threshold. If the training loss exceeds the loss threshold, it indicates that the quality of the current detection model has not met expectations. Federated training using sample data from other collaborators can improve the quality of the detection model. From multiple collaborators not selected within the federated learning system, one is chosen as the target collaborator for this round of training. The training process is then based on the target collaborator and the initiator. The newly saved detection model in the database is trained using sample data to obtain a new detection model, which is then saved to the database. The training loss of the newly saved detection model in the database is then checked against a loss threshold. If the training loss is greater than the loss threshold, a new partner is selected, and steps exceeding the loss threshold and subsequent steps are executed until the training loss of the newly saved detection model is no greater than the loss threshold. This indicates that the quality of the newly saved detection model has reached the desired level. The test data can be detected separately based on each detection model saved in the database. The test data is used for federated learning and includes at least one of the sample data and newly collected sample data, thereby determining the sample data to be tested. Using the above method, based on the current sample data of the initiator, a federated learning-based detection model is constructed and trained. The output of the model is the probability that the detected sample data belongs to several data labels. The training loss of the detection model determines whether it is necessary to continue searching for federated learning partners. When the quality of the detection model is not ideal, a new detection model is constructed and trained again based on the sample data of the selected partners and the existing sample data. This process is repeated until the quality of the latest detection model reaches the expected value. Finally, the correctness of the data label is judged by comprehensively considering the output of multiple models, thus improving the data quality of the sample data.

[0075] Please see Figure 5 , Figure 5 This is a schematic diagram of a framework of an embodiment of the computer-readable storage medium 50 of this application. The computer-readable storage medium 50 stores program instructions 51 that can be executed by a processor. The program instructions 51 are used to implement the steps in any of the above-described embodiments of the sample data detection method.

[0076] In some embodiments, the functions or modules of the apparatus provided in this disclosure can be used to perform the methods described in the above method embodiments. The specific implementation can be referred to the description of the above method embodiments, and for the sake of brevity, it will not be repeated here.

[0077] The description of the various embodiments above tends to emphasize the differences between the various embodiments. The similarities or similarities between them can be referred to, and for the sake of brevity, they will not be repeated here.

[0078] In the several embodiments provided in this application, it should be understood that the disclosed methods and apparatus can be implemented in other ways. For example, the apparatus implementations described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection of devices or units may be electrical, mechanical, or other forms.

[0079] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of the method in this embodiment, depending on actual needs.

[0080] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0081] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical method of this application, in essence, or the part that contributes to the prior art, or all or part of the technical method, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

Claims

1. A method for detecting sample data, characterized in that, include: A detection model is trained based on sample data from the initiator in the federated learning system, and the detection model is saved; wherein, the detection model is used to detect the probability that the sample data belongs to several data labels, and the several data labels include unknown categories; Determine whether the training loss of the latest saved detection model is greater than the loss threshold; In response to the training loss exceeding a loss threshold, candidate partners are selected from the unselected partners within the federated learning system based on the number of searchable rounds for selecting a target partner and the total number of unselected partners. The benefit of selecting a candidate partner as the target partner is obtained based on the model loss when attempting to train the detection model using sample data from the candidate partners. Based on the benefits of each candidate partner as the target partner, the candidate partner is selected as the target partner. The latest saved detection model is then trained based on the sample data from the target partner and the initiator, resulting in a new detection model, which is then saved. Specifically, in response to the number of searchable rounds being less than the total number of partners, the number of searchable rounds of partners is randomly selected from the unselected partners as candidate partners. In response to the number of searchable rounds being not less than the total number of partners, all unselected partners are considered candidate partners. Repeat the step of determining whether the training loss of the latest saved detection model is greater than the loss threshold and subsequent steps until the training loss of the latest saved detection model is not greater than the loss threshold. The test data is detected by each of the detection models to determine the data label to which the test data belongs; wherein the test data is used for federated learning and includes at least one of the sample data and newly collected sample data.

2. The method according to claim 1, characterized in that, When the data to be tested includes the sample data, the step of detecting the data to be tested based on each of the detection models and determining the data label to which the data to be tested belongs includes: The detection model is used to detect the data to be tested, and the probability values ​​of the data to be tested belonging to the plurality of data labels are obtained. The weight coefficients of the detection model are determined based on the training loss of the detection model. The weight coefficients are negatively correlated with the training loss. For each data label, the final probability of the data label is obtained based on the probability value output by each detection model and the weight coefficient of each detection model. Based on the final probabilities of the aforementioned data labels, the data label to which the data to be tested belongs is determined.

3. The method according to claim 2, characterized in that, Determining the weight coefficients of the detection model based on the training loss of the detection model includes: Obtain the reciprocal of the training loss of each of the detection models; The weight coefficients of the detection model are obtained by normalizing the reciprocal values ​​corresponding to the detection model.

4. The method according to claim 1, characterized in that, When the data to be tested includes the newly collected sample data, the step of detecting the data to be tested based on each of the detection models and determining the data label to which the data to be tested belongs includes: Based on the storage time of each detection model, the federated learning model is obtained by concatenating the detection models. Based on the test data, the federated learning model is traversed sequentially to determine the data label to which the test data belongs; Specifically, in response to the search finding that the data label of the data to be tested in any of the detection models in the federated learning model belongs to a known category, the data label is determined and the search is stopped; Alternatively, in response to the fact that no data label belonging to the test data in any of the detection models in the federated learning model is found to be of a known category, the data label is determined to be an unknown category label.

5. The method according to claim 1, characterized in that, The number of searchable rounds is determined based on the budget given by the target partner in this selection and the expenditure for each training session.

6. The method according to claim 1, characterized in that, When the number of searchable rounds is less than the total number, the gain of selecting the candidate partner as the target partner based on the model loss when attempting to train the detection model using sample data from the candidate partners includes: Based on the number of searchable rounds, a corresponding number of sample data from the candidate partners are randomly selected to attempt to train the detection model; The difference between the model losses of each candidate partner when they tried to train the detection model is subtracted from the model loss of the latest saved detection model to obtain the gain of each candidate partner, and the candidate partner with the largest gain is selected as the target partner.

7. The method according to claim 1, characterized in that, When the number of searchable rounds is not less than the total number, the gain of selecting the candidate partner as the target partner, obtained based on the model loss when attempting to train the detection model using sample data from the candidate partners, includes: The difference between the model losses of each candidate partner when they tried to train the detection model is subtracted from the model loss of the latest saved detection model to obtain the gain of each candidate partner. The remaining search rounds are obtained based on the difference between the number of searchable rounds and the total number of rounds. Based on the remaining search rounds, the candidate partner with the highest benefit in each round is searched and the benefit of the candidate partner trying training again is obtained. The average benefit is obtained based on the benefit and the number of times the selected partner tries training. Based on the average returns and the number of training attempts, scores are obtained for each candidate partner, and the candidate partner with the highest score is selected as the target partner.

8. The method according to claim 1, characterized in that, After selecting a candidate partner from the unselected partners based on the number of searchable rounds for selecting the target partner and the total number of unselected partners, and before obtaining the benefit of selecting the candidate partner as the target partner based on the model loss when attempting to train the detection model using sample data from the candidate partners, the method further includes: obtaining a preset number of sample data from the candidate partners to attempt to train the detection model based on the expenditure determination for each training session; wherein the expenditure determination for each training session is positively correlated with the preset number.

9. A sample data detection device, characterized in that, include: The training module is used to train a detection model based on sample data from the initiator in the federated learning system, and to save the detection model; wherein, the detection model is used to detect the probability that the sample data belongs to several data labels, and the several data labels include unknown categories; The judgment module is used to determine whether the training loss of the latest saved detection model is greater than the loss threshold. The selection module is configured to, in response to the training loss being greater than a loss threshold, select candidate partners from the unselected partners within the federated learning system based on the number of searchable rounds for selecting a target partner and the total number of unselected partners; obtain the benefit of selecting the candidate partner as the target partner based on the model loss when attempting to train the detection model using sample data from the candidate partners; select the candidate partner as the target partner based on the benefits of each candidate partner as the target partner; train the latest saved detection model based on the sample data from the target partner and the initiator to obtain a new detection model; and save the new detection model. Specifically, in response to the number of searchable rounds being less than the total number of partners, randomly select the number of searchable rounds of partners from the unselected partners as candidate partners; in response to the number of searchable rounds being not less than the total number of partners, all unselected partners are selected as candidate partners. The loop module is used to re-execute the step of determining whether the training loss of the latest saved detection model is greater than the loss threshold and subsequent steps until the training loss of the latest saved detection model is not greater than the loss threshold. The determination module detects the data to be tested based on each of the detection models and determines the data label to which the data to be tested belongs; wherein, the data to be tested is used for federated learning, and the data to be tested includes at least one of the sample data and newly collected sample data.

10. An electronic device, characterized in that, The method includes a memory and a processor coupled to each other, the memory being used to store a computer program and the processor being used to execute the computer program to implement the sample data detection method according to any one of claims 1 to 8.

11. A computer-readable storage medium, characterized in that, The device contains a computer program that can be executed by a processor to implement the sample data detection method according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • Federal modeling system and method, federal model prediction method, medium and equipment

    CN113051586A