A method and device for processing training data
By performing candidate mark confidence filtering and sampling of training data in partial multi-label learning, the category imbalance and noise problems are solved, and the accuracy and reliability of model training are improved.
Patent Information
- Application Number
- CN202110046161.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-01-14
- Publication Date
- 2025-08-19
- Estimated Expiration
- 2041-01-14
AI Technical Summary
There are category imbalance and noise problems in training data with more-labeled learning, resulting in reduced model training accuracy.
By obtaining the original training data set, the confidence of candidate marks of each training sample is determined separately, filtered and disambiguated, and the filtered samples are sampled, so that the number of training samples corresponding to candidate marks of different categories meets the preset difference conditions, and the target training data set is obtained for model training.
The marking noise in the training data is reduced, the reliability and balance of the training data are improved, and the accuracy and performance of model training are improved.
Smart Images

Figure CN113591892B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method and device for processing training data. Background Art
[0002] In the training data of multi-label learning, one training sample corresponds to multiple candidate labels, some of which are true and the others are false labels. For training data of multi-label learning, there are usually problems of class imbalance and noise in the training data. Class imbalance and noise in the training data will lead to reduced accuracy of the final trained model. Therefore, how to solve the problems of class imbalance and noise in the training data is very important for model training. Summary of the Invention
[0003] The embodiments of the present application provide a method and apparatus for processing training data to improve the reliability and balance of training data, thereby improving the accuracy of model training.
[0004] The specific technical solutions provided in the embodiments of this application are as follows:
[0005] In one embodiment of the present application, a method for processing training data is provided, including:
[0006] Acquire an original training data set, wherein each training sample included in the original training data set corresponds to at least two candidate labels;
[0007] Determining the label confidence of each candidate label corresponding to each training sample, and filtering each candidate label corresponding to each training sample according to the label confidence of each candidate label;
[0008] Sampling the training samples corresponding to the filtered candidate markers so that the number of training samples corresponding to the candidate markers of different categories meets the preset number difference condition, thereby obtaining the target training data set;
[0009] The target training data set is used to perform model training.
[0010] Another embodiment of the present application provides a training data processing device, including:
[0011] An acquisition module is used to acquire an original training data set, wherein each training sample included in the original training data set corresponds to at least two candidate labels;
[0012] a disambiguation module, configured to respectively determine the label confidence of each candidate label corresponding to each training sample, and filter each candidate label corresponding to each training sample according to the label confidence of each candidate label;
[0013] A sampling module is used to sample the training samples corresponding to the filtered candidate markers so that the number of training samples corresponding to the candidate markers of different categories meets the preset number difference condition, thereby obtaining a target training data set;
[0014] A training module is used to perform model training using the target training data set.
[0015] In another embodiment of the present application, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of any of the above-mentioned training data processing methods when executing the program.
[0016] In another embodiment of the present application, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above-mentioned training data processing methods are implemented.
[0017] In an embodiment of the present application, an original training data set is obtained, wherein each training sample contained in the original training data set corresponds to at least two candidate labels; the labeling confidence of each candidate label corresponding to each training sample is determined respectively, and according to the labeling confidence of each candidate label, each candidate label corresponding to each training sample is filtered respectively, and each training sample corresponding to each filtered candidate label is sampled, so that the number of training samples corresponding to different categories of candidate labels meets a preset number difference condition, and a target training data set is obtained, and then the target training data set can be used for model training. In this way, the candidate labels are filtered by the labeling confidence, the labeling noise in the training data is reduced, the impact of the labeling noise is reduced, and the number of training samples in each category is made equivalent through sampling, thereby improving the reliability and balance of the training data, thereby improving the accuracy of model training, and effectively improving model performance. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 This is a schematic diagram of the application architecture of the method for processing training data in an embodiment of the present application;
[0019] Figure 2 This is a flow chart of a method for processing training data in an embodiment of the present application;
[0020] Figure 3 This is an overall flow chart of the method for processing training data in an embodiment of the present application;
[0021] Figure 4 This is an application flow chart of the method for processing training data in an embodiment of the present application;
[0022] Figure 5This is a structural diagram of a training data processing device in an embodiment of the present application;
[0023] Figure 6 This is a schematic diagram of the structure of an electronic device in an embodiment of the present application. DETAILED DESCRIPTION
[0024] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0025] To facilitate understanding of the embodiments of this application, several concepts are briefly introduced below:
[0026] Imbalanced data: The proportions of samples from different categories in the data vary greatly.
[0027] Multi-label learning: One training sample in the training data corresponds to multiple true labels.
[0028] Partially labeled learning: A type of weakly supervised learning that builds a prediction model by learning from a large number of training samples. Each training sample consists of two parts: a feature vector describing the object and multiple corresponding candidate labels. Only one candidate label can truly reflect the object, and the other candidate labels are pseudo-labels. The difference between partial multi-label learning and supervised learning is that the training data label information of partial label learning is inaccurate, and the prediction model must be learned in a noisy environment.
[0029] Partial multi-label learning: In the training data, one training sample corresponds to multiple candidate labels, of which several candidate labels are true and the others are false labels. The difference from partial label learning lies in the number of true labels.
[0030] K-Nearest Neighbor (kNN) algorithm: It is a supervised machine learning method. Each training sample can be represented by its k closest neighbors. The basic idea is: if a training data set is given, for a new input instance, find the k instances that are the nearest neighbors of the instance in the training data set. If most of these k instances belong to a certain class, then the instance is classified into this class.
[0031] Small categories and large categories: In the embodiment of the present application, small categories mainly refer to categories with a smaller number of training samples, and large categories refer to categories with a larger number of training samples. Categories are candidate labels for training samples, and in the embodiment of the present application, the imbalance rate of each category can be determined, and the large categories and small categories can be determined based on the imbalance rate.
[0032] Median: If the number of original data is odd, arrange the data in ascending order, and the median is the number of data plus one divided by two, that is, the middle number; if the number of original data is even, arrange the data in ascending order, and the median is the average of the two middle data.
[0033] Artificial Intelligence (AI) refers to the theories, methods, techniques, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, to perceive the environment, acquire knowledge, and use that knowledge to achieve optimal results. In other words, AI is a comprehensive technology within computer science that seeks to understand the essence of intelligence and produce new intelligent machines that can respond in a manner similar to human intelligence. AI also studies the design principles and implementation methods of various intelligent machines, enabling them to possess the capabilities of perception, reasoning, and decision-making.
[0034] Artificial intelligence (AI) technology is a comprehensive discipline encompassing a wide range of fields, encompassing both hardware and software technologies. Foundational AI technologies generally include sensors, specialized AI chips, cloud computing, distributed storage, big data processing, operating / interaction systems, and mechatronics. AI software technologies primarily encompass computer vision, speech processing, natural language processing, and machine learning / deep learning.
[0035] Machine Learning (ML): It is a multi-disciplinary interdisciplinary subject involving probability theory, statistics, approximation theory, convex analysis, algorithmic complexity theory and other disciplines. It specializes in studying how computers simulate or implement human learning behavior to acquire new knowledge or skills, and reorganize existing knowledge structures to continuously improve their own performance. Machine learning is the core of artificial intelligence and the fundamental way to make computers intelligent. Its applications are spread across all areas of artificial intelligence. Machine learning and deep learning usually include artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and learning by teaching techniques. For example, the embodiments of this application are mainly aimed at the pre-processing of training data in machine learning. After the training data is processed, the processed training data is used to train the model to improve the accuracy of the model.
[0036] With the research and advancement of artificial intelligence technology, artificial intelligence technology has been studied and applied in many fields, such as common smart homes, smart wearable devices, virtual assistants, smart speakers, smart marketing, unmanned driving, autonomous driving, drones, robots, smart medical care, smart customer service, etc. With the development of technology, artificial intelligence technology will be applied in more fields and play an increasingly important role.
[0037] The solutions provided in the embodiments of this application mainly involve artificial intelligence machine learning technology, which is specifically illustrated by the following embodiments:
[0038] The training data for over-labeled learning requires a large amount of human annotation to support the acquisition of real labeled training data, which is inefficient and costly. Therefore, the obtained training data usually has problems of category imbalance and noise, which in turn leads to reduced accuracy of the final trained model. Therefore, how to solve the problems of category imbalance and noise in training data is very important for model training. The over-labeled learning methods in related technologies have not been optimized for the imbalance problem of training data.
[0039] Therefore, the embodiments of the present application mainly focus on the problem that in the training data of multi-label learning in machine learning scenarios, the number of training samples of different categories varies greatly, and the label space contains noise, and improves the performance of the multi-label learning model from the data level. The basic principle of the data-level method is to preprocess the original training data set to weaken or even eliminate the imbalance of the original training data set. This process is independent of the subsequent training process. Specifically, the original training data set is obtained, and the candidate labels corresponding to each training sample are filtered respectively, and the training samples corresponding to each filtered candidate label are sampled so that the number of training samples corresponding to the candidate labels of different categories meets the preset quantity difference condition, and the target training data set is obtained. The target training data set can then be used for model training. In this way, the candidate labels are filtered by label confidence, the label noise in the training data is reduced, and the number of training samples of each category is made equivalent through sampling, which solves the imbalance problem of the training data, improves the accuracy and reliability of the training data, and thus improves the accuracy of model training, effectively improving the performance of the model.
[0040] See Figure 1 , which is a schematic diagram of the application architecture of the method for processing training data in an embodiment of the present application, includes a terminal 100 and a server 200.
[0041] The terminal 100 can be any smart device such as a smart phone, a tablet computer, a portable personal computer, a desktop computer, a smart TV, a smart robot, a vehicle-mounted electronic device, etc. Various applications (Application, APP) can be installed on the terminal 100. For example, in the embodiment of the present application, in various application scenarios, business applications such as search and recommendation can be performed based on the trained model.
[0042] The server 200 can provide various network services for the terminal 100. For different applications, the server 200 can be considered as the corresponding background server, wherein the server 200 can be a single server, a server cluster consisting of several servers, or a cloud computing center.
[0043] The terminal 100 and the server 200 can be connected via the Internet to enable communication between them. Optionally, the Internet uses standard communication technologies and / or protocols. The Internet is typically the Internet, but can also be any network, including but not limited to a local area network (LAN), a metropolitan area network (MAN), a wide area network (WAN), a mobile, wired or wireless network, a private network or any combination of a virtual private network. In some embodiments, technologies and / or formats including Hypertext Markup Language (HTML) and Extensible Markup Language (XML) are used to represent data exchanged over the network. In addition, conventional encryption technologies such as Secure Sockets Layer (SSL), Transport Layer Security (TLS), Virtual Private Network (VPN), and Internet Protocol Security (IPsec) can be used to encrypt all or some links. In other embodiments, customized and / or dedicated data communication technologies can also be used to replace or supplement the above-mentioned data communication technologies.
[0044] It is worth noting that the training data processing method in each embodiment of the present application can be executed by the server 200 side, and of course it can also be executed by the terminal 100. This is not limited in the embodiments of the present application. Taking execution by server 200 as an example, server 200 obtains the original training data set, filters and disambiguates the candidate labels of each training sample, reduces label noise, and samples each filtered training sample to make the number of training samples in each category equivalent, thereby obtaining the target training data set, and then the target training data set can be used for model training.
[0045] It should be noted that the application architecture diagram in the embodiment of the present application is intended to more clearly illustrate the technical solution in the embodiment of the present application, and does not constitute a limitation on the technical solution provided in the embodiment of the present application. It can be applied to any multi-label application scenario, such as images, audio, text, etc., and of course it can also be applied to training data preprocessing scenarios of other models without limitation. For other application architectures and business applications, the technical solution provided in the embodiment of the present application is also applicable to similar problems.
[0046] In each embodiment of the present application, the training data processing method is applied to Figure 1 The application architecture shown is used as an example for schematic description.
[0047] Based on the above embodiments, see Figure 2 FIG. 1 is a flow chart of a method for processing training data in an embodiment of the present application, which is described by taking application to a server as an example. Specifically, the method includes:
[0048] Step 200: Acquire an original training data set, wherein each training sample included in the original training data set corresponds to at least two candidate labels.
[0049] In the embodiments of the present application, the main problem is that the number of training samples of different categories in the training data in the machine learning scenario varies greatly, and the label space contains noise. The original training data set is a training sample for multi-label learning, that is, each training sample in the original training data set corresponds to multiple candidate labels, of which multiple labels may be true and multiple labels may be false labels. Of course, the embodiments of the present application are not limited to training samples for multi-label learning.
[0050] For example, the original training dataset is in, For training samples, it can be represented by a d-dimensional feature vector. is the training sample x i The candidate tag set, There are real labels in the candidate label set, and there may also be pseudo labels. Hidden in the candidate tag set, the remaining tags are pseudo tags, that is, noise tags, then the model Will be from Learned from.
[0051] Step 210: Determine the label confidence of each candidate label corresponding to each training sample, and filter each candidate label corresponding to each training sample according to the label confidence of each candidate label.
[0052] Since the candidate labels of each training sample in the original training data set may contain label noise, in order to improve the accuracy, the candidate labels can be first disambiguated, that is, filtered.
[0053] When step 210 is specifically performed, a possible implementation method is provided in the embodiment of the present application, including:
[0054] S1. Determine the label confidence of each candidate label corresponding to each training sample.
[0055] That is, for each training sample, a label confidence is determined for each candidate label. For example, the kNN reconstruction method can be used to obtain the label confidence.
[0056] For ease of explanation, an example is given for any one of the training samples. Specifically, for any one of the training samples, the label confidence of each candidate label corresponding to any one of the training samples is obtained by performing the following steps:
[0057] S1.1. Determine the k training samples closest to any training sample as the k nearest neighbor set of any training sample, where k is a positive integer greater than or equal to 1.
[0058] For example, based on the feature vector of each training sample, the k nearest neighbor training samples that are closer to any training sample can be determined. The closer the distance, the higher the similarity between the two training samples. Euclidean distance or Manhattan distance can be used to calculate the distance, which is not limited in the embodiments of the present application.
[0059] Thus, for each training sample In the original training dataset Find x in j The k nearest neighbors of the set can be marked as
[0060] S1.2. Determine a weight vector of any training sample based on its k-nearest neighbor set.
[0061] The size of the weight vector is 1*m, where m is the number of training samples in the original training data set. The value of each element in the weight vector represents the degree of influence of each training sample in the original training data set on the reconstruction of any training sample.
[0062] In the embodiment of the present application, the training sample is reconstructed mainly based on the relationship between the training sample and its neighbors. For all the training samples in the original training data set, an m*m weight matrix W=[w1,…,w m ] T , where for any training sample Its weight vector is: w j =[w 1,j ,…,w m.j ] T (1≤j≤m), which is a vector of size 1*m.
[0063] For determining the weight vector of any training sample, the present application provides a possible implementation method, specifically including:
[0064] S1.2.1. Determine the feature vector of any training sample and the sum of the products of the values of each element in the weight vector and the corresponding training sample.
[0065] S1.2.2 Based on the difference between the eigenvector of any training sample and the sum, a non-negative linear least squares optimization objective function is established, and based on the fact that the elements in the weight vector corresponding to the k-nearest neighbor set are greater than or equal to 0, and the elements in the weight vector corresponding to other training samples of the non-k-nearest neighbor set are equal to 0, the constraints of the optimization objective function are established.
[0066] For example, for any training sample Its eigenvector is x j , the weight vector is w j =[w 1,j ,…,w m.j ] T (1≤j≤m), each element in the weight vector takes the value w i,j , which indicates the degree of influence of training sample i on the reconstruction of training sample j. The data subscripts of each training sample in its k nearest neighbor set are The optimization objective function is: The constraint condition is w i,j ≥0(i∈N(x j )),and
[0067] S1.2.3. Determine the optimal solution of the optimization objective function based on the constraints, and use the optimal solution as the weight vector of any training sample.
[0068] According to the established optimization objective function, its optimization goal is to minimize x j The k nearest neighbor pairs x j The reconstruction error, w i,j The larger the value, the closer the training sample x is. i x j The greater the reconstruction influence, the optimization problem is a non-negative linear least squares problem. By calculating the optimal solution, we can finally obtain x j The weight vector w of its neighbors j , the optimal solution Any quadratic programming solution method can be used to obtain it, and this is not limited in the embodiments of the present application.
[0069] S1.3. According to the weight vector of any training sample, determine the labeling confidence of each candidate label corresponding to any training sample.
[0070] Specifically, it includes: determining the labeling confidence of each candidate label corresponding to any training sample according to the element values in the weight vector corresponding to each training sample in the k-nearest neighbor set, and the labeling confidence of each candidate label corresponding to any training sample in each training sample in the k-nearest neighbor set.
[0071] The initial value of the label confidence of each candidate label corresponding to each training sample is 1.
[0072] For example, for each sample Its candidate tag set Y j It can be represented by a q-dimensional binary vector, that is, S j =[S 1,j ,...,S q.j ] T (1≤j≤m), then initialize it and obtain its initial value:
[0073]
[0074] That is to say, the set of candidate labels for all training samples in the original training data set, that is, the set of candidate labels contains a total of q, so it can be represented by a q-dimensional vector. For a training sample, it does not necessarily correspond to q candidate labels, but may only have a part of them. The initial value of the label confidence of the corresponding candidate label can be recorded as 1. For example, there are 5 candidate labels, namely a1, a2, a3, a4, and a5. For ease of representation and calculation, their subscripts or position arrangement order in the vector can be set to a1, a2, a3, a4, and a5. If a training sample only corresponds to candidate labels a1 and a2, the initial value of the label confidence of the candidate label set of the training sample can be expressed as s = [1, 1, 0, 0, 0].
[0075] Then, the weight vector reconstructed by kNN can be used to obtain the label confidence of each candidate label of any training sample:
[0076]
[0077] That is, the labeling confidence of the candidate labeling of the k-nearest neighbor training sample and the weight of the k-nearest neighbor for the current training sample can be used to represent the labeling confidence of the candidate labeling of the current training sample.
[0078] S2. Filter each candidate tag corresponding to each training sample according to the tag confidence of each candidate tag.
[0079] Specifically including: S2.1, obtaining the confidence threshold corresponding to each training sample according to the average value of each element in the weight vector of each training sample.
[0080] In the embodiment of the present application, disambiguation processing is performed on the candidate tags of each training sample, and a confidence threshold μ is set for each training sample. j , specifically:
[0081]
[0082] S2.2. For each training sample, filter out candidate tags whose tag confidence is less than the corresponding confidence threshold.
[0083] That is, in the embodiment of the present application, after the labeling confidence of the candidate label is obtained through k-nearest neighbor reconstruction, the candidate label below the confidence threshold can be regarded as labeling noise and can be discarded, which can improve the reliability of the training sample. However, if the labeling confidence of each candidate label corresponding to a certain training sample is less than the corresponding confidence threshold, the embodiment of the present application also provides a possible implementation method. If it is determined that the labeling confidence of each candidate label corresponding to each training sample is less than the corresponding confidence threshold, the candidate label with the highest labeling confidence is retained, and other candidate labels except the one with the highest labeling confidence are filtered out.
[0084] After disambiguating and filtering the candidate tags of each training sample in the original training data set, the filtered candidate tags of each training sample can be expressed as:
[0085]
[0086] In addition, it should be noted that the kNN method is used in the embodiment of the present application to achieve disambiguation processing of each candidate label, but the embodiment of the present application is not limited to this method, and other methods may also be used, such as label propagation method.
[0087] Step 220: Sampling the training samples corresponding to the filtered candidate markers so that the number of training samples corresponding to the candidate markers of different categories meets a preset quantity difference condition, thereby obtaining a target training data set.
[0088] In the embodiment of the present application, after disambiguation or filtering of each candidate marker, the labeling noise of the training sample is reduced, and it can be considered that the filtered candidate markers are all true markers. On this basis, a sampling method can be used to solve the category imbalance problem in the original training data set, so that the number of training samples corresponding to candidate markers of different categories is roughly the same.
[0089] Specifically, step 220 includes:
[0090] A1. Determine the class imbalance rate of each candidate tag after filtering according to the number of training samples corresponding to each candidate tag after filtering.
[0091] Each candidate tag is a category. To solve the category imbalance problem, we need to first determine the small category and the large category. The small category is the category whose category imbalance rate is greater than the imbalance rate threshold, and the large category is the category whose category imbalance rate is not greater than the balance rate threshold.
[0092] The number of training samples corresponding to each filtered candidate label is determined respectively, and for each filtered candidate label, the ratio of the maximum number of training samples to the number of training samples corresponding to the current candidate label can be used to determine the class imbalance rate, for example:
[0093]
[0094] Among them, if π is true, the value of [[π]] is 1, otherwise it is 0. In this way, the category imbalance rate of each candidate tag after filtering can be obtained. It can be seen that the larger the value of the category imbalance rate, the smaller the number of the class, and the more obvious the imbalance phenomenon.
[0095] A2. Determine an imbalance rate threshold based on the determined imbalance rate of each category, and treat the category of the candidate marker whose category imbalance rate is greater than the imbalance rate threshold as a small category.
[0096] The method for determining the imbalance rate threshold is not limited in the embodiments of the present application. For example, two possible implementation methods are provided in the embodiments of the present application:
[0097] 1) Sort the filtered candidate markers according to the determined class imbalance rate, and select the median as the imbalance rate threshold.
[0098] For example, sort the imbalance rates of q classes, select the median as the threshold, and record its category as γ. The imbalance phenomenon of categories greater than the median is more obvious, so the category of each candidate label greater than the imbalance rate threshold is recorded as a small category λ and find training samples containing this category.
[0099] 2) The average value of the determined class imbalance rates is used as the imbalance rate threshold.
[0100] In this way, by screening the class imbalance rate, small classes with insufficient training samples can be determined. There may be multiple small classes determined. In the embodiment of the present application, sampling is performed on each small class to enrich the number of training samples.
[0101] A3. Determine the number of samples to be taken for each subcategory.
[0102] Specifically, the difference between the number of training samples of the category corresponding to the imbalance rate threshold and the number of training samples of the category corresponding to each subcategory is determined respectively, and the number of samples to be sampled for each subcategory is obtained.
[0103] For example, for each subclass λ, the formula for calculating the number of samples to be sampled is:
[0104]
[0105] A4. According to the preset sampling method, for each subcategory, sample the corresponding number of training samples to be sampled, and add the sampled training samples to the filtered original training data set to obtain the target training data set.
[0106] Among them, the preset sampling method can adopt an oversampling method. The basic idea of the oversampling method is to perform operations on categories with a smaller number of training samples than the larger category, and copy the training samples of the smaller category to make the number of training samples equal to that of the larger category. Of course, an undersampling method can also be adopted. Undersampling is the opposite of oversampling. It only performs operations on categories with a larger number of training samples than the smaller category, reducing the number of training samples of the larger category until it is equal to the size of the smaller category. Different sampling methods can be adopted according to actual conditions and needs, and are not limited in the embodiments of this application.
[0107] In the embodiments of the present application, an oversampling method is mainly used. According to the characteristics of the training data of multi-label learning, a specific sampling implementation method is given, and sampling can be performed on each subcategory separately to solve the problem of category imbalance.
[0108] Step 230: Perform model training using the target training data set.
[0109] In this way, after disambiguation and sampling of the original training data set, a more accurate and reliable target training data set can be obtained, and then the model training can be performed based on the target training data set. The candidate labels of unknown samples can also be predicted based on the trained model. The trained model can also be applied to different businesses based on different application scenarios, which is not limited in the specific embodiments of this application.
[0110] In an embodiment of the present application, an original training data set is obtained, and each training sample contained in the original training data set corresponds to at least two candidate labels, and the label confidence of each candidate label corresponding to each training sample is determined respectively. According to the label confidence of each candidate label, each candidate label corresponding to each training sample is filtered respectively, and each training sample corresponding to each filtered candidate label is sampled, so that the number of training samples corresponding to candidate labels of different categories meets the preset number difference condition, and the target training data set is obtained, and then the target training data set can be used for model training. In this way, each candidate label of each training sample is filtered, that is, disambiguated, which reduces the influence of label noise, and sampling each filtered training sample can reduce the imbalance of training data, solve the problem that the number of samples of different categories in the training data is quite different, and the label space contains noise, improve the reliability and accuracy of the training data, and then the target training data set can be used to train the model, which can effectively improve the performance of subsequent models.
[0111] The sampling method in step 220 is described in detail below. That is, for each subclass, a corresponding number of training samples to be sampled are obtained according to the preset sampling method. In the embodiment of the present application, the following different implementation methods are provided:
[0112] The first implementation method: random oversampling.
[0113] Specifically: for each subcategory, randomly copy the corresponding number of training samples to be sampled from the training samples corresponding to the candidate labels of the subcategory.
[0114] For example, for each subclass λ, diff(λ) training samples are randomly copied from the training samples containing the subclass and added to the filtered original training data set, that is,
[0115] That is, random oversampling starts from a single candidate marker and randomly copies a certain number of training samples containing small classes.
[0116] The second implementation method: oversampling by weight.
[0117] In an embodiment of the present application, in multi-label training data, a training sample may have both small category candidate labels and large category candidate labels. At this time, directly copying the training sample may not necessarily alleviate the imbalance of small categories, because the number of large categories will also increase. Therefore, in order to be more accurate, the degree of symbiosis of each candidate label of the training sample can be determined, and then the training samples with a higher degree of symbiosis can be disassembled. The complex training sample containing small categories can be decomposed into two simpler samples to solve the label symbiosis problem of multiple labels, and the training samples are given different weights, and the training samples with high weights can be copied first.
[0118] Specifically: 1) respectively determining the co-occurrence degree of each candidate marker corresponding to each filtered training sample.
[0119] The symbiosis degree represents the degree of association between candidate markers.
[0120] For example, taking the training sample (x i ,Y i ) as an example, the corresponding symbiosis degree of each candidate marker is:
[0121]
[0122] That is, the degree of symbiosis of each filtered training sample label can be determined based on the category imbalance rate and label confidence of each candidate label. Of course, other indicators can also be used to measure the degree of symbiosis of candidate labels. This is not limited in the embodiments of the present application. For each training sample, a value for measuring the degree of symbiosis of the candidate label is calculated.
[0123] 2) Determine the symbiosis degree threshold according to the average value of the symbiosis degree corresponding to each filtered training sample.
[0124] For example, the symbiosis threshold is:
[0125] 3) The training samples with a symbiosis degree higher than the symbiosis degree threshold are respectively decomposed into a training sample containing only small-category candidate labels and a training sample containing only large-category candidate labels according to the corresponding candidate labels, where the large category represents the category of candidate labels whose category imbalance rate is not greater than the imbalance rate threshold.
[0126] In the embodiment of the present application, the filtered training samples Calculate SCUMBLEins(x i ), if it is higher than the symbiosis degree threshold SCUMBLE, it means that the symbiosis degree of the candidate markers of the training sample is high, and it needs to be decomposed into two training samples and added to the original training data set. The two decomposed training samples have the same feature vectors, but one only contains small category candidate markers and the other only contains large category candidate markers.
[0127] Furthermore, if a training sample only contains small-category candidate tags or large-category candidate tags, there is no need to perform decomposition.
[0128] 4) For each subclass, determine the sampling weight of the training samples containing each subclass respectively, and copy the corresponding number of training samples to be sampled from high to low according to the determined sampling weight.
[0129] For example, for each subclass, different sampling weights are assigned to each training sample containing subclass λ, and training samples with high sampling weights of diff(λ) are preferentially copied and added to the filtered original training data set, that is: The sampling weight is calculated as follows:
[0130]
[0131] That is, when sampling for each subclass, priority is given to sampling training samples with higher confidence and lower symbiosis to improve the accuracy of the training samples.
[0132] The third implementation method: synthetic oversampling.
[0133] In the embodiment of the present application, the basic principle of synthetic oversampling is: randomly selecting training samples containing small classes to generate new training samples, interpolating the feature vector of the new training sample using one of its neighbors, and reconstructing the candidate labels using kNN.
[0134] Specifically, for each subclass, a corresponding number of training samples to be sampled are obtained by sampling. For the sake of convenience, any subclass is used for illustration. For any subclass in each subclass, the following steps are performed to obtain the corresponding number of training samples to be sampled for any subclass:
[0135] a) Randomly select a corresponding number of training samples to be sampled from each training sample corresponding to the candidate label of any small class as the benchmark training samples.
[0136] b) for each selected benchmark training sample, among each training sample corresponding to a candidate label of any subclass, determine the k training samples closest to each benchmark training sample, randomly select a training sample from the determined k training samples, and generate corresponding new training samples based on each benchmark training sample and the corresponding randomly selected training sample, where k is a positive integer greater than or equal to 1.
[0137] For example, for each subclass λ, the set of training samples containing this class is recorded as Randomly select diff(λ) training samples (x i ,Y i ) as the benchmark training sample, and then a new training sample can be synthesized for each benchmark training sample. In this way, a corresponding number of training samples to be sampled are sampled for each subclass.
[0138] When generating a new training sample, it includes two parts: one part is generating a feature vector of the new training sample, and the other part is generating a candidate tag of the new training sample.
[0139] Generate feature vectors for the first part, for example, Find x in i k nearest neighbors and randomly select one, denoted as (x j ,Y j ), and in x i and x j Pick a point on the line connecting Synthesize new training samples New training samples are generated as follows:
[0140]
[0141] Where ω=[ω1,...,ω d ] T is a randomly generated d-dimensional vector, each dimension of which ω a is a real number between [0,1].
[0142] c) generating candidate labels for each new training sample based on the k training samples that are closest to each benchmark training sample.
[0143] After generating the feature vector of a new training sample, the candidate label of the new training sample can be obtained through k-nearest neighbor reconstruction. Specifically:
[0144] 1) Determine the weight vector of each benchmark training sample based on the k training samples that are closest to each benchmark training sample.
[0145] For example, in Find x in i k nearest neighbors and mark the data as Reconstruct x using k nearest neighbors i , minimize the error to get the weight vector w i =[w 1,i ,...,w m.i ] T , specifically:
[0146] The optimization objective function is:
[0147] The constraints are: w j,i ≥0(j∈N(x i )),
[0148] The optimal solution of the optimization objective function is solved by the quadratic programming method, that is, the weight vector is obtained.
[0149] 2) According to the weight vector of each benchmark training sample and the candidate labels corresponding to the k training samples with the closest distance, the label confidence of each candidate label corresponding to each new training sample is determined respectively.
[0150] For example, for a new training sample The label confidence of each candidate label is:
[0151]
[0152] That is, for a synthesized new training sample, its candidate labels are not known, and the candidate labels of the new training sample can be synthesized from all the candidate labels contained in it according to the candidate labels of the k-nearest neighbor training samples.
[0153] 3) Determine the confidence threshold corresponding to each new training sample.
[0154] For example, each new training sample corresponds to a confidence threshold, and the new training sample The confidence threshold for is:
[0155] 4) For each new training sample, the candidate labels whose label confidence is greater than or equal to the confidence threshold, as well as the candidate labels of any small class, are used as the candidate labels corresponding to the new training sample.
[0156] That is, each candidate tag of the new training sample includes at least a small category candidate tag, and may also include a candidate tag with a larger confidence.
[0157] For example, the candidate label set of the new training sample can be expressed as:
[0158]
[0159] Then, each new training sample is added to the filtered original training data set, and the target training data set is obtained as follows:
[0160] In this way, in the embodiment of the present application, an oversampling method can be used to sample the filtered original training data set so that the number of training samples of different categories is equal, thereby improving the accuracy and reliability of the training data set.
[0161] Based on the above embodiment, a specific application scenario is used for illustration. The original training data set is used as a training sample for partial multi-label learning. Figure 3 FIG. 1 is an overall flow chart of the method for processing training data in an embodiment of the present application, which specifically includes:
[0162] Step 300: Obtain the original training data set.
[0163] Among them, each training sample contained in the original training data set corresponds to at least two candidate labels. Since manual labeling is costly and difficult, the categories in the original training data set obtained are usually unbalanced and there will be labeling noise, so the original training data set needs to be preprocessed.
[0164] Step 301: Perform candidate label disambiguation on each training sample in the original training data set.
[0165] Specifically, the labeling confidence of each candidate label corresponding to each training sample is determined respectively, and the candidate labels corresponding to each training sample are filtered respectively according to the labeling confidence of each candidate label.
[0166] In this way, filtering out some candidate tags with low tag confidence can reduce the impact of tag noise.
[0167] Step 302: Sampling, expanding and filtering the original training data set.
[0168] Specifically, oversampling or undersampling methods may be used for sampling, so that the number of training samples corresponding to candidate tags of different categories meets a preset quantity difference condition, that is, the number of training samples of different categories is approximately the same.
[0169] Taking the oversampling method as an example, any one or a combination of the following methods may be used for sampling: random oversampling, weighted oversampling, and synthetic oversampling.
[0170] Step 303: Obtain target training data set.
[0171] Step 304: Perform model training using the target training data set.
[0172] For example, a partial multi-label learning method can be used to train the model using the target training data set, and then the trained model can be used to predict candidate labels for unknown samples. It can also be applied to other application scenarios, which is not limited in the embodiments of this application.
[0173] In the embodiments of the present application, the main focus is on the problem that the number of training samples of different categories in the training data in the machine learning scenario varies greatly and the label space contains noise. The performance of the multi-label learning model is improved from the data level. The existing methods for solving category imbalance all assume that the label information of the training samples is known, but in the multi-label learning scenario, it is unknown due to noise interference. Therefore, the training data processing method in the embodiments of the present application mainly includes two parts: disambiguating the candidate label set of the original training data set, and expanding the original training data set through sampling, which can alleviate the category imbalance phenomenon in the training data, reduce the impact of label noise, and thus improve the performance of the trained model.
[0174] Based on the above embodiment, the following describes the method for processing training data in the embodiment of the present application from the product side. Figure 4 , which is an application flow chart of the method for processing training data in an embodiment of the present application.
[0175] like Figure 4 As shown in the figure, the original training data set with imbalanced input categories and noise is used to disambiguate or filter the candidate tag set. Specifically, the tag confidence of each candidate tag corresponding to each training sample is determined respectively, and the candidate tags with a confidence threshold are filtered out. Moreover, for each training sample corresponding to each filtered candidate tag, a small class is determined and sampled to obtain the target training data set. Then, based on the target training data set, the model can be trained using the partial multi-tag learning method to obtain a trained model.
[0176] In an embodiment of the present application, a training data processing method is provided for an original training data set with class imbalance and noise problems, which can improve the training data through disambiguation and sampling, thereby improving the quality of the training data and enhancing the performance of subsequent multi-label learning models.
[0177] In addition, in order to verify the improvement in model performance after preprocessing based on the training data processing method in the embodiment of the present application, the embodiment of the present application also conducted a test comparison. Some public multi-class data sets can be preprocessed using the training data processing method in the embodiment of the present application, and then the model is trained using a partial multi-label learning method. The performance of the finally trained model is compared after and before preprocessing using the training data processing method in the embodiment of the present application. For example, for the model of multi-classification problem, macro-averaging, micro-averaging, macro-F score and other evaluation indicators can be used for comparison. It can be seen from the test verification that the performance of the trained model after preprocessing using the training data processing method in the embodiment of the present application is significantly better than the model that is not preprocessed and trained using this method.
[0178] Based on the same inventive concept, the present application also provides a training data processing device, which can be a hardware structure, a software module, or a hardware structure plus a software module. Figure 5 As shown, the training data processing device in the embodiment of the present application specifically includes:
[0179] An acquisition module 50 is configured to acquire an original training data set, wherein each training sample included in the original training data set corresponds to at least two candidate labels;
[0180] a disambiguation module 51 for determining the label confidence of each candidate label corresponding to each training sample, and filtering each candidate label corresponding to each training sample according to the label confidence of each candidate label;
[0181] The sampling module 52 is used to sample the training samples corresponding to the filtered candidate markers so that the number of training samples corresponding to the candidate markers of different categories meets a preset number difference condition, thereby obtaining a target training data set;
[0182] The training module 53 is used to perform model training using the target training data set.
[0183] Optionally, when determining the label confidence of each candidate label corresponding to each training sample, the disambiguation module 51 is specifically configured to:
[0184] For any one of the training samples, the label confidence of each candidate label corresponding to the any one of the training samples is obtained by performing the following steps:
[0185] Determine k training samples closest to the arbitrary training sample as the k nearest neighbor set of the arbitrary training sample, where k is a positive integer greater than or equal to 1;
[0186] Determining a weight vector for any one of the training samples based on its k-nearest neighbor set, wherein the weight vector has a size of 1*m, where m is the number of training samples in the original training data set, and the value of each element in the weight vector represents the degree of influence of each training sample in the original training data set on the reconstruction of the any one of the training samples;
[0187] According to the weight vector of any one of the training samples, the label confidence of each candidate label corresponding to the any one of the training samples is determined respectively.
[0188] Optionally, when determining the weight vector of any training sample according to the k-nearest neighbor set of any training sample, the disambiguation module 51 is specifically configured to:
[0189] Determine a feature vector of any one of the training samples, and the sum of products of the values of each element in the weight vector and the corresponding training sample;
[0190] Establishing a non-negative linear least squares optimization objective function based on the difference between the feature vector of any one of the training samples and the sum, and establishing constraints on the optimization objective function based on the fact that the elements in the weight vector corresponding to the k-nearest neighbor set are greater than or equal to 0, and the elements in the weight vector corresponding to other training samples not in the k-nearest neighbor set are equal to 0;
[0191] According to the constraint conditions, an optimal solution of the optimization objective function is determined, and the optimal solution is used as a weight vector of any one of the training samples.
[0192] Optionally, when determining the label confidence of each candidate label corresponding to any one of the training samples according to the weight vector of the any one of the training samples, the disambiguation module 51 is specifically configured to:
[0193] Determine the labeling confidence of each candidate label corresponding to any one training sample according to the element value of the weight vector corresponding to each training sample in the k-nearest neighbor set and the labeling confidence of each candidate label corresponding to any one training sample in each training sample in the k-nearest neighbor set;
[0194] The initial value of the label confidence of each candidate label corresponding to each training sample is 1.
[0195] Optionally, when filtering the candidate tags corresponding to the training samples according to the tag confidence of each candidate tag, the disambiguation module 51 is specifically configured to:
[0196] Obtaining the confidence threshold corresponding to each training sample according to the average value of each element in the weight vector of each training sample;
[0197] For each training sample, candidate tags whose tag confidence is less than a corresponding confidence threshold are filtered out.
[0198] Optionally, the disambiguation module 51 is further configured to: if it is determined that the tag confidences of the candidate tags corresponding to the training samples are all less than the corresponding confidence thresholds, retain the candidate tag with the highest tag confidence, and filter out other candidate tags except the one with the highest tag confidence.
[0199] Optionally, when sampling the training samples corresponding to the filtered candidate markers so that the number of training samples corresponding to the candidate markers of different categories meets a preset number difference condition, and obtaining the target training data set, the sampling module 52 is specifically used to:
[0200] Determining the class imbalance rate of each candidate marker after filtering according to the number of training samples corresponding to each candidate marker after filtering;
[0201] Determine an imbalance rate threshold according to the determined imbalance rate of each category, and take the category of the candidate marker whose category imbalance rate is greater than the imbalance rate threshold as a subcategory;
[0202] Determine the number of samples to be taken for each subcategory;
[0203] According to the preset sampling method, for each of the subcategories, a corresponding number of training samples to be sampled are sampled, and the sampled training samples are added to the filtered original training data set to obtain a target training data set.
[0204] Optionally, when determining the number of samples to be sampled for each subclass respectively, the sampling module 52 is specifically used to: determine the difference between the number of training samples of the category corresponding to the imbalance rate threshold and the number of training samples of the category corresponding to each subclass respectively, to obtain the number of samples to be sampled for each subclass.
[0205] Optionally, when sampling a corresponding number of training samples to be sampled for each subcategory according to a preset sampling method, the sampling module 52 is specifically configured to:
[0206] For each of the subclasses, randomly copy the corresponding number of training samples to be sampled from the training samples corresponding to the candidate labels of the subclass.
[0207] Optionally, when sampling a corresponding number of training samples to be sampled for each subcategory according to a preset sampling method, the sampling module 52 is specifically configured to:
[0208] Determining the symbiosis degree of each candidate marker corresponding to each filtered training sample, wherein the symbiosis degree represents the correlation degree of each candidate marker;
[0209] Determining a symbiosis degree threshold according to an average value of the symbiosis degrees corresponding to each filtered training sample;
[0210] Splitting the training samples whose symbiosis degree is higher than the symbiosis degree threshold into a training sample containing only small-category candidate labels and a training sample containing only large-category candidate labels according to the corresponding candidate labels, wherein the large category represents the category of candidate labels whose category imbalance rate is not greater than the imbalance rate threshold;
[0211] For each of the subclasses, the sampling weights of the training samples of each subclass are determined respectively, and the corresponding number of training samples to be sampled are copied from high to low according to the determined sampling weights.
[0212] Optionally, when sampling a corresponding number of training samples to be sampled for each subcategory according to a preset sampling method, the sampling module 52 is specifically configured to:
[0213] For any one of the subcategories, the following steps are performed to obtain a corresponding number of training samples to be sampled for the subcategories:
[0214] Randomly selecting a corresponding number of training samples to be sampled from each training sample having a candidate label corresponding to any one of the subclasses as benchmark training samples;
[0215] For each selected benchmark training sample, among the training samples corresponding to the candidate label of any subclass, determine k training samples that are closest to the benchmark training sample, randomly select a training sample from the determined k training samples, and generate corresponding new training samples based on the benchmark training samples and the corresponding randomly selected training samples, where k is a positive integer greater than or equal to 1;
[0216] Generate candidate labels for each new training sample based on the k training samples that are closest to each benchmark training sample.
[0217] Optionally, when generating candidate labels for each new training sample based on the k training samples closest to each benchmark training sample, the sampling module 52 is specifically configured to:
[0218] Determine the weight vector of each benchmark training sample according to the k training samples closest to each benchmark training sample;
[0219] Determine the label confidence of each candidate label corresponding to each new training sample based on the weight vector of each benchmark training sample and the candidate labels corresponding to the k training samples closest to the determined distance;
[0220] Determining the confidence threshold corresponding to each new training sample respectively;
[0221] For each new training sample, the candidate labels whose label confidence is greater than or equal to the confidence threshold, and the candidate labels of any one of the subclasses, are used as candidate labels corresponding to the new training sample.
[0222] Based on the above embodiments, see Figure 6 Shown is a schematic structural diagram of an electronic device in an embodiment of the present application.
[0223] An embodiment of the present application provides an electronic device, which may be a terminal or a server. The embodiment of the present application is described using the electronic device as a server as an example. The electronic device may include a processor 610 (Center Processing Unit, CPU), a memory 620, an input device 630, an output device 640, and the like.
[0224] The memory 620 may include a read-only memory (ROM) and a random access memory (RAM), and provides the program instructions and data stored in the memory 620 to the processor 610. In the embodiment of the present application, the memory 620 may be used to store the program of any training data processing method in the embodiment of the present application.
[0225] The processor 610 calls the program instructions stored in the memory 620, and the processor 610 is used to execute any one of the training data processing methods in the embodiments of the present application according to the obtained program instructions.
[0226] Based on the above embodiments, in an embodiment of the present application, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the training data processing method in any of the above method embodiments is implemented.
[0227] Those skilled in the art will appreciate that all or part of the steps of the above-mentioned method embodiments may be implemented by hardware associated with program instructions, and the aforementioned program may be stored in a computer-readable storage medium. When the program is executed, the program executes the steps of the above-mentioned method embodiments. The aforementioned storage medium includes various media that can store program codes, such as mobile storage devices, read-only memories (ROMs), random access memories (RAMs), magnetic disks, or optical disks.
[0228] Alternatively, if the above-mentioned integrated unit of the present invention is implemented in the form of a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a number of instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as mobile storage devices, ROM, RAM, magnetic disks or optical disks.
Claims
1. A method for processing training data, characterized in that: include: Acquire an original training data set, wherein each training sample included in the original training data set corresponds to at least two candidate labels; Determining the label confidence of each candidate label corresponding to each training sample, and filtering each candidate label corresponding to each training sample according to the label confidence of each candidate label; Determining the class imbalance rate of each candidate marker after filtering according to the number of training samples corresponding to each candidate marker after filtering; Determine an imbalance rate threshold according to the determined imbalance rate of each category, and take the category of the candidate marker whose category imbalance rate is greater than the imbalance rate threshold as a subcategory; Determine the number of samples to be taken for each subcategory; According to a preset sampling method, for each of the subcategories, a corresponding number of training samples to be sampled are sampled, and the sampled training samples are added to the filtered original training data set to obtain a target training data set; The target training data set is used to perform model training.
2. The method according to claim 1, wherein Determining the label confidence of each candidate label corresponding to each training sample, specifically including: For any one of the training samples, the label confidence of each candidate label corresponding to the any one of the training samples is obtained by performing the following steps: Determine k training samples closest to the arbitrary training sample as the k nearest neighbor set of the arbitrary training sample, where k is a positive integer greater than or equal to 1; Determining a weight vector for any one of the training samples based on its k-nearest neighbor set, wherein the weight vector has a size of 1*m, where m is the number of training samples in the original training data set, and the value of each element in the weight vector represents the degree of influence of each training sample in the original training data set on the reconstruction of the any one of the training samples; According to the weight vector of any one of the training samples, the label confidence of each candidate label corresponding to the any one of the training samples is determined respectively.
3. The method according to claim 2, wherein Determining a weight vector of any one of the training samples according to the k-nearest neighbor set of the any one of the training samples specifically includes: Determine a feature vector of any one of the training samples, and the sum of products of the values of each element in the weight vector and the corresponding training sample; Establishing a non-negative linear least squares optimization objective function based on the difference between the feature vector of any one of the training samples and the sum, and establishing constraints on the optimization objective function based on the fact that the elements in the weight vector corresponding to the k-nearest neighbor set are greater than or equal to 0, and the elements in the weight vector corresponding to other training samples not in the k-nearest neighbor set are equal to 0; According to the constraint conditions, an optimal solution of the optimization objective function is determined, and the optimal solution is used as a weight vector of any one of the training samples.
4. The method according to claim 2 or 3, wherein: Determining the label confidence of each candidate label corresponding to the any one training sample according to the weight vector of the any one training sample, specifically including: Determine the labeling confidence of each candidate label corresponding to any one training sample according to the element value of the weight vector corresponding to each training sample in the k-nearest neighbor set and the labeling confidence of each candidate label corresponding to any one training sample in each training sample in the k-nearest neighbor set; The initial value of the label confidence of each candidate label corresponding to each training sample is 1.
5. The method according to claim 2, wherein Filtering the candidate tags corresponding to the training samples according to the tag confidence of each candidate tag, specifically including: Obtaining the confidence threshold corresponding to each training sample according to the average value of each element in the weight vector of each training sample; For each training sample, candidate tags whose tag confidence is less than a corresponding confidence threshold are filtered out.
6. The method according to claim 5, wherein Further including: If it is determined that the tag confidences of the candidate tags corresponding to the training samples are all less than the corresponding confidence thresholds, the candidate tag with the highest tag confidence is retained, and the other candidate tags except the one with the highest tag confidence are filtered out.
7. The method according to claim 1, wherein Determine the number of samples to be taken for each subcategory, including: The difference between the number of training samples of the category corresponding to the imbalance rate threshold and the number of training samples of the category corresponding to each subcategory is determined respectively to obtain the number of samples to be sampled for each subcategory.
8. The method according to claim 1, wherein According to the preset sampling method, sampling is performed for each subcategory to obtain a corresponding number of training samples to be sampled, specifically including: For each of the subclasses, randomly copy the corresponding number of training samples to be sampled from the training samples corresponding to the candidate labels of the subclass.
9. The method according to claim 1, wherein According to the preset sampling method, sampling is performed for each subcategory to obtain a corresponding number of training samples to be sampled, specifically including: Determining the symbiosis degree of each candidate marker corresponding to each filtered training sample, wherein the symbiosis degree represents the correlation degree of each candidate marker; Determining a symbiosis degree threshold according to an average value of the symbiosis degrees corresponding to each filtered training sample; Splitting the training samples whose symbiosis degree is higher than the symbiosis degree threshold into a training sample containing only small-category candidate labels and a training sample containing only large-category candidate labels according to the corresponding candidate labels, wherein the large category represents the category of candidate labels whose category imbalance rate is not greater than the imbalance rate threshold; For each of the subclasses, the sampling weights of the training samples of each subclass are determined respectively, and the corresponding number of training samples to be sampled are copied from high to low according to the determined sampling weights.
10. The method according to claim 1, wherein According to the preset sampling method, sampling is performed for each subcategory to obtain a corresponding number of training samples to be sampled, specifically including: For any one of the subcategories, the following steps are performed to obtain a corresponding number of training samples to be sampled for the subcategories: Randomly selecting a corresponding number of training samples to be sampled from each training sample having a candidate label corresponding to any one of the subclasses as benchmark training samples; For each selected benchmark training sample, among the training samples corresponding to the candidate label of any subclass, determine k training samples that are closest to the benchmark training sample, randomly select a training sample from the determined k training samples, and generate corresponding new training samples based on the benchmark training samples and the corresponding randomly selected training samples, where k is a positive integer greater than or equal to 1; Generate candidate labels for each new training sample based on the k training samples that are closest to each benchmark training sample.
11. The method according to claim 10, wherein Generating candidate labels for each new training sample based on the k training samples closest to each benchmark training sample, specifically including: Determine the weight vector of each benchmark training sample according to the k training samples closest to each benchmark training sample; Determine the label confidence of each candidate label corresponding to each new training sample based on the weight vector of each benchmark training sample and the candidate labels corresponding to the k training samples closest to the determined distance; Determining the confidence threshold corresponding to each new training sample respectively; For each new training sample, the candidate labels whose label confidence is greater than or equal to the confidence threshold, and the candidate labels of any one of the subclasses, are used as candidate labels corresponding to the new training sample.
12. A training data processing device, characterized in that: include: An acquisition module is used to acquire an original training data set, wherein each training sample included in the original training data set corresponds to at least two candidate labels; a disambiguation module, configured to respectively determine the label confidence of each candidate label corresponding to each training sample, and filter each candidate label corresponding to each training sample according to the label confidence of each candidate label; A sampling module is configured to determine the class imbalance rate of each candidate marker after filtering based on the number of training samples corresponding to each candidate marker after filtering; determine an imbalance rate threshold based on the determined class imbalance rate, and define the class of the candidate marker whose class imbalance rate is greater than the imbalance rate threshold as a subclass; determine the number of samples to be sampled for each subclass; sample the corresponding number of training samples to be sampled for each subclass according to a preset sampling method, and add the sampled training samples to the filtered original training data set to obtain a target training data set; A training module is used to perform model training using the target training data set.
13. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the steps of the method according to any one of claims 1 to 11 are implemented.
14. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 11 are implemented.
Citation Information
Patent Citations
Telecommunication fraud classification detection method based on an improved active learning technology
CN109492026A
Method and system for automatically removing sample mark noise
CN111259339A