Data processing method and data processing device
By adjusting the sample deletion ratio according to the discrete degree of the classification data set and dynamically adjusting the sample participation in the training cycle, the problem of low training accuracy of the deep learning model in the existing technology is solved, and the training efficiency is improved while reducing the training time. .
Patent Information
- Application Number
- CN201911066499.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2019-09-18
- Filing Date
- 2019-11-04
- Publication Date
- 2024-09-10
- Estimated Expiration
- 2039-11-04
AI Technical Summary
When training deep learning models in the existing technology, the data set is deleted by pre-setting the sample deletion ratio, resulting in low model training accuracy, especially when the samples of different classification data sets are very different.
Determine the sample deletion ratio according to the degree of discreteness of the classification data set, retain more samples with a high degree of discreteness, dynamically adjust the sample participation in the training cycle, and determine the sample removal probability through loss and error rate to optimize training accuracy and Reduce training time.
While maintaining training accuracy, the training time is reduced, the training efficiency of the model is improved, the training of similar samples is avoided, and the sample participation in the training process is dynamically adjusted.
Smart Images

Figure CN112529172B_ABST
Abstract
Description
[0001] This application claims priority to a Chinese patent application filed with the Chinese Patent Office on September 18, 2019, with application number 201910883282.7 and invention name “Data Processing Method and Data Processing Device”, the entire contents of which are incorporated by reference into this application. Technical Field
[0002] The present application relates to the field of machine learning, and in particular to a data processing method and a data processing device. Background Art
[0003] Deep learning is a branch of machine learning. Deep learning models require input data sets for training. Due to the large number of samples in the data set, the training time is usually long.
[0004] In the prior art, before training, the data set is refined. For the classified data set of each label category in the data set, a certain discard ratio is set in advance to perform sample reduction to obtain a refined data set. Model training is performed based on the refined data set to reduce training time.
[0005] In the prior art, classification data sets are pruned by presetting a discard ratio. If samples of different classification data sets differ greatly, the same preset pruned ratio will be used to prune them, resulting in lower model training accuracy under the condition of a certain data set pruned ratio. Summary of the invention
[0006] The embodiment of the present application provides a data processing method for refining a data set, which can improve training accuracy under the condition of a certain data set deletion ratio.
[0007] A first aspect of an embodiment of the present application provides a data processing method, comprising: obtaining an original data set; determining multiple classification data sets according to category labels of samples in the original data set, the multiple classification data sets including a first classification data set and a second classification data set; determining a first discrete degree of the first classification data set and a second discrete degree of the second classification data set; determining a first sample deletion ratio of the first classification data set and a second sample deletion ratio of the second classification data set according to the first discrete degree and the second discrete degree, if the first discrete degree is greater than the second discrete degree, the first sample deletion ratio is less than the second sample deletion ratio, if the first discrete degree is less than or equal to the second discrete degree, the first sample deletion ratio is greater than or equal to the second sample deletion ratio; determining a target data set, the target data set including samples retained by the first classification data set and samples retained by the second classification data set, the samples retained by the first classification data set are determined according to the first sample deletion ratio, the sample size of the first classification data set and a preset total sample deletion amount, and the samples retained by the second classification data set are determined according to the second sample deletion ratio, the sample size of the second classification data set and a preset total sample deletion amount.
[0008] The data processing method provided by the embodiment of the present application first obtains multiple classification data sets according to the category labels of the samples in the original data set, determines the first discrete degree of the first classification data set and the second discrete degree of the second classification data set, and determines the size relationship between the first sample deletion ratio of the first classification data set and the second sample deletion ratio of the second classification data set according to the size relationship between the first discrete degree and the second discrete degree. Since a large discrete degree represents a dispersed sample distribution, it is more valuable for model training, and determining a smaller deletion ratio will be beneficial to improving the training accuracy of the model. On the contrary, a small discrete degree represents a concentrated sample distribution, and the similarity between samples is high, which is less valuable for model training, thereby determining a larger deletion ratio. The data processing method provided by the embodiment of the present application determines the deletion ratio according to the discrete degree of the classification data set, and then obtains the final target sample set, which can improve the training accuracy of the deep learning neural network model under the condition of a certain data set deletion ratio. In addition, since more samples of the classification data set with a high discrete degree are retained, under the condition of maintaining the training accuracy of the neural network model unchanged, it can avoid repeated training of samples with high similarity, and can reduce the training time.
[0009] In a possible implementation of the first aspect, the first degree of discreteness is a first average divergence determined based on feature vectors of all samples in the first classification data set; and the second degree of discreteness is a second average divergence determined based on feature vectors of all samples in the second classification data set.
[0010] The data processing method provided in the embodiment of the present application measures the degree of discreteness of a classified data set by determining the average divergence of the feature vectors of all samples in the classified data set, that is, the average value of the divergence, and provides a specific implementation method for measuring the degree of discreteness of a classified data set, thereby improving the feasibility of the solution.
[0011] In a possible implementation of the first aspect, the first average divergence is the average of the first relative entropy KL divergence or the first Jason Shannon JS divergence, the first KL divergence is the KL divergence of the feature vectors of any two samples in the first classification data set, and the first JS divergence is the JS divergence of the feature vectors of any two samples in the first classification data set; the second average divergence is the second KL divergence or the average of the second JS divergence, the second KL divergence is the KL divergence of the feature vectors of any two samples in the second classification data set, and the second JS divergence is the JS divergence of the feature vectors of any two samples in the second classification data set.
[0012] The data processing method provided in the embodiment of the present application provides two ways to determine the average divergence of the first classification data set. The average divergence of the first classification data set can be determined by calculating the average value of the KL divergence of the feature vectors of any two samples in the first classification data set, or by calculating the average value of the JS divergence of the feature vectors of any two samples in the first classification data set, thereby increasing the flexibility of the implementation of the solution.
[0013] In a possible implementation manner of the first aspect, the first discrete degree is negatively correlated with the first sample deletion ratio, and the second discrete degree is negatively correlated with the second sample deletion ratio.
[0014] The data processing method provided in the embodiment of the present application is that when the discrete degree of each classified data set in the original data set remains unchanged, the discrete degree of the data set classification data set is negatively correlated with its sample deletion ratio.
[0015] In a possible implementation of the first aspect, determining a first sample deletion ratio of the first classification data set and a second sample deletion ratio of the second classification data set according to the first discrete degree and the second discrete degree includes: determining the sum of the divergences of each classification data set in the multiple classification data sets; determining the ratio of the first divergence to the sum of the divergences, and the ratio of the second divergence to the sum of the divergences; determining the first sample deletion ratio and the second sample deletion ratio according to the ratio of the first divergence to the sum of the divergences, the ratio of the second divergence to the sum of the divergences, the sample size of the first classification data set, the sample size of the second classification data set, and a preset total sample deletion amount.
[0016] The data processing method provided in the embodiment of the present application provides a method for determining the first sample deletion ratio based on the ratio of the divergence of the classified data set to the sum of the divergences of all classified data sets in the original data set, the sample size of the classified data set, and a preset total amount of sample deletion, thereby improving the feasibility of the solution.
[0017] In a possible implementation of the first aspect, determining the target data set includes: determining the samples retained in the first classification data set according to the density of the samples of the first classification data set and the first sample deletion ratio, the average density of the samples retained in the first classification data set is less than the average density of the samples of the first classification data set; determining the samples retained in the second classification data set according to the density of the samples of the second data set and the second sample deletion ratio, the average density of the samples retained in the second classification data set is less than the average density of the samples of the second data set.
[0018] The data processing method provided in the embodiment of the present application provides a method for determining which specific samples to retain, that is, determining whether to retain the sample based on the density of the sample in the classification data set. Since a high density means that the density of samples around the sample is high, that is, there are many samples similar to the sample, and the value for model training is low, so samples with high density are deleted first, and the average density of the retained samples is reduced. Under the condition of a certain amount of sample deletion, the training accuracy of the model can be improved; or, under the condition of maintaining the training accuracy of the neural network model unchanged, repeated training of samples with high similarity can be avoided to reduce the training time.
[0019] In a possible implementation manner of the first aspect, the density of the sample is the degree of abnormality of the sample calculated according to a local outlier factor LOF algorithm.
[0020] In the data processing method provided in the embodiment of the present application, the density may specifically be the degree of abnormality calculated according to the LOF algorithm.
[0021] In a possible implementation of the first aspect, the method further includes: inputting the target data set into a first training cycle of a neural network training model, the target data set including a first training sample; obtaining a first loss and / or a first error rate of the first training sample input into the first training cycle, the first error rate being a ratio of the number of misjudgments of the first training sample to the number of training times; and inputting the first training sample into a second training cycle when the first loss and / or the first error rate meets a preset condition, the second training cycle being the next training cycle of the first training cycle.
[0022] The data processing method provided in the embodiment of the present application can input the target data set obtained after static refinement into the neural network training model for training. In addition, during the training process, the samples that need to be removed in each training cycle can be further determined based on the loss and / or error rate of the training samples, so as to obtain the samples to enter the next training cycle.
[0023] A second aspect of an embodiment of the present application provides a data processing method, including: obtaining a first loss and / or a first error rate of a first training sample input into a first training cycle, the first error rate being the ratio of the number of misjudgments of the first training sample to the number of training times; and when the first loss and / or the first error rate meets a preset condition, inputting the first training sample into a second training cycle, the second training cycle being the next training cycle of the first training cycle.
[0024] The data processing method provided in the second aspect of the embodiment of the present application can measure the value of the sample for model training according to the first loss and / or the first error rate obtained by inputting the first training sample into the first training cycle for training. The greater the loss or the greater the error rate, the more difficult it is for the model and the more it needs to be input into the model for training. It is only input into the next training cycle when the first loss and / or the first error rate meet the preset conditions. Since in the prior art, the samples input into the network model for training are indiscriminately input into each training cycle, and as the training cycle progresses, the network model parameters continue to change, and the value of the sample to the network model of each training cycle also changes continuously, the samples are removed according to the data processing method provided in the embodiment of the present application, and the samples retained to the next training cycle are determined, which can reduce the training time consumed by low-value samples to participate in training, and reduce the overall training time under the condition of ensuring the training accuracy; or, reduce the training time under the condition of maintaining the training accuracy of the neural network model unchanged.
[0025] In a possible implementation manner of the second aspect, when the first loss and / or the first error rate meets a preset condition, inputting the first training sample into the second training cycle includes: if the first loss is greater than a first threshold, inputting the first training sample into the second training cycle; or, if the first error rate is greater than a second threshold, determining to input the first training sample into the second training cycle.
[0026] The data processing method provided in the embodiment of the present application determines that samples will be input into the next training cycle when the loss is greater than a threshold, or when the error rate is greater than a threshold. This can ensure that samples that are more difficult for the network model are input into the next training cycle, thereby avoiding loss of training accuracy.
[0027] In a possible implementation manner of the second aspect, the first threshold is a preset value, or a threshold determined according to a preset removal amount and a loss of all samples input into the first training cycle.
[0028] The data processing method provided in the embodiment of the present application provides a specific way to determine the first threshold of the loss, thereby enhancing the feasibility of the solution.
[0029] In a possible implementation manner of the second aspect, the second threshold is a preset value, or a threshold determined according to a preset removal amount and a misclassification rate of all samples input into the first training cycle.
[0030] The data processing method provided in the embodiment of the present application provides a specific method for determining the second threshold of the error rate, thereby enhancing the feasibility of the solution.
[0031] In a possible implementation of the second aspect, if the first loss and / or the first error rate meets a preset condition, determining to input the first training sample into the second training cycle includes: determining a removal probability of the first training sample based on the first loss and the first error rate; if the removal probability is less than a third threshold, determining to input the first training sample into the second training cycle.
[0032] The data processing method provided in the embodiment of the present application determines the probability of removing a sample based on the two dimensions of loss and error rate, and can more accurately measure the value of the sample.
[0033] In a possible implementation of the second aspect, the third threshold is a preset value, or a threshold determined based on the loss, error rate, density and preset removal amount of all samples input into the first training cycle, where the density is the density of the sample in a classification data set determined based on the sample category label.
[0034] The data processing method provided in the embodiment of the present application provides a specific way to determine the third threshold of the removal probability, thereby enhancing the feasibility of the solution.
[0035] In a possible implementation of the second aspect, the method further includes: obtaining the average value of the loss and the average value of the error rate of all samples input into the first training cycle; determining the target group of the first training sample according to whether the first loss is less than the average value of the loss and whether the first error rate is less than the average value of the error rate, the target group includes a first group, a second group, a third group and a fourth group, the loss of the samples of the first group is greater than or equal to the average value of the loss, and the error rate of the samples of the first group is greater than or equal to the average value of the error rate; the loss of the samples of the second group is greater than or equal to the average value of the loss, and the error rate of the samples of the second group is less than the average value of the error rate; the loss of the samples of the third group is less than the average value of the loss, and the error rate of the samples of the third group is less than the average value of the error rate; the loss of the samples of the fourth group is less than the average value of the loss, and the error rate of the samples of the fourth group is greater than or equal to the average value of the error rate. The method comprises the following steps: determining the removal amount of the target group according to the sample size of the first group and the preset removal ratio of the target group; determining the removal amount of the samples of the target group according to the sample size of the first group and the preset removal ratio of the target group; the preset removal ratio of the target group includes the removal ratio of the first group, the removal ratio of the second group, the removal ratio of the third group and the removal ratio of the fourth group, wherein the removal ratio of the first group is less than the removal ratio of the second group and the removal ratio of the fourth group, and the removal ratio of the third group is greater than the removal ratio of the second group and the removal ratio of the fourth group; determining the removal probability of the first training sample according to the first loss and the first error rate; if the removal probability of the first training sample is less than a preset threshold value, determining to input the first training sample into the second training cycle, the probability threshold value is a preset value, or a threshold value determined according to the loss, error rate, density of all samples of the first group and the sample removal amount of the first group, and the density is the density of the sample in the classification data set according to the sample category label.
[0036] The data processing method provided in the embodiment of the present application can determine sample grouping based on the two dimensions of loss and error rate, determine the sample removal amount of each group based on the preset group removal ratio, and determine the retained samples in each group based on the sample removal probability, providing an effective method for accurately measuring the value of samples and retaining them until the next training cycle.
[0037] According to a third aspect of an embodiment of the present application, there is provided a data processing device, comprising: an acquisition module, for acquiring an original data set; a determination module, for determining, based on the category labels of samples in the original data set, a plurality of classified data sets, the plurality of classified data sets comprising a first classified data set and a second classified data set; the determination module is further used to determine a first discrete degree of the first classified data set and a second discrete degree of the second classified data set; the determination module is further used to determine, based on the first discrete degree and the second discrete degree, a first sample deletion ratio of the first classified data set and a second sample deletion ratio of the second classified data set; if the first discrete degree is greater than the second discrete degree, the first sample deletion ratio of the first classified data set is reduced; degree, the first sample deletion ratio is less than the second sample deletion ratio; if the first discrete degree is less than or equal to the second discrete degree, the first sample deletion ratio is greater than or equal to the second sample deletion ratio; the determination module is also used to determine a target data set, the target data set includes samples retained by the first classification data set and samples retained by the second classification data set, the samples retained by the first classification data set are determined according to the first sample deletion ratio, the sample size of the first classification data set and the preset total sample deletion amount, and the samples retained by the second classification data set are determined according to the second sample deletion ratio, the sample size of the second classification data set and the preset total sample deletion amount.
[0038] In a possible implementation of the third aspect, the first degree of discreteness is a first average divergence determined based on the feature vectors of all samples in the first classification data set; and the second degree of discreteness is a second average divergence determined based on the feature vectors of all samples in the second classification data set.
[0039] In a possible implementation of the third aspect, the first average divergence is the average of the first relative entropy KL divergence or the first Jason Shannon JS divergence, the first KL divergence is the KL divergence of the feature vectors of any two samples in the first classification data set, and the first JS divergence is the JS divergence of the feature vectors of any two samples in the first classification data set; the second average divergence is the second KL divergence or the average of the second JS divergence, the second KL divergence is the KL divergence of the feature vectors of any two samples in the second classification data set, and the second JS divergence is the JS divergence of the feature vectors of any two samples in the second classification data set.
[0040] In a possible implementation manner of the third aspect, the first discrete degree is negatively correlated with the first sample deletion ratio, and the second discrete degree is negatively correlated with the second sample deletion ratio.
[0041] In a possible implementation manner of the third aspect, the determination module is specifically used to: determine the sum of the divergences of each classification data set in the multiple classification data sets; determine the ratio of the first divergence to the sum of the divergences, and the ratio of the second divergence to the sum of the divergences; determine the first sample deletion ratio and the second sample deletion ratio according to the ratio of the first divergence to the sum of the divergences, the ratio of the second divergence to the sum of the divergences, the sample size of the first classification data set, the sample size of the second classification data set, and a preset total amount of sample deletion.
[0042] In a possible implementation of the third aspect, the determination module is specifically used to: determine the samples retained by the first classification data set based on the density of the samples of the first classification data set and the first sample deletion ratio, and the average density of the samples retained by the first classification data set is less than the average density of the samples of the first classification data set; determine the samples retained by the second classification data set based on the density of the samples of the second data set and the second sample deletion ratio, and the average density of the samples retained by the second classification data set is less than the average density of the samples of the second data set.
[0043] In a possible implementation manner of the third aspect, the density of the sample is the abnormality of the sample calculated according to a local outlier factor LOF algorithm.
[0044] In a possible implementation of the third aspect, the device also includes: an input module, used to input the target data set into a first training cycle of a neural network training model, the target data set including a first training sample; the acquisition module is also used to obtain a first loss and / or a first error rate of the first training sample input into the first training cycle, the first error rate being the ratio of the number of misjudgments of the first training sample to the number of training times; the input module is also used to, if the first loss and / or the first error rate meets a preset condition, input the first training sample into a second training cycle, the second training cycle being the next training cycle of the first training cycle.
[0045] A fourth aspect of an embodiment of the present application provides a data processing device, including: an acquisition module, used to obtain a first loss and / or a first error rate of a first training sample input into a first training cycle, the first error rate being the ratio of the number of misjudgments of the first training sample to the number of training times; an input module, used to input the first training sample into a second training cycle if the first loss and / or the first error rate meets a preset condition, the second training cycle being the next training cycle of the first training cycle.
[0046] In a possible implementation of the fourth aspect, the input module is specifically used to: if the first loss is greater than a first threshold, input the first training sample into a second training cycle; or, if the first error rate is greater than a second threshold, determine to input the first training sample into the second training cycle.
[0047] In a possible implementation manner of the fourth aspect, the first threshold is a preset value, or a threshold determined according to a preset removal amount and a loss of all samples input into the first training cycle.
[0048] In a possible implementation manner of the fourth aspect, the second threshold is a preset value, or a threshold determined according to a preset removal amount and an error rate of all samples input into the first training cycle.
[0049] In a possible implementation of the fourth aspect, the input module is specifically used to: determine the removal probability of the first training sample based on the first loss and the first error rate; if the removal probability is less than a third threshold, determine to input the first training sample into the second training cycle.
[0050] In a possible implementation of the fourth aspect, the third threshold is a preset value, or a threshold determined based on the loss, error rate, density and preset removal amount of all samples input into the first training cycle, and the density is the density of the sample in the classification data set determined based on the sample category label.
[0051] In a possible implementation of the fourth aspect, the acquisition module is also used to obtain the average value of the loss and the average value of the error rate of all samples input into the first training cycle; the determination module is used to determine the target group of the first training sample according to whether the first loss is less than the average value of the loss and whether the first error rate is less than the average value of the error rate; the determination module is also used to determine the sample removal amount of the target group according to the sample size of the first group and the preset removal ratio of the target group; the determination module is also used to determine the removal probability of the first training sample according to the first loss and the first error rate; the determination module is also used to determine to input the first training sample into the second training cycle if the removal probability of the first training sample is less than a preset threshold value, and the probability threshold value is a preset value, or a threshold value determined according to the loss, error rate, density of all samples in the first group and the sample removal amount of the first group, and the density is the density of the sample in the classification data set according to the sample category label.
[0052] A fifth aspect of an embodiment of the present application provides a data processing method, including: obtaining an original data set; determining multiple classification data sets according to category labels of samples in the original data set, the multiple classification data sets including a first classification data set and a second classification data set; determining a first discrete degree of the first classification data set and a second discrete degree of the second classification data set; determining a first sample deletion ratio of the first classification data set and a second sample deletion ratio of the second classification data set according to the first discrete degree and the second discrete degree, if the first discrete degree is greater than the second discrete degree, then the first sample deletion ratio is less than the second sample deletion ratio, if the first discrete degree is less than or equal to the second discrete degree, then the first sample deletion ratio is greater than or equal to the second sample deletion ratio; determining a first target data set, the first target data set including samples retained by the first classification data set and samples retained by the second classification data set, the samples retained by the first classification data set are determined according to the first sample deletion ratio, the sample size of the first classification data set and a preset first sample deletion total amount, and the samples retained by the second classification data set are determined according to the second sample deletion ratio, the sample size of the second classification data set and a preset sample deletion total amount.
[0053] In a possible implementation of the fifth aspect, the first degree of discreteness is a first average divergence determined based on the feature vectors of all samples in the first classification data set; the second degree of discreteness is a second average divergence determined based on the feature vectors of all samples in the second classification data set.
[0054] In a possible implementation of the fifth aspect, the first average divergence is the average of the first relative entropy KL divergence or the first Jason Shannon JS divergence, the first KL divergence is the KL divergence of the feature vectors of any two samples in the first classification data set, and the first JS divergence is the JS divergence of the feature vectors of any two samples in the first classification data set; the second average divergence is the average of the second KL divergence or the second JS divergence, the second KL divergence is the KL divergence of the feature vectors of any two samples in the second classification data set, and the second JS divergence is the JS divergence of the feature vectors of any two samples in the second classification data set.
[0055] In a possible implementation manner of the fifth aspect, determining a first sample deletion ratio of the first classification data set and a second sample deletion ratio of the second classification data set according to the first discrete degree and the second discrete degree includes: determining the sum of the divergences of each classification data set in the multiple classification data sets; determining a ratio of the first divergence to the sum of the divergences, and a ratio of the second divergence to the sum of the divergences; determining the first sample deletion ratio and the second sample deletion ratio according to the ratio of the first divergence to the sum of the divergences, the ratio of the second divergence to the sum of the divergences, the sample size of the first classification data set, the sample size of the second classification data set, and a preset total sample deletion amount.
[0056] In a possible implementation of the fifth aspect, the preset total amount of sample deletion is determined based on a preset total sample deletion ratio and the total amount of samples in the original data set.
[0057] In a possible implementation manner of the fifth aspect, the first discrete degree is negatively correlated with the first sample deletion ratio, and the second discrete degree is negatively correlated with the second sample deletion ratio.
[0058] In a possible implementation of the fifth aspect, determining the first target data set includes: determining a first sample reduction amount of the first classification data set according to the first sample reduction ratio and the sample size of the first classification data set; determining a second sample reduction amount of the second classification data set according to the second sample reduction ratio and the sample size of the second classification data set; deleting samples from the first classification data set based on the first sample reduction amount to determine the samples retained by the first classification data set, the density mean of the samples retained by the first classification data set is smaller than the density mean of the samples of the first classification data set; deleting samples from the second classification data set based on the second sample reduction amount to determine the samples retained by the second classification data set, the density mean of the samples retained by the second classification data set is smaller than the density mean of the samples of the second data set; the density mean is the mean of the abnormality of the samples calculated according to the local outlier factor LOF algorithm.
[0059] In a possible implementation of the fifth aspect, the method further includes: inputting the first target data set determined according to a preset first sample deletion amount into a first training cycle of a neural network training model; and inputting the second target data set determined according to a preset second sample deletion amount into a second training cycle of the neural network training model, wherein the preset first sample deletion amount is different from the preset second sample deletion amount.
[0060] In a possible implementation manner of the fifth aspect, the method also includes: inputting the first target data set into a first training cycle of a neural network training model, the first target data set including a first training sample; obtaining a first loss and / or a first error rate of the first training sample input into the first training cycle, the first error rate being the ratio of the number of misjudgments of the first training sample to the number of training times; and when the first loss and / or the first error rate meets a preset condition, inputting the first training sample into a second training cycle, the second training cycle being the next training cycle of the first training cycle.
[0061] A sixth aspect of an embodiment of the present application provides a data processing method, including: obtaining a first loss and / or a first error rate of a first training sample input into a first training cycle, the first error rate being the ratio of the number of misjudgments of the first training sample to the number of training times, the first training sample being a sample in a training data set; when the first loss and / or the first error rate meets a preset condition, inputting the first training sample into a second training cycle, the second training cycle being the next training cycle of the first training cycle.
[0062] In a possible implementation manner of the sixth aspect, when the first loss and / or the first error rate meets a preset condition, inputting the first training sample into the second training cycle includes: if the first loss is greater than a first threshold, inputting the first training sample into the second training cycle; or, if the first error rate is greater than a second threshold, determining to input the first training sample into the second training cycle.
[0063] In a possible implementation manner of the sixth aspect, the first threshold is a preset value, or a threshold determined according to a preset removal amount of the training data set and a loss of all samples input into the first training cycle.
[0064] In a possible implementation manner of the sixth aspect, the second threshold is a preset value, or a threshold determined according to a preset removal amount of the training data set and an error rate of all samples input into the first training cycle.
[0065] In a possible implementation manner of the sixth aspect, if the first loss and / or the first error rate meets a preset condition, determining to input the first training sample into the second training cycle includes: determining a removal probability of the first training sample based on the first loss and the first error rate; if the removal probability is less than a third threshold, determining to input the first training sample into the second training cycle.
[0066] In a possible implementation of the sixth aspect, the third threshold is a preset value, or a threshold determined based on the loss, error rate, density of all samples input into the first training cycle and a preset removal amount of samples input into the next training cycle, and the density is the density of the sample in the classification data set determined based on the sample category label.
[0067] In a possible implementation of the sixth aspect, when the first loss and / or the first error rate meets a preset condition, inputting the first training sample into the second training cycle includes: obtaining the average value of the loss and the average value of the error rate of all samples input into the first training cycle; determining the target group of the first training sample according to whether the first loss is less than the average value of the loss and whether the first error rate is less than the average value of the error rate, the target group includes a first group, a second group, a third group or a fourth group, the loss of the samples of the first group is greater than or equal to the average value of the loss, and the error rate of the samples of the first group is greater than or equal to the average value of the error rate; the loss of the samples of the second group is greater than or equal to the average value of the loss, and the error rate of the samples of the second group is less than the average value of the error rate; the loss of the samples of the third group is less than the average value of the loss. mean, the error rate of the samples of the third group is less than the average value of the error rates; the loss of the samples of the fourth group is less than the average value of the losses, and the error rate of the samples of the fourth group is greater than or equal to the average value of the error rates; according to the sample size of the target group and the preset sample removal ratio of the target group, the sample removal amount of the target group is determined, the removal ratio of the first group is less than the removal ratio of the second group and the removal ratio of the fourth group, and the removal ratio of the third group is greater than the removal ratio of the second group and the removal ratio of the fourth group; the removal probability of the first training sample is determined according to the first loss and the first error rate; if the removal probability of the first training sample is less than a preset threshold, it is determined to input the first training sample into the second training cycle, and the probability threshold is determined according to the loss of all samples of the target group, the error rate and the sample removal amount of the target group.
[0068] According to a seventh aspect of an embodiment of the present application, there is provided a data processing device, comprising: an acquisition module, configured to acquire an original data set; a determination module, configured to determine, according to category labels of samples in the original data set, a plurality of classification data sets, wherein the plurality of classification data sets include a first classification data set and a second classification data set; the determination module is further configured to determine a first discrete degree of the first classification data set and a second discrete degree of the second classification data set; the determination module is further configured to determine, according to the first discrete degree and the second discrete degree, a first sample deletion ratio of the first classification data set and a second sample deletion ratio of the second classification data set, wherein if the first discrete degree is greater than the second discrete degree, the first sample deletion ratio is less than the second sample deletion ratio, and if the first discrete degree is less than or equal to the second discrete degree, the first sample deletion ratio is greater than or equal to the second sample deletion ratio; the determination module is further configured to determine a first target data set, wherein the first target data set includes samples retained by the first classification data set and samples retained by the second classification data set, wherein the samples retained by the first classification data set are determined according to the first sample deletion ratio, the sample size of the first classification data set and a preset first sample deletion total amount, and the samples retained by the second classification data set are determined according to the second sample deletion ratio, the sample size of the second classification data set and a preset sample deletion total amount.
[0069] In a possible implementation of the seventh aspect, the first degree of discreteness is a first average divergence determined based on the feature vectors of all samples in the first classification data set; the second degree of discreteness is a second average divergence determined based on the feature vectors of all samples in the second classification data set.
[0070] In a possible implementation of the seventh aspect, the first average divergence is the average of the first relative entropy KL divergence or the first Jason Shannon JS divergence, the first KL divergence is the KL divergence of the feature vectors of any two samples in the first classification data set, and the first JS divergence is the JS divergence of the feature vectors of any two samples in the first classification data set; the second average divergence is the average of the second KL divergence or the second JS divergence, the second KL divergence is the KL divergence of the feature vectors of any two samples in the second classification data set, and the second JS divergence is the JS divergence of the feature vectors of any two samples in the second classification data set.
[0071] In a possible implementation manner of the seventh aspect, the determination module is specifically used to: determine the sum of the divergences of each classification data set in the multiple classification data sets; determine the ratio of the first divergence to the sum of the divergences, and the ratio of the second divergence to the sum of the divergences; determine the first sample deletion ratio and the second deletion ratio based on the ratio of the first divergence to the sum of the divergences, the ratio of the second divergence to the sum of the divergences, the sample size of the first classification data set, the sample size of the second classification data set and a preset total sample deletion amount.
[0072] In a possible implementation of the seventh aspect, the preset total amount of sample deletion is determined based on a preset total sample deletion ratio and the total amount of samples in the original data set.
[0073] In a possible implementation manner of the seventh aspect, the first discrete degree is negatively correlated with the first sample deletion ratio, and the second discrete degree is negatively correlated with the second sample deletion ratio.
[0074] In a possible implementation of the seventh aspect, the determination module is specifically used to: determine a first sample reduction amount of the first classification data set according to the first sample reduction ratio and the sample size of the first classification data set; determine a second sample reduction amount of the second classification data set according to the second sample reduction ratio and the sample size of the second classification data set; delete samples from the first classification data set based on the first sample reduction amount to determine the samples retained by the first classification data set, and the density mean of the samples retained by the first classification data set is less than the density mean of the samples of the first classification data set; delete samples from the second classification data set based on the second sample reduction amount to determine the samples retained by the second classification data set, and the density mean of the samples retained by the second classification data set is less than the density mean of the samples of the second data set; the density mean is the mean of the abnormality of the samples calculated according to the local outlier factor LOF algorithm.
[0075] In a possible implementation of the seventh aspect, the determination module is further used to: input the first target data set determined according to a preset first sample deletion amount into a first training cycle of a neural network training model; the device also includes: an input module, used to input the second target data set determined according to a preset second sample deletion amount into a second training cycle of the neural network training model, and the preset first sample deletion amount is different from the preset second sample deletion amount.
[0076] In a possible implementation of the seventh aspect, the device also includes: an input module, used to input the first target data set into a first training cycle of a neural network training model, the first target data set including a first training sample; the acquisition module is also used to obtain a first loss and / or a first error rate of the first training sample input into the first training cycle, the first error rate being the ratio of the number of misjudgments of the first training sample to the number of training times; the input module is also used to input the first training sample into a second training cycle when the first loss and / or the first error rate meets a preset condition, the second training cycle being the next training cycle of the first training cycle.
[0077] An eighth aspect of an embodiment of the present application provides a data processing device, including: an acquisition module, used to obtain a first loss and / or a first error rate of a first training sample input into a first training cycle, the first error rate being the ratio of the number of misjudgments of the first training sample to the number of training times, the first training sample being a sample in a training data set; an input module, used to input the first training sample into a second training cycle when the first loss and / or the first error rate meets a preset condition, the second training cycle being the next training cycle of the first training cycle.
[0078] In a possible implementation of the eighth aspect, the input module is specifically used to: if the first loss is greater than a first threshold, input the first training sample into a second training cycle; or, if the first error rate is greater than a second threshold, determine to input the first training sample into the second training cycle.
[0079] In a possible implementation manner of the eighth aspect, the first threshold is a preset value, or a threshold determined according to a preset removal amount of the training data set and a loss of all samples input into the first training cycle.
[0080] In a possible implementation manner of the eighth aspect, the second threshold is a preset value, or a threshold determined according to a preset removal amount of the training data set and an error rate of all samples input into the first training cycle.
[0081] In a possible implementation of the eighth aspect, the input module is specifically used to: determine a removal probability of the first training sample based on the first loss and the first error rate; if the removal probability is less than a third threshold, determine to input the first training sample into a second training cycle.
[0082] In a possible implementation of the eighth aspect, the third threshold is a preset value, or a threshold determined based on the loss, error rate, density of all samples input into the first training cycle and a preset removal amount of samples input into the next training cycle, and the density is the density of the sample in the classification data set determined based on the sample category label.
[0083] In a possible implementation of the eighth aspect, the acquisition module is further used to obtain the average value of the loss and the average value of the error rate of all samples input into the first training cycle; the determination module is used to determine the target group of the first training samples according to whether the first loss is less than the average value of the loss and whether the first error rate is less than the average value of the error rate, the target group includes a first group, a second group, a third group or a fourth group, the loss of the samples of the first group is greater than or equal to the average value of the loss, and the error rate of the samples of the first group is greater than or equal to the average value of the error rate; the loss of the samples of the second group is greater than or equal to the average value of the loss, and the error rate of the samples of the second group is less than the average value of the error rate; the loss of the samples of the third group is less than the average value of the loss, and the error rate of the samples of the third group is less than the average value of the error rate; The loss of samples of the group is less than the average value of the loss, and the error rate of samples of the fourth group is greater than or equal to the average value of the error rate; the determination module is also used to determine the sample removal amount of the target group according to the sample size of the target group and the preset sample removal ratio of the target group, the removal ratio of the first group is less than the removal ratio of the second group and the removal ratio of the fourth group, and the removal ratio of the third group is greater than the removal ratio of the second group and the removal ratio of the fourth group; the determination module is also used to determine the removal probability of the first training sample according to the first loss and the first error rate; the determination module is also used to determine to input the first training sample into the second training cycle if the removal probability of the first training sample is less than a preset threshold, and the probability threshold is determined according to the loss of all samples of the target group, the error rate and the sample removal amount of the target group.
[0084] A ninth aspect of an embodiment of the present application provides a data processing device, comprising: a memory for storing instructions; a processor for executing instructions in the memory, so that the data processing device performs the method as described in any one of the first aspect or the second aspect and each implementation manner.
[0085] A tenth aspect of an embodiment of the present application provides a computer program product, which includes instructions. When the instructions are executed on a computer, the computer executes the method as described in any one of the first aspect or the second aspect and each implementation manner.
[0086] In an eleventh aspect of an embodiment of the present application, a computer-readable storage medium is provided, which stores instructions. When the instructions are executed on a computer, the computer executes the method as described in any one of the first aspect or the second aspect and each implementation manner.
[0087] It can be seen from the above technical solutions that the embodiments of the present application have the following advantages:
[0088] The data processing method provided in the embodiment of the present application obtains a classification data set through a sample category label, determines a deletion ratio according to the discreteness of the classification data set, performs sample deletion according to the sample size and deletion ratio of the classification data set, and determines the target sample to be retained. Since the discreteness of classification data sets with different category labels is different, the deletion ratio is determined according to the discreteness, so that more samples of classification data sets with high discreteness can be retained, thereby improving the training accuracy of the neural network model under the condition that the deletion ratio of the original data set is certain. Since more samples of classification data sets with high discreteness are retained, under the condition of maintaining the training accuracy of the neural network model unchanged, repeated training of samples with high similarity can be avoided, and the training time can be reduced.
[0089] In addition, the data processing method provided in the embodiment of the present application, if the sample is determined to be less difficult for the training model based on the loss and / or error rate, it will not participate in the next training cycle. Determining whether to participate in the next cycle of training by sample loss and / or error rate can dynamically adjust the samples participating in the training. Since the samples participating in each training cycle are only part of the data set, the training time can be reduced. BRIEF DESCRIPTION OF THE DRAWINGS
[0090] Figure 1 Refining system architecture diagram for the dataset;
[0091] Figure 2 This is a schematic diagram of an embodiment of a data processing method in an embodiment of the present application;
[0092] Figure 3 This is another schematic diagram of an embodiment of the data processing method in the embodiment of the present application;
[0093] Figure 4 This is a schematic diagram of an embodiment of a data processing method in an embodiment of the present application;
[0094] Figure 5 This is a schematic diagram of an embodiment of deleting samples according to the abnormality of samples in the embodiment of the present application;
[0095] Figure 6 Schematic diagram of four-space grouping according to loss and error rate in the embodiment of the present application;
[0096] Figure 7 This is a schematic diagram of an embodiment of a data processing device in an embodiment of the present application;
[0097] Figure 8 This is another schematic diagram of an embodiment of a data processing device in an embodiment of the present application;
[0098] Fig. 9 A schematic diagram of the system architecture of the data processing method in an embodiment of the present application;
[0099] Fig.10 It is a schematic diagram of an embodiment of a data processing device in an embodiment of the present application. DETAILED DESCRIPTION
[0100] The embodiment of the present application provides a data processing method for refining a data set, which can improve the training accuracy under the condition of a certain data set deletion ratio; or reduce the training time under the condition of unchanged training accuracy.
[0101] Deep learning is a branch of machine learning. In the actual application of deep learning, a deep learning network model is usually pre-trained based on the original data set, and then subsequent prediction work is performed through the network model.
[0102] As the performance of deep neural network models continues to improve, the depth and computational complexity of the models are also increasing, resulting in an increase in the training time of deep neural network models. By refining the data set and removing some redundant or strongly correlated data, the training process of the neural network model can be accelerated.
[0103] Refining the data set and training based on the refined data set can reduce the training time of the deep learning model while maintaining high test accuracy.
[0104] The following describes the embodiments of the present application in conjunction with the accompanying drawings. Obviously, the described embodiments are only embodiments of a part of the present application, rather than all embodiments. It is known to those skilled in the art that with the development of technology and the emergence of new scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0105] The terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments described here can be implemented in an order other than that illustrated or described here. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or modules is not necessarily limited to those steps or modules clearly listed, but may include other steps or modules that are not clearly listed or inherent to these processes, methods, products or devices. The naming or numbering of steps in this application does not mean that the steps in the method flow must be executed in the time / logical sequence indicated by the naming or numbering. The process steps that have been named or numbered can change the execution order according to the technical purpose to be achieved, as long as the same or similar technical effects can be achieved.
[0106] See also Figure 1 , which is the architecture diagram of the dataset refining system.
[0107] The original data set includes multiple samples. The original data set is sampled by the data refinement algorithm to obtain the sample sampling weight. The sample is randomly sampled in each training cycle according to the weight to obtain the refined target data set, which is input into the network model to be trained for training. The trained network model is verified by inputting the validation data set to determine the training accuracy of the trained network model.
[0108] For example, through the data processing method provided in the embodiment of the present application, the ImageNet data set is analyzed and simplified. In the process of training the ResNet50 network model, a portion of redundant or strongly correlated data is removed from the ImageNet data set to accelerate the training process of the neural network, while ensuring that the trained network model can maintain a high training accuracy.
[0109] The dataset processing method provided in the embodiment of the present application is used to refine the dataset. One method is to delete the dataset before inputting it into the network model to be trained. In the embodiment of the present application, the dataset refining process is referred to as static refining. Another method is to input the dataset into the network model to be trained, and during the training process, partially remove the dataset input into each training cycle. In the embodiment of the present application, the dataset refining process is referred to as dynamic refining.
[0110] It should be noted that for the data set processing of network model training, static refining or dynamic refining can be implemented separately, or static refining and dynamic refining can be implemented simultaneously, which is not limited here. The specific implementation methods of static refining and dynamic refining are introduced below.
[0111] See also Figure 2 , which is a schematic diagram of an embodiment of the data processing method in the embodiment of the present application.
[0112] 201. Classify the original data set according to the sample category label;
[0113] The original dataset usually includes a large number of samples, each of which has a category label to indicate the category of the sample. The category label is also called a label or annotation.
[0114] The original data set can be classified according to the sample category labels to obtain multiple classified data sets, which include at least two classified data sets, a first classified data set and a second classified data set.
[0115] 202. Determine a first discrete degree of the first classified data set and a second discrete degree of the second classified data set;
[0116] Determine a first degree of dispersion of the first classification data set and a second degree of dispersion of the second classification data set, where dispersion refers to the degree of compression and stretching of a distribution, relative to position or central tendency. The dispersion can be measured by variance, standard deviation, and interquartile range. In the embodiment of the present application, the degree of similarity of samples of the classification data set can be indicated according to the dispersion.
[0117] 203. Determine a first sample deletion ratio of the first classification data set and a second sample deletion ratio of the second classification data set according to the first discrete degree and the second discrete degree;
[0118] Determine the sample deletion ratio of the classification data set according to the degree of discreteness. If the degree of discreteness of the classification data set is large, it means that the sample similarity is low and the samples are dispersed. The deletion ratio should be reduced to avoid losing samples with higher value. Conversely, if the degree of discreteness of the classification data set is small, it means that the sample similarity is high and the sample distribution is concentrated. The deletion ratio can be increased to reduce repeated training.
[0119] Since the first discrete degree is greater than the second discrete degree, the first sample deletion ratio is less than the second sample deletion ratio.
[0120] Optionally, the first degree of dispersion is negatively correlated with the first sample deletion ratio, that is, when the degree of dispersion of other classification data sets remains unchanged, the first sample deletion ratio decreases as the first degree of dispersion increases, and the first sample deletion ratio increases as the first degree of dispersion decreases, and the correlation coefficient between the first sample deletion ratio and the first degree of dispersion is negative. Similarly, the second degree of dispersion is negatively correlated with the second sample deletion ratio, when the degree of dispersion of other classification data sets remains unchanged, the second sample deletion ratio decreases as the second degree of dispersion increases, and the second sample deletion ratio increases as the second degree of dispersion decreases, and the correlation coefficient between the second sample deletion ratio and the second degree of dispersion is negative.
[0121] 204. Obtain a target data set;
[0122] After determining the first sample deletion and second sample deletion ratios, samples can be deleted from the first classification data set according to the first sample deletion ratio, the second sample deletion ratio, the sample size of the first classification data set, the sample size of the second classification data set and a preset total sample deletion amount, and samples can be deleted from the second classification data set according to the second sample deletion amount; based on the samples retained in the first classification data set and the samples retained in the second classification data set, a retained target data set can be obtained.
[0123] The data processing method provided in the embodiment of the present application obtains a classification data set through a sample category label, determines a deletion ratio according to the discreteness of the classification data set, performs sample deletion according to the sample size and deletion ratio of the classification data set, and determines the target sample to be retained. Since the discreteness of classification data sets with different category labels is different, the deletion ratio is determined according to the discreteness, so that more samples of classification data sets with high discreteness can be retained, thereby improving the training accuracy of the neural network model under the condition that the deletion ratio of the original data set is certain; or, under the condition that the training accuracy remains unchanged, the training time is reduced.
[0124] See also Figure 3 , is a schematic diagram of another embodiment of the data processing method in the embodiment of the present application.
[0125] 301. Obtain a target data set for input neural network model training;
[0126] Obtain a target data set for input neural network model training. The target data set may be an original data set downloaded from the Internet or a statically refined data set, which is not limited here.
[0127] The neural network model training includes multiple training cycles, and the target data set includes a first training sample input into the first training cycle.
[0128] 302. Determine a first loss and / or a first error rate of the first training sample;
[0129] The first training sample is a sample input into the first training cycle, and the first loss and / or first error rate of the first training sample in the first training cycle is determined. Loss is a measurement indicator in the training of a neural network model, which is used to measure the degree to which the model's prediction deviates from its label. The error rate is the ratio of the number of misjudgments to the number of training times, where the number of misjudgments is the number of times the sample is misjudged, and the number of training times is the number of times the sample participates in training, that is, the number of training cycles input.
[0130] 303. If the first loss and / or the first error rate meets a preset condition, determine to input the first training sample into a second training cycle;
[0131] The second training cycle is a next training cycle of the first training cycle.
[0132] There are many ways to determine the samples to be input into the next training cycle based on the loss and / or error rate, which are not specifically limited here.
[0133] It is understandable that the greater the loss of a sample, the more difficult it is for the model, and the more it needs to be input into the model for training. The greater the probability of inputting into the next training cycle, the smaller the probability of removal; conversely, the smaller the loss, the greater the probability of removal. The greater the sample's misjudgment rate, the easier it is for the model to misjudge it, and the smaller the probability of removal; conversely, the smaller the misjudgment rate, the easier it is for the model to judge it, and the less helpful it is for the subsequent training of the model, and the greater the probability of removal.
[0134] Optionally, obtain the loss of the first training sample set input into the first training cycle, and remove the samples in the first training sample set in ascending order of loss until the number of removed samples reaches a preset value or a preset ratio; or remove samples whose loss is less than a preset loss threshold.
[0135] Optionally, obtain the error rate of the first training sample set input into the first training cycle, sort the samples in the first training sample set in ascending order of error rate and start removing them until the number of removed samples reaches a preset value or a preset ratio; or remove samples whose error rate is less than a preset error rate threshold.
[0136] Optionally, comprehensively consider the loss and error rate of the samples, and divide the samples into four groups based on the two dimensions of loss and error rate. Specifically, with the error rate as the X-axis, the loss as the Y-axis, and (mean error rate, mean loss) as the origin, divide the samples into four quadrants to obtain four spatial groups, and determine the number of removals for each spatial grouping based on the ratio of the removal rates of the four preset spatial groups to the total removal rate. There are many ways to determine the samples to be removed from a spatial grouping, optionally, random removal; optionally, determining the samples to be removed based on the loss and error rate of the samples, as well as the abnormality of the samples, which are not limited here.
[0137] It should be noted that the samples input into the first training cycle are part of the target data set. For the removed sample set that has not entered the first training cycle, all of them can be input into the next training cycle of the first training cycle according to preset rules; or, based on the loss and error rate of the samples in the removed sample set that has not entered the first training cycle when they were last input into the training cycle, it is determined whether to enter the next training cycle of the first training cycle. The specific details are not limited here.
[0138] In the prior art, all samples in the data set input into the neural network training model will be input into each training cycle. During the training process, the parameters of the neural network training model are constantly adjusted, and the difficulty of the samples for the training model changes dynamically, that is, the training value of the samples in different training cycles will change. All samples will be input into each training cycle for training, and the training time is relatively long.
[0139] In the data processing method provided in the embodiment of the present application, if the sample is determined to be less difficult for the training model based on the loss and / or error rate, it will not participate in the next training cycle. The samples participating in the training can be dynamically adjusted by determining whether to participate in the next training cycle based on the sample loss and / or error rate. Since the samples participating in each training cycle are only part of the data set, the training time can be reduced.
[0140] See also Figure 4 , which is a schematic diagram of an embodiment of the data processing method in the embodiment of the present application.
[0141] 401. Extract features of samples in the original data set;
[0142] Obtain the original data set for deep learning model training. The original data set can be obtained in a variety of ways, which are not limited here. For example, when training a deep neural network model for image classification, you can download the ImageNet data set from the Internet. ImageNet is a large-scale visual database used for visual object recognition software research and can provide a data set for model training.
[0143] Extract the features of the samples in the original dataset. For the original dataset, first use a pre-trained network (such as VGG-19Resnet-50, etc.) to extract the features of the last convolutional layer.
[0144] 402. Classify according to the category label of the sample;
[0145] The samples in the original dataset have category labels, and the samples can be classified according to the category labels. For example, the category labels of the image samples in the original dataset may be "cat" or "dog", and the samples with the category label "cat" are classified into one category, and the samples with the category label "dog" are classified into another category.
[0146] It should be noted that the execution order between step 401 and step 402 is not limited. Step 401 may be performed first and then step 402, and the features of the samples of the extracted original data set are classified according to the category labels of the samples to obtain the features of the samples of the classified data set. Step 402 may also be performed first and then step 401, and the original data set is first classified according to the category labels of the samples to obtain the classified data set, and then the features of the samples are extracted to obtain the features of the samples of the classified data set, and the specific steps are not limited here.
[0147] 403. Determine the average divergence of the classification data set;
[0148] Calculate the average divergence of each classification data set. The average divergence can be used to measure the degree of discreteness of the classification data set. The average divergence of the classification data set can be calculated based on all samples in the classification data set, or it can be calculated based on some samples in the classification data set, which is not limited here. If the average divergence of the classification data set is calculated based on some samples in the classification data set, it is first necessary to randomly select samples from the classification data set or filter them according to preset rules, and then calculate the average divergence based on the filtered samples. Exemplarily, by calculating the divergence of any two samples among all samples in a classification data set, and then taking the average, the average divergence of the classification data set can be obtained. The average divergence of a classification data set can be used to measure the degree of discreteness of the classification data set. The divergence of any two samples can be KL divergence, JS divergence, etc., which is not limited here.
[0149] Information divergence (Kullback–Leibler divergence), also known as relative entropy, is usually referred to as KL divergence. It is a method to describe the difference between two probability distributions P and Q. It is asymmetric, which means that D(P||Q)≠D(Q||P). Due to the asymmetry of KL divergence, when determining the average divergence of a classification data set based on sample KL divergence, it is first necessary to obtain the permutations of any two samples in the classification data set and calculate the KL divergence of each permutation. The sum of the KL divergences of all permutations is divided by the number of permutations to obtain the average KL divergence of the classification data set.
[0150] Since the Jensen-Shannon divergence, usually referred to as JS divergence, is a variation of the KL divergence and is symmetrical, when determining the average divergence of a classification data set based on the sample JS divergence, it is only necessary to obtain a combination of any two samples in the classification data set, and calculate the JS divergence of each combination, and then divide the sum of the JS divergences of all combinations by the number of combinations to obtain the average JS divergence of the classification data set.
[0151] The following is an introduction to JS divergence. The calculation formula of JS divergence is as follows:
[0152] JS(P||Q)=1 / 2KL(P||(P+Q) / 2)+1 / 2KL(Q||(P+Q) / 2)
[0153] Among them, P and Q represent the feature vector of sample p and the feature vector of sample q in the classification data set, JS(P||Q) represents the JS divergence between P and Q, and KL represents the KL divergence, which can be used to measure the similarity of two feature vectors.
[0154] Similarly, the average divergence of all categorical datasets can be calculated.
[0155] 404. Determine a sample deletion amount of the classification data set according to the divergence of the classification data set;
[0156] The divergence of a classification data set is used to measure the degree of discreteness of the classification data set. The smaller the degree of discreteness, the more similar the samples are, and therefore the more they should be simplified. There are many specific implementation methods for determining the amount of sample deletion for each classification data set based on the total amount of sample deletion of the original data set and the divergence of each classification data set, which are not specifically limited here.
[0157] Optionally, the ratio of the sample deletion ratio of each classification data set is determined according to the ratio of the average divergence of the classification data set to the sum of the average divergence of all classification data sets. The sample deletion ratio of a classification data set is the ratio of the amount of samples deleted in the classification data set to the total amount of samples in the classification data set. According to the preset total deletion ratio of the original data set and the number of samples in the original data set, the total deletion amount of the samples can be determined, and then the deletion ratio and deletion amount of each classification data set can be determined.
[0158] For example, if the sample size of the original data set is 1000, 10% of the samples need to be deleted, that is, the total deletion amount is 100, the number of samples of the first classification data set is 400, the average scatter is 0.02, the number of samples of the second classification data set is 600, the average scatter is 0.03, and the ratio of the deletion ratio of the first classification data set to the deletion ratio of the second classification data set is determined to be 3:2. The total deletion amount is 100, and then it can be determined that the deletion amount of the first classification data set is 50, and the deletion amount of the second classification data set is 50.
[0159] Exemplarily, first, the sample deletion ratio of the classification data set is calculated based on the divergence ratio of the average divergence of the classification data set to the sum of the average divergence of all classification data sets; specifically, please refer to Table 1 for the calculation process of the sample deletion amount of the classification data set: first determine the divergence ratio of the average divergence of the classification data set to the sum of the average divergence of all classification data sets, and then normalize 1-divergence ratio to ensure that the sum of the deletion ratios of all classification data sets is 1; it can be obtained that the deletion ratio ratio of the classification data sets of the three categories is 35%: 25%: 40%. Finally, according to the preset total deletion ratio, for example, set to 10.95%, the total number of samples of the original data set is 2000, and the sample deletion amount of each classification data set is determined to be 84, 15 and 120 respectively.
[0160] Table 1
[0161] Serial number Category 1 Category 2 Category 3 total / Number of samples 800 200 1000 2000 1 Average divergence 0.03 0.05 0.02 0.1 2 Divergence ratio 30% 50% 20% 1 3 1- Divergence ratio 70% 50% 80% 2 4 Reduction ratio 35% 25% 40% 1 5 Total deletion ratio - - - 10.95% 6 Sample deletion ratio 10.5% 7.5% 12% - 7 Sample reduction 84 15 120 219
[0162] 405. Determine the target samples to be retained based on the sample density and the number of sample deletions;
[0163] Calculate the density of each sample in the classification data set. The density of the sample can reflect the density of samples near the sample in the classification data set. Prune the samples according to the principle that the samples with higher density should be removed, and finally determine the target samples that should be retained in the classification data set. Similarly, determine the target samples to be retained in each classification data set.
[0164] In step 404, the sample deletion amount of each classification data set is determined, and further, it is necessary to determine which samples should be deleted. The deletion is performed according to the principle that the samples with higher density in the classification data set should be removed more.
[0165] There are many ways to calculate the density of samples, which are not limited here. The following describes a method for determining the density of samples based on the local outlier factor (LOF) algorithm. The outlier degree calculated by the LOF algorithm represents the ratio of the average density of the sample points around a sample point to the density of the sample point. The greater the ratio is than 1, the smaller the density of the sample point is than the density of the surrounding samples, and the more likely this point is an outlier. The larger the outlier value calculated by the LOF algorithm, the more abnormal the sample is, that is, it is not in a dense area and the smaller the density is.
[0166] All samples in the classification data set are calculated according to the LOF algorithm to obtain the abnormality of each sample, and then the samples are deleted according to the abnormality of the samples to determine the target samples to be retained.
[0167] It can be understood that the larger the abnormality value, the more abnormal the sample is, that is, it is not in a dense area, the smaller the density, the smaller the probability of the sample being deleted, and conversely, the smaller the abnormality value, the more ordinary the sample is, that is, it is in a dense area, the larger the density, the greater the probability of the sample being deleted. There are many specific ways to delete samples according to the abnormality of the sample, which are not limited here.
[0168] Optionally, for a classification data set, samples are sorted from small to large according to the degree of abnormality, and samples with small abnormality are deleted starting from them until the determined sample deletion amount is completed, and the remaining deleted samples are determined as the target samples retained for the classification data set. Similarly, the target samples retained for all classification data sets are determined.
[0169] Optionally, for a classification data set, the samples are sorted from small to large according to the degree of abnormality. Since the samples at the front end of the sequence have a small degree of abnormality and are very similar, they can be deleted in large quantities without causing the training model to miss too much different information. For the samples at the end of the sequence, considering that very abnormal samples can be approximately regarded as noise points, which will affect the judgment of the model, they can be deleted in small quantities instead of being retained globally. For the samples in the middle of the sequence, considering the randomness of model training, a small number of samples can be removed as appropriate.
[0170] For example, see Figure 5, is a schematic diagram of an embodiment of deleting samples according to the abnormality of samples in an embodiment of the present application, wherein 82% of the samples of the classification data set are deleted from the front end of the sequence, 3% of the samples of the classification data set are deleted from the tail end of the sequence, and 15% of the samples of the classification data set are deleted from the middle of the sequence.
[0171] Optionally, the classification data set is grouped according to the size of the abnormality, and then the sample deletion amount of each group is determined according to the preset deletion ratio. There are many ways to group the classification data set according to the size of the abnormality, which are not limited here. For example: for a classification data set, the samples are sorted from small to large according to the abnormality value, and are evenly divided into three groups, namely the first sample set, the second sample set and the third sample set. Among them, the abnormality of any sample in the first sample set is less than the abnormality of any sample in the second sample set, and the abnormality of any sample in the second sample set is less than the abnormality of any sample in the third sample set. Since the samples in the first sample set belong to a dense area and the samples are very similar, a large number of deletions can be made without causing the training model to miss too much different information. For the third sample set, considering that very abnormal samples can be approximately regarded as noise points, which will affect the judgment of the model, a small number of deletions can be made without global retention. For the moderately dense samples in the second sample set, considering the randomness of model training, a small number of samples can be removed as appropriate. Therefore, for the first sample set to the third sample set, deletions are made according to the strategy of decreasing the sample deletion ratio in sequence. Optionally, a sample deletion ratio is preset, for example, the deletion ratio of the first sample set is 82%, the deletion ratio of the second sample set is 15%, and the deletion ratio of the third sample set is 3%. The specific deletion ratio can be determined according to actual conditions and is not limited here. It can be understood that the deletion ratio of the first sample set is greater than the deletion ratio of the second sample set, and the deletion ratio of the second sample set is greater than the deletion ratio of the third sample set.
[0172] Exemplarily, taking category 1 in Table 1 as an example, after calculating the LOF anomaly degree for 800 samples, they are sorted from small to large according to the anomaly degree. The first sample set is the first 266 samples, and 82% of the samples are deleted from the first sample set. Since the sample deletion amount of the classification data set of category 1 is 84, the deletion amount of the first sample set is 0.82×84=68. Similarly, the second sample set is the middle 266 samples, and 15% of the samples are deleted therefrom, and the deletion amount is 0.15×84=13. The third sample set is the last 267 samples, and 3% of the samples are deleted, and the deletion amount is 0.03×84=3.
[0173] For other classification data sets, the same strategy is used to perform sample deletion, thereby obtaining a target data set consisting of target samples.
[0174] This target dataset can be used to input the neural network model for training. It is then input to the classification network with a dynamic refiner for training.
[0175] 406. Determine the loss and error rate of samples in the first training set in the first training cycle;
[0176] After the target data set is determined in step 405, the target data set can be directly input into the deep learning network model for the first cycle of training; or a preset number of samples can be randomly selected and input into the deep learning network model for the first cycle of training, which is not limited here.
[0177] Optionally, the target data set is input into the first training cycle of the deep learning network model, and the loss, number of misjudgments, and number of training times of the samples in the target data set in the first training cycle can be obtained. The number of misjudgments is the number of times the sample is misjudged, and the number of training times is the number of times the sample participates in training, that is, the number of input training cycles.
[0178] For a training cycle, the loss of each sample input into the training cycle can be obtained. The larger the loss of the sample, the more difficult it is for the model and requires more supervised learning. However, it may also be an abnormal sample that will interfere with the model's judgment. Therefore, the second feature of the sample is introduced, the error rate, for judgment. The error rate = number of errors / number of training times. If the error rate is large, it means that the sample is always misclassified by the model and is a difficult example. If the error rate is small, it means that the sample is easy for the model to judge and is not very helpful for the subsequent training of the model.
[0179] 407. Determine the sample to be input into the next training cycle according to the loss and error rate of the sample;
[0180] There are many ways to determine the samples to be input into the next training cycle based on the loss and error rate of the samples, which are not limited here.
[0181] The following is an example of comprehensively considering the loss and error rate of samples to determine the samples to be input into the next training cycle:
[0182] Optionally, if you group by loss and incorrect_rate, you can construct four quadrants, see Figure 6, is a schematic diagram of four-space grouping according to loss and error rate in the embodiment of the present application. Since the range of error rate is [0, 1], in order to ensure that the dimensions of loss and error rate are consistent, loss is normalized to standard loss (loss_norm), and the origin coordinates are set to (mean of normalized loss, mean of error rate) (avg_loss_norm, avg_incorrect_rate).
[0183] like Figure 6 As shown, according to the normalized loss and error rate of each sample, the samples are mapped into the image, and each quadrant is a spatial grouping:
[0184] The sample loss in the first quadrant is greater than or equal to the mean of the normalized loss, and the error rate is greater than or equal to the mean of the error rate;
[0185] The sample loss in the second quadrant is greater than or equal to the mean of the normalized loss, and the error rate is less than the mean of the error rate;
[0186] The sample loss in the third quadrant is less than the mean of the normalized loss, and the error rate is less than the mean of the error rate;
[0187] The sample loss in the fourth quadrant is less than the mean of the normalized loss, and the error rate is greater than or equal to the mean of the error rate;
[0188] Among them, since the sample loss of the third quadrant is less than the mean of the normalized loss, and the error rate is less than the mean of the error rate, it can be defined as an easy sample space. The samples of this space group can be removed in large quantities, for example, the removal ratio is set to 79% of the total removal ratio. The sample loss of the first quadrant is greater than the mean of the normalized loss, and the error rate is greater than the mean of the error rate. It can be defined as a difficult sample space. Considering that there may be abnormal samples in this space grouping, which interferes with the judgment of the model, a small number of samples can be removed, and the removal ratio can be set to 1%. The sample loss of the second quadrant is greater than the mean of the normalized loss, and the error rate is less than the mean of the error rate. Although the loss of this space grouping sample is large, there are few errors. It can be defined as a semi-easy sample space. Remove a small number of samples, and the removal ratio can be set to 15%. The sample loss of the fourth quadrant is less than the mean, and the incorrect_rate is greater than the mean, indicating that the model has not fully mastered the samples of this space group. It can be defined as a special difficult sample space, and further training is needed. It can be removed in small quantities, and the removal ratio can be set to 5%. It should be noted that the removal ratio of each space group can be set according to the actual application situation, and the specific removal ratio is not specifically limited here.
[0189] It is understandable that the samples that have not participated in the training in the current training cycle can be merged into the above grouping according to the quadrants divided after the most recent training.
[0190] After determining the sample removal amount of each group according to the sample size and removal ratio of each group of samples in the four quadrants, it is necessary to further determine which samples to remove, so as to determine the training samples to enter the next cycle for network model training.
[0191] There are many ways to remove samples. Samples can be removed from small to large according to their loss in the training cycle. Samples can also be removed from small to large according to their error rate in the training cycle. The specific methods are not limited here.
[0192] Optionally, samples are removed by comprehensively considering the loss and error rate of the samples to determine the samples to be input into the next training cycle.
[0193] The following is a detailed introduction:
[0194] The removal probability of each sample is calculated as follows:
[0195] samp_prob[i]=old_samp_prob[i]+e^[(loss_norm[i]–avg_loss)^2+(incorrect_rate[i]–avg_incorrect_rate)^2]*(max_lof_value–lof_value[i])
[0196] Among them, samp_prob[i] is the removal probability of sample i in this training cycle;
[0197] old_samp_prob[i] refers to the removal probability of the sample in the previous training cycle;
[0198] [(loss_norm[i]–avg_loss)^2+(incorrect_rate[i]–avg_incorrect_rate)^2] refers to the distance of each sample from the far point origin. Considering that the value is between [0, 1], the exponential is taken to ensure the monotonicity of the multiplication. The farther from the origin, the more samples should be removed.
[0199] max_lof_value refers to the maximum abnormality lof value of the sample in the classification data set divided according to the label category, lof_value.
[0200] For example, for samples input into the third training cycle, the removal probability of the sample in the second training cycle needs to be obtained; for the first training cycle, the initial removal probability of the sample can be determined based on the abnormality of the sample in the target data set as the removal probability before the sample is input into the first training cycle.
[0201] The calculation method of the initial removal probability is as follows: according to the density of the sample in the classification data set determined by the label category, such as the degree of abnormality, the samples in the data set of each label category in the target data set are normalized to the maximum and minimum values, and the normalized degree of abnormality is used as the initial removal probability of the sample.
[0202] For sample set A that is removed in the current epoch, since it does not participate in training, the current loss and incorrect_rate cannot be calculated. Therefore, in order to ensure the comparability of the subsequent samp_prob with sample set B, the current removal probability of sample set A still needs to be updated. The existing probability can be scaled up in proportion. The calculation formula is as follows:
[0203] samp_prob[i]=old_samp_prob[i]*num_epochs / real_training_times[i]
[0204] Among them, samp_prob[i] is the removal probability of sample i in this training cycle;
[0205] old_samp_prob[i] refers to the removal probability of the sample in the previous training cycle;
[0206] num_epochs is the number of training cycles;
[0207] real_training_times[i] is the number of times sample i actually participates in the training cycle.
[0208] Since the neural network model training includes multiple training cycles, similarly, sample removal is performed for subsequent training cycles.
[0209] Remove samples according to their removal probability to determine the samples that enter the next training cycle.
[0210] It should be noted that the sample removal ratio of each training cycle is determined by a preset total removal ratio, wherein the sample removal ratio of each training cycle may be the same or different, which is not limited here.
[0211] 408. Input the sample into the training cycle for training, and output the trained network model.
[0212] The samples of each training cycle determined in step 407 are input for training, model parameters are obtained, and the trained network model is output. The training accuracy of the trained network model can be determined by verifying the data set.
[0213] The above introduces the data processing method for refining data sets. The following introduces the device for implementing the data processing method:
[0214] See also Figure 7 , is a schematic diagram of an embodiment of a data processing device in an embodiment of the present application.
[0215] The data processing device provided in the embodiment of the present application includes:
[0216] An acquisition module 701 is used to acquire an original data set;
[0217] A determination module 702 is used to determine a plurality of classified data sets according to the category labels of the samples in the original data set, wherein the plurality of classified data sets include a first classified data set and a second classified data set;
[0218] The determination module 702 is further configured to determine a first discrete degree of the first classified data set and a second discrete degree of the second classified data set;
[0219] The determination module 702 is further configured to determine a first sample deletion ratio of the first classification data set and a second sample deletion ratio of the second classification data set according to the first discrete degree and the second discrete degree, if the first discrete degree is greater than the second discrete degree, the first sample deletion ratio is less than the second sample deletion ratio, if the first discrete degree is less than or equal to the second discrete degree, the first sample deletion ratio is greater than or equal to the second sample deletion ratio;
[0220] The determination module 702 is also used to determine a target data set, which includes samples retained by the first classification data set and samples retained by the second classification data set. The samples retained by the first classification data set are determined based on the first sample deletion ratio, the sample size of the first classification data set and a preset total sample deletion amount, and the samples retained by the second classification data set are determined based on the second sample deletion ratio, the sample size of the second classification data set and a preset total sample deletion amount.
[0221] Optionally, the first degree of dispersion is a first average dispersion determined based on the feature vectors of all samples in the first classification data set; and the second degree of dispersion is a second average dispersion determined based on the feature vectors of all samples in the second classification data set.
[0222] Optionally, the first average divergence is an average of a first relative entropy KL divergence or a first Jason Shannon JS divergence, the first KL divergence is a KL divergence of feature vectors of any two samples in the first classification data set, and the first JS divergence is a JS divergence of feature vectors of any two samples in the first classification data set;
[0223] The second average divergence is an average of a second KL divergence or a second JS divergence, the second KL divergence is a KL divergence of feature vectors of any two samples in the second classification data set, and the second JS divergence is a JS divergence of feature vectors of any two samples in the second classification data set.
[0224] Optionally, the first discrete degree is negatively correlated with the first sample deletion ratio, and the second discrete degree is negatively correlated with the second sample deletion ratio.
[0225] Optionally, the determining module 702 is specifically configured to:
[0226] determining a sum of divergences of each of the plurality of classified data sets;
[0227] determining a ratio of the first divergence to the sum of the divergences, and a ratio of the second divergence to the sum of the divergences;
[0228] The first sample deletion ratio and the second sample deletion ratio are determined according to the ratio of the first divergence to the sum of the divergences, the ratio of the second divergence to the sum of the divergences, the sample size of the first classification data set, the sample size of the second classification data set and the preset total sample deletion amount.
[0229] Optionally, the determining module 702 is specifically configured to:
[0230] Determining the samples retained by the first classification data set according to the density of the samples of the first classification data set and the first sample deletion ratio, wherein the average density of the samples retained by the first classification data set is less than the average density of the samples of the first classification data set;
[0231] The samples retained by the second classification data set are determined according to the density of the samples of the second data set and the second sample deletion ratio, and the average density of the samples retained by the second classification data set is less than the average density of the samples of the second data set.
[0232] Optionally, the density of the sample is the degree of abnormality of the sample calculated according to a local outlier factor LOF algorithm.
[0233] Optionally, the device further comprises:
[0234] An input module 703 is used to input the target data set into a first training cycle of the neural network training model, where the target data set includes a first training sample;
[0235] The acquisition module 701 is further used to obtain a first loss and / or a first error rate of the first training sample input into the first training cycle, where the first error rate is a ratio of the number of wrong judgments of the first training sample to the number of training times;
[0236] The input module 703 is also used to input the first training sample into a second training cycle when the first loss and / or the first error rate meets a preset condition, and the second training cycle is a next training cycle of the first training cycle.
[0237] See also Figure 8 , is a schematic diagram of another embodiment of the data processing device in the embodiment of the present application.
[0238] An embodiment of the present application provides a data processing device, including:
[0239] An acquisition module 801 is used to acquire a first loss and / or a first error rate of a first training sample input into a first training cycle, where the first error rate is a ratio of the number of wrong judgments of the first training sample to the number of training times;
[0240] The input module 802 is used to input the first training sample into a second training cycle when the first loss and / or the first error rate meets a preset condition. The second training cycle is a next training cycle of the first training cycle.
[0241] Optionally, the input module 802 is specifically used for:
[0242] If the first loss is greater than the first threshold, the first training sample is input into the second training cycle; or,
[0243] If the first error rate is greater than the second threshold, it is determined to input the first training sample into the second training cycle.
[0244] Optionally, the first threshold is a preset value, or a threshold determined according to a preset removal amount and the loss of all samples input into the first training cycle.
[0245] Optionally, the second threshold is a preset value, or a threshold determined according to a preset removal amount and a misjudgment rate of all samples input into the first training cycle.
[0246] Optionally, the input module 802 is specifically used for:
[0247] Determine a removal probability of the first training sample according to the first loss and the first error rate;
[0248] If the removal probability is less than the third threshold, it is determined to input the first training sample into the second training cycle.
[0249] Optionally, the third threshold is a preset value, or a threshold determined based on the loss, error rate, density and preset removal amount of all samples input into the first training cycle, where the density is the density of the sample in the classification data set determined based on the sample category label.
[0250] Optionally, the acquisition module 801 is further used to obtain an average value of the loss and an average value of the error rate of all samples input into the first training cycle;
[0251] A determination module 803, configured to determine a target group of the first training sample according to whether the first loss is less than an average value of the losses and whether the first error rate is less than an average value of the error rates;
[0252] The determination module 803 is further configured to determine the sample removal amount of the target group according to the sample amount of the first group and a preset removal ratio of the target group;
[0253] The determination module 803 is further configured to determine a probability of removing the first training sample according to the first loss and the first error rate;
[0254] The determination module 803 is also used to determine whether to input the first training sample into the second training cycle if the removal probability of the first training sample is less than a preset threshold value, where the probability threshold value is a preset value, or a threshold value determined based on the loss, error rate, density of all samples in the first group and the amount of sample removal of the first group, where the density is the density of the sample in the classification data set according to the sample category label.
[0255] See also Fig. 9 , is a schematic diagram of the system architecture of the data processing method in an embodiment of the present application.
[0256] The original data set, i.e., the training data set, is obtained by downloading from the Internet or annotating within the company. Feature extraction is performed through the pre-trained network, and then the data set is input into the static data refining device for static refinement. Some samples are deleted and the statically refined data set is input into the network to be trained. The training process includes n training cycles (epochs). During the training process, the data set can be screened through the dynamic data refining device, and some samples are removed before input into each training cycle. After n training cycles, the trained model is obtained, the model parameters are obtained, and the training accuracy of the model is output. The specific implementation process of the static refining process and the dynamic refining process can be referred to Figures 2 to 4 The corresponding embodiments will not be described in detail here.
[0257] The product implementation form can be software deployed on electronic devices, for example, it can be a program code contained in the data engine (DataEngine) system software and deployed on server hardware. The program code exists in the runtime training module and reasoning module of the data preprocessing system. During operation, the program code of this application runs on the host storage and acceleration hardware (GPU / FPGA / dedicated chip) memory of the server.
[0258] See also Fig.10, is a schematic diagram of another embodiment of a data processing device in the embodiment of the present application. The data processing device provided in this embodiment can be an electronic device such as a server or a terminal, and the specific device form is not limited in the embodiment of the present application.
[0259] The data processing device 1000 may have relatively large differences due to different configurations or performances, and may include one or more processors 1001 and a memory 1002 , in which programs or data are stored.
[0260] The memory 1002 may be a volatile storage or a non-volatile storage. Optionally, the processor 1001 is one or more central processing units (CPUs, Central Processing Units, which may be single-core CPUs or multi-core CPUs. The processor 1001 may communicate with the memory 1002 and execute a series of instructions in the memory 1002 on the data processing device 1000.
[0261] The data processing device 1000 further includes one or more wired or wireless network interfaces 1003 , such as Ethernet interfaces.
[0262] Optionally, although Fig.10 Not shown, the data processing device 1000 may also include one or more power supplies; one or more input and output interfaces, which may be used to connect a display, a mouse, a keyboard, a touch screen device or a sensor device, etc. The input and output interfaces are optional components and may or may not exist, and are not limited here.
[0263] The process executed by the processor 1001 in the data processing device 1000 in this embodiment can refer to the method process described in the aforementioned method embodiment, and will not be repeated here.
[0264] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0265] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0266] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0267] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0268] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.
[0269] As described above, the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A data processing method, characterized in that: include: Get the original data set; Determine multiple classification data sets according to the category labels of the samples in the original data set; The plurality of classification data sets include a first classification data set and a second classification data set; Determining a first degree of discreteness of the first classified data set and a second degree of discreteness of the second classified data set; Determining a first sample deletion ratio of the first classification data set and a second sample deletion ratio of the second classification data set according to the first discrete degree and the second discrete degree, if the first discrete degree is greater than the second discrete degree, the first sample deletion ratio is less than the second sample deletion ratio, and if the first discrete degree is less than or equal to the second discrete degree, the first sample deletion ratio is greater than or equal to the second sample deletion ratio; Determine a first target data set, the first target data set including samples retained by the first classification data set and samples retained by the second classification data set, the samples retained by the first classification data set are determined based on the first sample deletion ratio, the sample size of the first classification data set and a preset first sample deletion total amount, and the samples retained by the second classification data set are determined based on the second sample deletion ratio, the sample size of the second classification data set and a preset sample deletion total amount.
2. The method according to claim 1, characterized in that The first degree of dispersion is a first average dispersion determined according to the feature vectors of all samples in the first classification data set; the second degree of dispersion is a second average dispersion determined according to the feature vectors of all samples in the second classification data set.
3. The method according to claim 2, characterized in that The first average divergence is an average of a first relative entropy KL divergence or a first Jason Shannon JS divergence, the first KL divergence is a KL divergence of feature vectors of any two samples in the first classification data set, and the first JS divergence is a JS divergence of feature vectors of any two samples in the first classification data set; The second average divergence is an average of a second KL divergence or a second JS divergence, the second KL divergence is a KL divergence of feature vectors of any two samples in the second classification data set, and the second JS divergence is a JS divergence of feature vectors of any two samples in the second classification data set.
4. The method according to claim 2, characterized in that: The determining, according to the first discrete degree and the second discrete degree, a first sample deletion ratio of the first classification data set and a second sample deletion ratio of the second classification data set comprises: determining a sum of the divergences of each of the plurality of classified data sets; Determining a ratio of the first discreteness to the sum of the divergences, and a ratio of the second discreteness to the sum of the divergences; The first sample deletion ratio and the second sample deletion ratio are determined according to the ratio of the first discrete degree to the sum of the divergences, the ratio of the second discrete degree to the sum of the divergences, the sample size of the first classification data set, the sample size of the second classification data set and a preset total sample deletion amount.
5. The method according to claim 4, characterized in that The preset total amount of sample deletion is determined based on a preset total sample deletion ratio and the total amount of samples in the original data set.
6. The method according to claim 1, characterized in that The first discrete degree is negatively correlated with the first sample deletion ratio, and the second discrete degree is negatively correlated with the second sample deletion ratio.
7. The method according to claim 1, characterized in that Determining the first target data set includes: Determining a first sample deletion amount of the first classification data set according to the first sample deletion ratio and the sample amount of the first classification data set; Determining a second sample deletion amount of the second classification data set according to the second sample deletion ratio and the sample size of the second classification data set; Deleting samples from the first classification data set based on the first sample deletion amount to determine samples retained by the first classification data set, wherein a density mean of the samples retained by the first classification data set is smaller than a density mean of the samples of the first classification data set; Deleting samples from the second classification data set based on the second sample deletion amount to determine samples retained by the second classification data set, wherein a density mean of the samples retained by the second classification data set is smaller than a density mean of the samples of the second classification data set; The density mean is the mean of the abnormality of the samples calculated according to the local outlier factor LOF algorithm.
8. The method according to claim 1, characterized in that The method further comprises: Inputting the first target data set determined according to the preset first sample deletion amount into a first training cycle of a neural network training model; A second target data set determined according to a preset second sample deletion amount is input into a second training cycle of the neural network training model, wherein the preset first sample deletion amount is different from the preset second sample deletion amount.
9. The method according to any one of claims 1 to 7, characterized in that The method further comprises: Inputting the first target data set into a first training cycle of a neural network training model, the first target data set comprising a first training sample; Obtaining a first loss and / or a first error rate of the first training sample input into the first training cycle, wherein the first error rate is a ratio of the number of wrong judgments of the first training sample to the number of training times; When the first loss and / or the first error rate meets a preset condition, the first training sample is input into a second training cycle, and the second training cycle is a next training cycle of the first training cycle.
10. A data processing device, characterized in that: include: The acquisition module is used to obtain the original data set; A determination module, configured to determine a plurality of classified data sets according to the category labels of the samples in the original data set, wherein the plurality of classified data sets include a first classified data set and a second classified data set; The determination module is further configured to determine a first discrete degree of the first classified data set and a second discrete degree of the second classified data set; The determining module is further configured to determine a first sample deletion ratio of the first classification data set and a second sample deletion ratio of the second classification data set according to the first discrete degree and the second discrete degree, wherein if the first discrete degree is greater than the second discrete degree, the first sample deletion ratio is less than the second sample deletion ratio, and if the first discrete degree is less than or equal to the second discrete degree, the first sample deletion ratio is greater than or equal to the second sample deletion ratio; The determination module is also used to determine a first target data set, which includes samples retained by the first classification data set and samples retained by the second classification data set, the samples retained by the first classification data set are determined based on the first sample deletion ratio, the sample size of the first classification data set and a preset first sample deletion total amount, and the samples retained by the second classification data set are determined based on the second sample deletion ratio, the sample size of the second classification data set and a preset sample deletion total amount.
11. The device according to claim 10, characterized in that The first degree of dispersion is a first average dispersion determined according to the feature vectors of all samples in the first classification data set; the second degree of dispersion is a second average dispersion determined according to the feature vectors of all samples in the second classification data set.
12. The device according to claim 11, characterized in that The first average divergence is an average of a first relative entropy KL divergence or a first Jason Shannon JS divergence, the first KL divergence is a KL divergence of feature vectors of any two samples in the first classification data set, and the first JS divergence is a JS divergence of feature vectors of any two samples in the first classification data set; The second average divergence is an average of a second KL divergence or a second JS divergence, the second KL divergence is a KL divergence of feature vectors of any two samples in the second classification data set, and the second JS divergence is a JS divergence of feature vectors of any two samples in the second classification data set.
13. The device according to claim 11, characterized in that The determination module is specifically used for: determining a sum of the divergences of each of the plurality of classified data sets; Determining a ratio of the first discreteness to the sum of the divergences, and a ratio of the second discreteness to the sum of the divergences; The first sample deletion ratio and the second sample deletion ratio are determined according to the ratio of the first discrete degree to the sum of the divergences, the ratio of the second discrete degree to the sum of the divergences, the sample size of the first classification data set, the sample size of the second classification data set and a preset total sample deletion amount.
14. The device according to claim 13, characterized in that The preset total amount of sample deletion is determined based on a preset total sample deletion ratio and the total amount of samples in the original data set.
15. The device according to claim 10, characterized in that The first discrete degree is negatively correlated with the first sample deletion ratio, and the second discrete degree is negatively correlated with the second sample deletion ratio.
16. The device according to claim 10, characterized in that The determination module is specifically used for: Determining a first sample deletion amount of the first classification data set according to the first sample deletion ratio and the sample amount of the first classification data set; Determining a second sample deletion amount of the second classification data set according to the second sample deletion ratio and the sample size of the second classification data set; Deleting samples from the first classification data set based on the first sample deletion amount to determine samples retained by the first classification data set, wherein a density mean of the samples retained by the first classification data set is smaller than a density mean of the samples of the first classification data set; Deleting samples from the second classification data set based on the second sample deletion amount to determine samples retained by the second classification data set, wherein a density mean of the samples retained by the second classification data set is smaller than a density mean of the samples of the second classification data set; The density mean is the mean of the abnormality of the samples calculated according to the local outlier factor LOF algorithm.
17. The device according to claim 10, characterized in that The determining module is also used for: Inputting the first target data set determined according to the preset first sample deletion amount into a first training cycle of a neural network training model; The device also includes: an input module, which is used to input a second target data set determined according to a preset second sample deletion amount into a second training cycle of the neural network training model, wherein the preset first sample deletion amount is different from the preset second sample deletion amount.
18. The device according to any one of claims 10 to 16, characterized in that The device also includes: An input module, configured to input the first target data set into a first training cycle of a neural network training model, wherein the first target data set includes a first training sample; The acquisition module is further used to acquire a first loss and / or a first error rate of the first training sample input into the first training cycle, wherein the first error rate is a ratio of the number of wrong judgments of the first training sample to the number of training times; The input module is further configured to, when the first loss and / or the first error rate meets a preset condition, input the first training sample into a second training cycle, where the second training cycle is a next training cycle of the first training cycle.
19. A data processing device, characterized in that: include: A memory for storing instructions; A processor, configured to execute instructions in the memory so that the data processing device executes the method according to any one of claims 1 to 9.
20. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores instructions, and when the instructions are executed on a computer, the computer is caused to perform the method according to any one of claims 1 to 9.
Citation Information
Patent Citations
Redundant data reducing method suitable for training of support vector machine
CN102831432A
Intrusion detection method based on fast k-nearest neighbor (KNN) algorithm
CN103618744A
Text classification method, text classifier and storage medium for unbalanced data set
CN108628971A
Handwritten data classification method, model training method and device, equipment and medium
CN108710907A
Unbalanced sample data preprocessing method and device and computer equipment
CN109325118A
