Data cleaning method and device
The important features of unlabeled and labeled features are screened out through autoencoders and feature importance models, and abnormal data are cleaned in combination, which solves the shortcomings of traditional data cleaning methods in feature screening and improves the comprehensiveness and efficiency of data cleaning.
Patent Information
- Application Number
- CN202311539132.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-17
- Publication Date
- 2024-10-18
AI Technical Summary
Traditional data cleaning methods have low comprehensiveness, accuracy and efficiency in feature screening, resulting in low comprehensiveness, accuracy and efficiency of data cleaning. Especially in unsupervised learning scenarios, unlabeled data processing is not effective enough.
Through the autoencoder and the feature importance model, the first important features are screened out from the unlabeled features, and the second important features are screened out from the labeled features by combining the labeled features and random features, and the combination is an important feature set. Abnormal data in important feature sets are cleaned.
It improves the comprehensiveness, accuracy, and efficiency of feature screening, thereby improving the comprehensiveness, accuracy, and efficiency of data cleaning, and reducing the calculation amount of subsequent cleaning processes.
Smart Images

Figure CN118796807A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of data cleaning, and in particular to a data cleaning method and device. Background Art
[0002] In the real business scenarios of operators, business personnel may make mistakes or omit information in the business system when filling in business reports for some reasons, such as [Brand: H, Model: Q, Price: 699] or [Gender: Male, Age: 15, Monthly Income: 20,000]. In the above two examples, the former has an incorrect price and the latter has an incorrect age. This leads to some abnormal data in the operator's database. Compared with normal data, abnormal data is inconsistent in some key feature attributes, which will interfere with and affect the subsequent use of data. Therefore, it is necessary to clean the database to improve data quality.
[0003] In the process of data cleaning, features need to be screened to select data with important features for cleaning. However, traditional feature screening methods are generally only applicable to supervised learning scenarios. In fact, most business data is unlabeled data. Currently, unlabeled data in unsupervised learning scenarios are often manually screened based on business knowledge, and general feature screening is not achieved. This results in low comprehensiveness, accuracy, and efficiency of feature screening, which in turn leads to low comprehensiveness, accuracy, and efficiency of data cleaning. Summary of the invention
[0004] The embodiments of the present application provide a data cleaning method and device to solve the technical problem that the traditional data cleaning method has low comprehensiveness, accuracy and efficiency in feature screening, which leads to low comprehensiveness, accuracy and efficiency of data cleaning.
[0005] In a first aspect, an embodiment of the present application provides a data cleaning method, comprising:
[0006] According to the relationship between the data of the unlabeled features and the reconstructed data, a first important feature is selected from the unlabeled features;
[0007] According to the relationship between the data of the labeled features and the data of the random features, a second important feature is selected from the labeled features;
[0008] The first important feature and the second important feature are combined into an important feature set, and abnormal data in the important feature set is cleaned.
[0009] In one embodiment, the step of selecting the first important feature from the unlabeled feature according to the relationship between the data of the unlabeled feature and the reconstructed data includes:
[0010] Inputting the original data of the unlabeled features into an autoencoder to obtain first reconstructed data of the unlabeled features;
[0011] If the second error is greater than the first error, the weight of any unlabeled feature is reset to zero in the next training to obtain the second reconstructed data of the unlabeled feature; the second error is the error between the original data and the first reconstructed data of the unlabeled feature in this training, and the first error is the error between the original data and the first reconstructed data of the unlabeled feature in the previous training;
[0012] If the deviation between the third error and the first error is greater than the deviation threshold, the any unlabeled feature is determined as the first important feature; the third error is the error between the original data of the any unlabeled feature and the second reconstructed data.
[0013] In one embodiment, the step of selecting the second important feature from the labeled feature according to the relationship between the data of the labeled feature and the data of the random feature includes:
[0014] The labeled feature and the random feature are concatenated to obtain a concatenated feature; the random feature is a feature obtained by disrupting the data of the labeled feature;
[0015] Inputting the data of the spliced features into a feature importance model to obtain a first importance value of the labeled feature and a second importance value of the random feature in the spliced features;
[0016] Obtaining a first score of the labeled feature corresponding to any first importance value according to any first importance value, an average value of all first importance values, and a standard deviation of all first importance values;
[0017] Obtaining a second score of the random feature corresponding to any second importance value according to any second importance value, an average value of all second importance values, and a standard deviation of all second importance values;
[0018] The maximum value of the second scores of all random features is used as the benchmark score, the labeled features whose first scores are greater than the benchmark score are determined as the second important features, and the labeled features whose first scores are less than the benchmark score are eliminated;
[0019] After all random features are removed, returning to the step of concatenating the labeled features with the random features to obtain concatenated features, until all labeled features are either determined as the second most important features or are removed;
[0020] The feature importance model is obtained by training any tree model based on the data of the concatenated features of the first sampled user, where the first sampled user is a user sampled from users with labeled features.
[0021] In one embodiment, cleaning the abnormal data in the important feature set includes:
[0022] Obtaining a feature set associated with any important feature in the important feature set;
[0023] De-duplicate all associated feature sets to obtain processed feature sets;
[0024] Grouping the operators' users according to the features in any processed feature set, and counting the number of users in each group;
[0025] If the proportion of the number of users in any group is less than the proportion threshold, the user data of any group is determined as abnormal data;
[0026] The abnormal data is cleaned.
[0027] In one embodiment, obtaining a feature set associated with any important feature in the important feature set includes:
[0028] Inputting data of the first target feature set into a feature correlation model to obtain correlation values between all first target features and second target features in the first target feature set; the first target feature set is an important feature set in the important feature set except the second target feature, and the second target feature is any important feature in the important feature set;
[0029] Combining the plurality of first target features with larger correlation values with the second target feature to obtain a correlation feature set of the second target feature;
[0030] The feature correlation model is obtained by training the data of the first target feature of the second sampled user and its corresponding second target feature label on the basis of any tree model, and the second sampled user is a user sampled from the users to which the first target feature belongs.
[0031] In one embodiment, cleaning the abnormal data includes:
[0032] Clustering the operator users according to the features in any of the processed feature sets to obtain multiple clusters;
[0033] The majority of user data in the cluster closest to the abnormal cluster is replaced and filled to the abnormal data; the abnormal cluster is the cluster to which the user to which the abnormal data belongs is located.
[0034] In one embodiment, after obtaining the processed feature set, the following steps are performed:
[0035] Calculating the mean value and standard deviation of the data of the third target feature; the third target feature is any important feature in the important feature set except the processed feature set;
[0036] If the data of the third target feature of any user is outside a preset range, the data of the third target feature of any user is determined as abnormal data; the preset range is set according to the average value and standard deviation of the data of the third target feature;
[0037] The mode or average value of the data of the third target feature is replaced and filled into the abnormal data.
[0038] In a second aspect, an embodiment of the present application provides a data cleaning device, including:
[0039] A first important feature screening module is used to: screen out the first important feature from the unlabeled features according to the relationship between the data of the unlabeled features and the reconstructed data;
[0040] A second important feature screening module is used to screen out the second important feature from the labeled features according to the relationship between the data of the labeled features and the data of the random features;
[0041] The data cleaning module is used to: combine the first important feature and the second important feature into an important feature set, and clean abnormal data in the important feature set.
[0042] In a third aspect, an embodiment of the present application provides an electronic device, comprising a processor and a memory storing a computer program, wherein when the processor executes the program, the steps of the data cleaning method described in the first aspect are implemented.
[0043] In a fourth aspect, an embodiment of the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the steps of the data cleaning method described in the first aspect.
[0044] The data cleaning method and device provided by the present application selects the first important feature from the unlabeled features according to the relationship between the data of the unlabeled features and the reconstructed data, selects the second important feature from the labeled features according to the relationship between the data of the labeled features and the data of the random features, combines the first important feature and the second important feature into an important feature set, and cleans the abnormal data in the important feature set. Since a targeted feature automatic screening method is used to screen out important features for both unlabeled data and labeled data, feature screening can be made more comprehensive, more accurate and more efficient, thereby improving the comprehensiveness, accuracy and efficiency of subsequent data cleaning. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] In order to more clearly illustrate the technical solutions in the present application or the prior art, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0046] Figure 1 This is one of the flow charts of the data cleaning method provided in the embodiment of the present application;
[0047] Figure 2 This is the second flow chart of the data cleaning method provided in the embodiment of the present application;
[0048] Figure 3 This is the third flow chart of the data cleaning method provided in the embodiment of the present application;
[0049] Figure 4 This is the fourth flow chart of the data cleaning method provided in the embodiment of the present application;
[0050] Figure 5 This is the fifth flow chart of the data cleaning method provided in the embodiment of the present application;
[0051] Figure 6 A schematic diagram of the structure of a data cleaning device provided in an embodiment of the present application;
[0052] Figure 7 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0053] In order to make the purpose, technical solutions and advantages of this application clearer, the technical solutions in this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0054] Figure 1 This is one of the flow charts of the data cleaning method provided in the embodiment of the present application. Figure 1 , the present application embodiment provides a data cleaning method, which may include:
[0055] 101. According to the relationship between the data of the unlabeled features and the reconstructed data, the first important feature is selected from the unlabeled features;
[0056] 102. According to the relationship between the data with labeled features and the data with random features, the second most important feature is selected from the labeled features;
[0057] 103. Combine the first important feature and the second important feature into an important feature set, and clean the abnormal data in the important feature set.
[0058] In step 101, the reconstructed data is data reconstructed based on data without label features.
[0059] In step 102, the data of random features are random data obtained based on the data with label features.
[0060] It should be noted that, in actual applications, there is no strict timing relationship between step 101 and step 102; that is, they can be executed simultaneously, or any one step can be executed first, depending on actual needs and is not limited here.
[0061] The data cleaning method provided in this embodiment selects the first important feature from the unlabeled features according to the relationship between the data of the unlabeled features and the reconstructed data, selects the second important feature from the labeled features according to the relationship between the data of the labeled features and the data of the random features, combines the first important feature and the second important feature into an important feature set, and cleans the abnormal data in the important feature set. Since the important features are selected by the targeted automatic feature screening method for both the unlabeled data and the labeled data, the feature screening can be made more comprehensive, more accurate and more efficient, thereby improving the comprehensiveness, accuracy and efficiency of subsequent data cleaning.
[0062] In addition, since feature screening eliminates some relatively unimportant features, it can reduce the amount of computation in the subsequent cleaning process and further improve the efficiency of data cleaning.
[0063] Figure 2 This is the second flow chart of the data cleaning method provided in the embodiment of the present application. Figure 2 In one embodiment, based on the relationship between the data of the unlabeled features and the reconstructed data, selecting the first important feature from the unlabeled features may include:
[0064] 201. Inputting the original data without label features into the autoencoder to obtain first reconstructed data without label features;
[0065] 202. If the second error is greater than the first error, in the next training, the weight of any unlabeled feature is reset to zero to obtain second reconstructed data of the unlabeled feature;
[0066] The second error is the error between the original data without label features and the first reconstructed data in this training, and the first error is the error between the original data without label features and the first reconstructed data in the previous training;
[0067] 203. If the deviation between the third error and the first error is greater than the deviation threshold, the unlabeled feature is determined as the first important feature.
[0068] The third error is the error between the original data of the unlabeled feature and the second reconstructed data.
[0069] In this embodiment, the autoencoder may adopt a two-layer stacked autoencoder, and based on the reconstruction error of the autoencoder, the contribution of each input feature in the potential low-dimensional space is judged, and the contributing feature is selected as the first important feature.
[0070] Since the weight and bias of each unlabeled feature are adjusted during each training, the error (i.e., the loss function value) between the first reconstructed data output by the autoencoder and the original data of the unlabeled feature input by the autoencoder will gradually decrease. However, as the number of training times increases, the model will overfit and the error will gradually increase. Therefore, when the error between the first reconstructed data and the original data obtained in a certain training is larger than that of the previous training, it can be determined that the error of the previous training is already the minimum error, that is, when the second error is greater than the first error, the first error is the minimum error.
[0071] At this time, the weight of any unlabeled feature is reset to zero, making the unlabeled feature invalid, and then training is performed to obtain the second reconstructed data. If the deviation between the error of the autoencoder input and output and the minimum error before the weight is reset to zero is not large, it means that the unlabeled feature with the weight reset to zero is not important for reconstructing the original data. Otherwise, it means that the unlabeled feature with the weight reset to zero has a greater contribution to reconstructing the original data. The unlabeled feature with the weight reset to zero is determined as the first important feature. That is, if the deviation between the third error and the first error is greater than the deviation threshold, the unlabeled feature with the weight reset to zero is determined as the first important feature. All unlabeled features are traversed, the weights of all unlabeled features are set to zero in turn and training is performed again. The same method can be used to screen out all first important features from all unlabeled features.
[0072] This embodiment finds the unlabeled features that contribute more to the reconstruction of the input data by comparing the relationship between the autoencoder input-output error after the weights of any unlabeled feature are reset to zero and the minimum value of the autoencoder input-output error before the weights are reset to zero. It can eliminate unlabeled features with relatively low importance and screen out unlabeled features with higher importance, thereby reducing the amount of calculation for subsequent data cleaning and improving the accuracy and efficiency of data cleaning.
[0073] Figure 3 This is the third flow chart of the data cleaning method provided in the embodiment of the present application. Figure 3 In one embodiment, based on the relationship between the data with the labeled features and the data with the random features, selecting the second important feature from the labeled features may include:
[0074] 301. Concatenate the labeled features with the random features to obtain concatenated features;
[0075] Random features are features that are obtained by shuffling the data with labeled features;
[0076] 302. Input the data of the spliced features into the feature importance model to obtain the first importance value of the label feature and the second importance value of the random feature in the spliced features;
[0077] 303. Obtain a first score of the labeled feature corresponding to any first importance value, an average value of all first importance values, and a standard deviation of all first importance values;
[0078] 304. Obtain a second score of the random feature corresponding to any second importance value, an average value of all second importance values, and a standard deviation of all second importance values;
[0079] 305. The maximum value of the second scores of all random features is used as the benchmark score, the labeled features whose first scores are greater than the benchmark score are determined as the second important features, and the labeled features whose first scores are less than the benchmark score are eliminated;
[0080] 306. After all random features are removed, return to step 301;
[0081] 307. If all labeled features are either determined to be the second most important features or are eliminated, the process stops.
[0082] The feature importance model is obtained by training any tree model based on the data of the concatenated features of the first sampled user, where the first sampled user is a user sampled from users with labeled features.
[0083] In step 301, any shuffling method may be used to shuffle all the data with label features, which is not limited here. In this embodiment, the shuffle shuffling method may be used to shuffle all the data with label features.
[0084] Among them, the shuffle method can be implemented as follows:
[0085] Suppose there is an array [1,2,3,4,5,6,7,8], with a total of 8 data.
[0086] The first step is to select a random number from 1 to 8. For example, if it is 3, then the third number in [1,2,3,4,5,6,7,8] is selected, which is 3.
[0087] The second step is to delete and take out the third number and put it into the new array. That is, delete and take out 3 and put it into the new array. At this time, the new array is [3], and the original array is [1,2,4,5,6,7,8], with a total of 7 data.
[0088] Repeat the first step and select a random number from 1 to 7. For example, if it is 4, then the 4th number in [1,2,4,5,6,7,8] is selected, which is 5.
[0089] Repeat the second step, delete and take out the 4th number, and put it into the new array, that is, delete and take out 5, and put it into the new array. At this time, the new array is [3,5], and the original array is [1,2,4,6,7,8], with a total of 6 data;
[0090] Repeat the first and second steps, and so on, to get a new array after the original array [1,2,3,4,5,6,7,8] is completely shuffled.
[0091] In this embodiment, it is assumed that the label features are A, B, and C, and the data of the label features are shown in the following table:
[0092] Table 1 Label feature data table
[0093] A B C User 1 1 4 7 User 2 2 5 8 User 3 3 6 9
[0094] After shuffling the data of A, the data of B, and the data of C, the random feature data obtained can be shown in the following table:
[0095] Table 2 Random feature data table
[0096] A1 B1 C1 User 1 2 6 8 User 2 1 4 7 User 3 3 5 9
[0097] The data of the splicing features can be shown in the following table:
[0098] Table 3 Splicing feature data table
[0099] A B C A1 B1 C1 User 1 1 4 7 2 6 8 User 2 2 5 8 1 4 7 User 3 3 6 9 3 5 9
[0100] In step 302, the first importance value is the importance value of the labeled feature for the predicted target, and the second importance value is the importance value of the random feature for the predicted target.
[0101] In step 303, the calculation formula of the first score can be expressed as follows:
[0102]
[0103] Among them, Z1 is the first score, I i is the first importance value of any labeled feature, that is, the first importance value of A or B or C in Table 3, i is A or B or C, is the average of the first importance values of A, B and C, and s is the standard deviation of the first importance values of A, B and C.
[0104] In step 304, the calculation formula of the second score can be expressed as follows:
[0105]
[0106] Among them, Z2 is the second fraction, I′ j is the second importance value of any random feature, that is, the second importance value of A1 or B1 or C1 in Table 3, j is A1 or B1 or C1, is the average of the second importance values of A1, B1 and C1, and s′ is the standard deviation of the second importance values of A1, B1 and C1.
[0107] In step 305, if the first score of the labeled feature is greater than the benchmark score, the labeled feature is determined to be the second most important feature. If the first score of the labeled feature is less than the benchmark score, the importance of the labeled feature is considered to be less than that of the random feature, and the labeled feature is eliminated. If the first score of the labeled feature is equal to the benchmark score, or the comparison result between the first score of the labeled feature and the benchmark score is uncertain, the importance of the labeled feature is considered to be uncertain.
[0108] In step 306, after returning to step 301, the labeled features that have been determined as the second important features in step 305 and the labeled features whose importance cannot be determined are taken as the overall labeled features, and then spliced with the random features after scrambling the overall labeled features to execute subsequent steps.
[0109] In step 307, that is, when there is no labeled feature whose importance cannot be determined among all labeled features, the process stops.
[0110] It should be noted that, in actual applications, there is no strict timing relationship between step 303 and step 304; that is, they can be executed simultaneously, or any one step can be executed first, depending on actual needs and is not limited here.
[0111] If only the data with labeled features are input into the feature importance model, the importance value of the labeled features can be obtained, but this importance value can only indicate which labeled features played a role in training, and cannot indicate that there is a dependency relationship between the labeled features and the predicted target. Some useless features will also get importance values, but these useless features are meaningless. In addition, when using importance to select labeled features, it is necessary to manually determine the screening threshold to determine how many features to retain and how many features to delete, and the screening is not accurate.
[0112] This embodiment uses the method of splicing random features with labeled features to add randomness to the labeled data, and calculates the first score according to the importance value of the labeled feature, and calculates the second score according to the importance value of the random feature. By comparing the first score of the labeled feature with the maximum value of the second score of the random feature, the second important feature is screened out, which can scientifically set the screening rules, avoid manually setting the screening threshold, and improve the accuracy of screening. At the same time, because the eliminated labeled features have less effect on the prediction target than the random features, the screened labeled features can have a strong dependency relationship with the prediction target.
[0113] Figure 4 This is the fourth flow chart of the data cleaning method provided in the embodiment of the present application. Figure 4 In one embodiment, cleaning abnormal data in the important feature set may include:
[0114] 401. Input data of the first target feature set into a feature correlation model to obtain correlation values between all first target features and second target features in the first target feature set;
[0115] The first target feature set is an important feature set excluding the second target feature in the important feature set, and the second target feature is any important feature in the important feature set;
[0116] The feature correlation model is obtained by training the data of the first target feature of the second sampled user and its corresponding second target feature label on the basis of any tree model, and the second sampled user is a user sampled from the users to which the first target feature belongs;
[0117] 402. Combine a plurality of first target features with larger correlation values with the second target feature to obtain a correlation feature set of the second target feature;
[0118] 403. De-duplicate all associated feature sets to obtain processed feature sets;
[0119] 404. Grouping the operator users according to any feature in the processed feature set, and counting the number of users in each group;
[0120] 405. If the proportion of the number of users in any group is less than the proportion threshold, the user data of the group is determined as abnormal data;
[0121] 406. Clustering the operator users according to the features in the processed feature set to obtain a plurality of clusters;
[0122] 407. Replace the majority of user data in the cluster closest to the abnormal cluster and fill it at the abnormal data;
[0123] The abnormal cluster is the cluster to which the user to whom the abnormal data belongs belongs.
[0124] In step 401, the important feature set is a set composed of all the first important features and all the second important features. Assuming that the important feature set is [A, B, C, D, E, F, G], and the second target feature is A, the first target feature set is [B, C, D, F, F, G], and the data of the first target feature set is input into the feature correlation model to obtain the correlation value between B and A, the correlation value between C and A, the correlation value between D and A, the correlation value between E and A, the correlation value between F and A, and the correlation value between G and A.
[0125] In step 402, the correlation values are sorted from large to small, and the first target features corresponding to the top correlation values are selected and combined with the second target features. For example, the correlation value between B and A, the correlation value between E and A, and the correlation value between F and A are the top three correlation values. The first target features corresponding to the top three correlation values, i.e., B, E and F, are combined with A to obtain the associated feature set [A, B, E, F] of A.
[0126] In step 403, the associated feature sets of B, C, D, E, and F can be obtained by the same method as above. If any two associated feature sets are exactly the same, one of them is eliminated. It should be noted that the term "exactly the same" here means that the types and quantities of important features included in the two associated feature sets are exactly the same, and the arrangement order is not required to be exactly the same. For example, [A, B, E, F] and [A, E, B, F] are exactly the same associated feature sets, and one of them needs to be eliminated.
[0127] In step 404, assuming that any processed feature set is [brand, model, price], all operator users are grouped according to [brand, model, price] to obtain the following groups:
[0128] Table 4 Feature grouping table
[0129] Group brand model price Number of users 1 H Q1 3138 53697 2 H Q2 3744 52553 3 H Q3 2290 49033 4 H Q4 599 2809 5 H Q5 599 2642 total 160734
[0130] In step 405, the percentage threshold can be set according to actual needs and is not limited here. In this embodiment, the percentage threshold can be set to 5%. For example, the number of users in the fourth group, 2809, accounts for 160734 users, which is 1.75%, which is less than 5%. In this case, the user data [H, Q4, 599] of the fourth group is determined as abnormal data.
[0131] In step 406, any clustering method may be used to cluster the operator users, which is not limited here. In this embodiment, the K-means clustering method may be used to randomly select how many categories the 160734 users are divided into according to [brand, model, price].
[0132] In step 407, assuming that the total users are divided into 5 categories, the clusters are obtained as shown in Table 4, where each group represents a cluster. If the abnormal cluster, that is, the cluster of users to which [H, Q4, 599] belongs, is closest to the cluster of users to which [H, Q3, 2290] belongs, then the majority [H, Q3, 2290] in the nearest cluster is replaced and filled into the position of [H, Q4, 599].
[0133] It should be noted that the distance between two clusters is the distance between the cluster centers of the two clusters.
[0134] Because some important features are associated and dependent, it is sometimes difficult to detect anomalies in a single important feature, but joint anomalies can be discovered after the associated dependencies.
[0135] This embodiment associates multiple columns of features to obtain an associated feature set, then groups users according to the associated features to identify abnormal data, and finally clusters users according to the associated features, and determines filling data according to the distance between clusters to clean the abnormal data. The above method fully considers the interdependence between multiple columns of features, can better handle the abnormal problems of multiple column feature associations, and improves the accuracy of data cleaning. At the same time, compared with the traditional model filling method, there is no need to establish a model for each incomplete feature to fit the filling value, which greatly reduces the amount of calculation and improves the efficiency of data cleaning, thereby reducing data noise and improving the data quality of all data as a whole.
[0136] Figure 5 This is the fifth flow chart of the data cleaning method provided in the embodiment of the present application. Figure 5 In one embodiment, after obtaining the processed feature set, the following steps may be included:
[0137] 501. Calculate the mean value and standard deviation of the data of the third target feature;
[0138] The third target feature is any important feature in the important feature set except the processed feature set;
[0139] 502. If the data of the third target feature of any user is outside the preset range, the data of the third target feature of the user is determined as abnormal data;
[0140] The preset range is set based on the mean and standard deviation of the data of the third target characteristic;
[0141] 503. Replace the abnormal data with the mode or average value of the data of the third target feature.
[0142] In step 501, since the important features in the processed feature set are all interrelated important features, the important features outside the processed feature set are all single-column features that are not highly correlated with other features, that is, the third target features.
[0143] In step 502, the preset range may be [μ-3σ, μ+3σ], where μ is the average value of the data of the third target feature, and σ is the standard deviation of the data of the third target feature.
[0144] This embodiment performs anomaly diagnosis on the data of simple interest characteristics based on the mean value and standard deviation, and cleans the abnormal data using the mode or the mean value, thereby reducing data noise and improving the overall data quality of the entire data.
[0145] The data cleaning device provided in an embodiment of the present application is described below. The data cleaning device described below and the data cleaning method described above can be referenced to each other.
[0146] Figure 6 This is a schematic diagram of the structure of the data cleaning device provided in the embodiment of the present application. Figure 6 , an embodiment of the present application provides a data cleaning device, which may include:
[0147] A first important feature screening module 601 is used to screen out a first important feature from the unlabeled features according to the relationship between the data of the unlabeled features and the reconstructed data;
[0148] The second important feature screening module 602 is used to screen out the second important feature from the labeled feature according to the relationship between the labeled feature data and the random feature data;
[0149] The data cleaning module 603 is used to: combine the first important feature and the second important feature into an important feature set, and clean abnormal data in the important feature set.
[0150] The data cleaning device provided in this embodiment selects the first important feature from the unlabeled features according to the relationship between the data of the unlabeled features and the reconstructed data, selects the second important feature from the labeled features according to the relationship between the data of the labeled features and the data of the random features, combines the first important feature and the second important feature into an important feature set, and cleans the abnormal data in the important feature set. Since the important features are selected by the targeted automatic feature screening method for both the unlabeled data and the labeled data, the feature screening can be made more comprehensive, more accurate and more efficient, thereby improving the comprehensiveness, accuracy and efficiency of subsequent data cleaning.
[0151] In one embodiment, the first important feature screening module 601 is specifically used for:
[0152] Inputting the original data of the unlabeled features into an autoencoder to obtain first reconstructed data of the unlabeled features;
[0153] If the second error is greater than the first error, the weight of any unlabeled feature is reset to zero in the next training to obtain the second reconstructed data of the unlabeled feature; the second error is the error between the original data and the first reconstructed data of the unlabeled feature in this training, and the first error is the error between the original data and the first reconstructed data of the unlabeled feature in the previous training;
[0154] If the deviation between the third error and the first error is greater than the deviation threshold, the any unlabeled feature is determined as the first important feature; the third error is the error between the original data of the any unlabeled feature and the second reconstructed data.
[0155] In one embodiment, the second important feature screening module 602 is specifically used for:
[0156] The labeled feature and the random feature are concatenated to obtain a concatenated feature; the random feature is a feature obtained by disrupting the data of the labeled feature;
[0157] Inputting the data of the spliced features into a feature importance model to obtain a first importance value of the labeled feature and a second importance value of the random feature in the spliced features;
[0158] Obtaining a first score of the labeled feature corresponding to any first importance value according to any first importance value, an average value of all first importance values, and a standard deviation of all first importance values;
[0159] Obtaining a second score of the random feature corresponding to any second importance value according to any second importance value, an average value of all second importance values, and a standard deviation of all second importance values;
[0160] The maximum value of the second scores of all random features is used as the benchmark score, the labeled features whose first scores are greater than the benchmark score are determined as the second important features, and the labeled features whose first scores are less than the benchmark score are eliminated;
[0161] After all random features are removed, returning to the step of concatenating the labeled features with the random features to obtain concatenated features, until all labeled features are either determined as the second most important features or are removed;
[0162] The feature importance model is obtained by training any tree model based on the data of the concatenated features of the first sampled user, where the first sampled user is a user sampled from users with labeled features.
[0163] In one embodiment, the data cleaning module 603 is specifically used to:
[0164] Obtaining a feature set associated with any important feature in the important feature set;
[0165] De-duplicate all associated feature sets to obtain processed feature sets;
[0166] Grouping the operators' users according to the features in any processed feature set, and counting the number of users in each group;
[0167] If the proportion of the number of users in any group is less than the proportion threshold, the user data of any group is determined as abnormal data;
[0168] The abnormal data is cleaned.
[0169] In one embodiment, the data cleaning module 603 is specifically used to:
[0170] Inputting data of the first target feature set into a feature correlation model to obtain correlation values between all first target features and second target features in the first target feature set; the first target feature set is an important feature set in the important feature set except the second target feature, and the second target feature is any important feature in the important feature set;
[0171] Combining the plurality of first target features with larger correlation values with the second target feature to obtain a correlation feature set of the second target feature;
[0172] The feature correlation model is obtained by training the data of the first target feature of the second sampled user and its corresponding second target feature label on the basis of any tree model, and the second sampled user is a user sampled from the users to which the first target feature belongs.
[0173] In one embodiment, the data cleaning module 603 is specifically used to:
[0174] Clustering the operator users according to the features in any of the processed feature sets to obtain multiple clusters;
[0175] The majority of user data in the cluster closest to the abnormal cluster is replaced and filled to the abnormal data; the abnormal cluster is the cluster to which the user to which the abnormal data belongs is located.
[0176] In one embodiment, the data cleaning module 603 is further used to:
[0177] Calculating the mean value and standard deviation of the data of the third target feature; the third target feature is any important feature in the important feature set except the processed feature set;
[0178] If the data of the third target feature of any user is outside a preset range, the data of the third target feature of any user is determined as abnormal data; the preset range is set according to the average value and standard deviation of the data of the third target feature;
[0179] The mode or average value of the data of the third target feature is replaced and filled into the abnormal data.
[0180] Figure 7An example of a physical structure diagram of an electronic device is shown in FIG. Figure 7 As shown, the electronic device may include: a processor 710, a communication interface 720, a memory 730 and a communication bus 740, wherein the processor 710, the communication interface 720, and the memory 730 communicate with each other through the communication bus 740. The processor 710 may call a computer program in the memory 730 to execute the steps of the data cleaning method, for example, including:
[0181] According to the relationship between the data of the unlabeled features and the reconstructed data, a first important feature is selected from the unlabeled features;
[0182] According to the relationship between the data of the labeled features and the data of the random features, a second important feature is selected from the labeled features;
[0183] The first important feature and the second important feature are combined into an important feature set, and abnormal data in the important feature set is cleaned.
[0184] In addition, the logic instructions in the above-mentioned memory 730 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art, and the computer software product is stored in a storage medium, including several 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: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk.
[0185] On the other hand, an embodiment of the present application further provides a computer program product, the computer program product comprising a computer program, the computer program may be stored on a non-transitory computer-readable storage medium, and when the computer program is executed by a processor, the computer can perform the steps of the data cleaning method provided in the above embodiments, for example, including:
[0186] According to the relationship between the data of the unlabeled features and the reconstructed data, a first important feature is selected from the unlabeled features;
[0187] According to the relationship between the data of the labeled features and the data of the random features, a second important feature is selected from the labeled features;
[0188] The first important feature and the second important feature are combined into an important feature set, and abnormal data in the important feature set is cleaned.
[0189] On the other hand, an embodiment of the present application further provides a processor-readable storage medium, wherein the processor-readable storage medium stores a computer program, wherein the computer program is used to enable the processor to execute the steps of the methods provided in the above embodiments, for example, including:
[0190] According to the relationship between the data of the unlabeled features and the reconstructed data, a first important feature is selected from the unlabeled features;
[0191] According to the relationship between the data of the labeled features and the data of the random features, a second important feature is selected from the labeled features;
[0192] The first important feature and the second important feature are combined into an important feature set, and abnormal data in the important feature set is cleaned.
[0193] The processor-readable storage medium can be any available medium or data storage device that can be accessed by the processor, including but not limited to magnetic storage (such as floppy disks, hard disks, magnetic tapes, magneto-optical disks (MO), etc.), optical storage (such as CD, DVD, BD, HVD, etc.), and semiconductor storage (such as ROM, EPROM, EEPROM, non-volatile memory (NANDFLASH), solid-state drive (SSD)), etc.
[0194] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0195] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0196] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. 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 cleaning method, It is characterized in that include: According to the relationship between the data of the unlabeled features and the reconstructed data, a first important feature is selected from the unlabeled features; According to the relationship between the data of the labeled features and the data of the random features, a second important feature is selected from the labeled features; The first important feature and the second important feature are combined into an important feature set, and abnormal data in the important feature set is cleaned.
2. The data cleaning method according to claim 1, It is characterized in that The step of selecting the first important feature from the unlabeled feature according to the relationship between the data of the unlabeled feature and the reconstructed data includes: Inputting the original data of the unlabeled features into an autoencoder to obtain first reconstructed data of the unlabeled features; If the second error is greater than the first error, the weight of any unlabeled feature is reset to zero in the next training to obtain the second reconstructed data of the unlabeled feature; the second error is the error between the original data and the first reconstructed data of the unlabeled feature in this training, and the first error is the error between the original data and the first reconstructed data of the unlabeled feature in the previous training; If the deviation between the third error and the first error is greater than the deviation threshold, the any unlabeled feature is determined as the first important feature; the third error is the error between the original data of the any unlabeled feature and the second reconstructed data.
3. The data cleaning method according to claim 1, It is characterized in that The step of selecting the second important feature from the labeled feature according to the relationship between the data with the labeled feature and the data with the random feature includes: The labeled feature and the random feature are concatenated to obtain a concatenated feature; the random feature is a feature obtained by disrupting the data of the labeled feature; Inputting the data of the spliced features into a feature importance model to obtain a first importance value of the labeled feature and a second importance value of the random feature in the spliced features; Obtaining a first score of the labeled feature corresponding to any first importance value according to any first importance value, an average value of all first importance values, and a standard deviation of all first importance values; Obtaining a second score of the random feature corresponding to any second importance value according to any second importance value, an average value of all second importance values, and a standard deviation of all second importance values; The maximum value of the second scores of all random features is used as the benchmark score, the labeled features whose first scores are greater than the benchmark score are determined as the second important features, and the labeled features whose first scores are less than the benchmark score are eliminated; After all random features are removed, returning to the step of concatenating the labeled features with the random features to obtain concatenated features, until all labeled features are either determined as the second most important features or are removed; The feature importance model is obtained by training any tree model based on the data of the concatenated features of the first sampled user, where the first sampled user is a user sampled from users with labeled features.
4. The data cleaning method according to claim 1, It is characterized in that The cleaning of abnormal data in the important feature set includes: Obtaining a feature set associated with any important feature in the important feature set; De-duplicate all associated feature sets to obtain processed feature sets; Grouping the operators' users according to the features in any processed feature set, and counting the number of users in each group; If the proportion of the number of users in any group is less than the proportion threshold, the user data of any group is determined as abnormal data; The abnormal data is cleaned.
5. The data cleaning method according to claim 4, It is characterized in that The obtaining of a feature set associated with any important feature in the important feature set includes: Inputting data of the first target feature set into a feature correlation model to obtain correlation values between all first target features and second target features in the first target feature set; the first target feature set is an important feature set in the important feature set except the second target feature, and the second target feature is any important feature in the important feature set; Combining the plurality of first target features with larger correlation values with the second target feature to obtain a correlation feature set of the second target feature; The feature correlation model is obtained by training the data of the first target feature of the second sampled user and its corresponding second target feature label on the basis of any tree model, and the second sampled user is a user sampled from the users to which the first target feature belongs.
6. The data cleaning method according to claim 4, It is characterized in that The cleaning of the abnormal data includes: Clustering the operator users according to the features in any of the processed feature sets to obtain multiple clusters; The majority of user data in the cluster closest to the abnormal cluster is replaced and filled to the abnormal data; the abnormal cluster is the cluster to which the user to which the abnormal data belongs is located.
7. The data cleaning method according to claim 4, It is characterized in that After obtaining the processed feature set, the method includes: Calculating the mean value and standard deviation of the data of the third target feature; the third target feature is any important feature in the important feature set except the processed feature set; If the data of the third target feature of any user is outside a preset range, the data of the third target feature of any user is determined as abnormal data; the preset range is set according to the average value and standard deviation of the data of the third target feature; The mode or average value of the data of the third target feature is replaced and filled into the abnormal data.
8. A data cleaning device, It is characterized in that include: A first important feature screening module is used to: screen out the first important feature from the unlabeled features according to the relationship between the data of the unlabeled features and the reconstructed data; A second important feature screening module is used to screen out the second important feature from the labeled features according to the relationship between the data of the labeled features and the data of the random features; The data cleaning module is used to: combine the first important feature and the second important feature into an important feature set, and clean abnormal data in the important feature set.
9. An electronic device comprising a processor and a memory storing a computer program, It is characterized in that When the processor executes the computer program, the steps of the data cleaning method according to any one of claims 1 to 7 are implemented.
10. A computer program product comprising a computer program, It is characterized in that When the computer program is executed by a processor, the steps of the data cleaning method according to any one of claims 1 to 7 are implemented.
