WO2011147366A1 - 数据清洗方法及装置 - Google Patents

数据清洗方法及装置 Download PDF

Info

Publication number
WO2011147366A1
WO2011147366A1 PCT/CN2011/075350 CN2011075350W WO2011147366A1 WO 2011147366 A1 WO2011147366 A1 WO 2011147366A1 CN 2011075350 W CN2011075350 W CN 2011075350W WO 2011147366 A1 WO2011147366 A1 WO 2011147366A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
sample data
data set
cleaning
categories
Prior art date
Application number
PCT/CN2011/075350
Other languages
English (en)
French (fr)
Inventor
王静毅
吴向阳
荀鹏
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2011147366A1 publication Critical patent/WO2011147366A1/zh

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/21Design, administration or maintenance of databases
    • G06F16/215Improving data quality; Data cleansing, e.g. de-duplication, removing invalid entries or correcting typographical errors

Definitions

  • the present application claims priority to Chinese Patent Application No. 2010-10578479.9, the entire disclosure of which is incorporated herein by reference.
  • the present invention relates to the field of communications, and in particular, to a data cleaning method and apparatus.
  • BACKGROUND OF THE INVENTION With the rapid development of computer technology and communication technology, more and more digital information can be obtained, but at the same time, more time is needed to organize and organize information. To alleviate this burden, people began to study the use of computers to automatically classify data. In practical applications, the Internet and text libraries provide a large number of sample data that has been roughly classified, but there are quality problems such as data classification errors. Therefore, it is necessary to clean the correctness of these sample data classifications.
  • the text weight and its feature weight are interactively iterated until the text weight and its feature weight tend to stabilize and stop iterating, and the low-weight text is deleted by the final iteration result.
  • the specific operation of each iteration is as follows:
  • Wf ⁇ A mxn xWt ⁇
  • ⁇ ( is the improved value of the feature weight estimate obtained after the k+1th iteration
  • ⁇ ( ⁇ and w f k+l are the kth and k+1th times, respectively)
  • the improved value of the text weight estimate obtained after the iteration is the feature item frequency matrix
  • m is the total number of samples
  • n is the number of feature items.
  • Embodiments of the present invention provide a data cleaning method and apparatus, which can improve the accuracy of data classification.
  • the embodiment of the present invention adopts the following technical solutions:
  • a data cleaning method including:
  • Classifying the sample data obtaining weights of the rough classification categories of the sample data, and determining, according to the weights, a sorting position of the coarse classification categories of the sample data in all categories;
  • a predetermined number of the last ranked sample data is deleted according to the sorting position of the coarse classification category of the sample data in all categories.
  • a data cleaning device comprising:
  • a data obtaining unit configured to obtain sample data that has undergone coarse classification, and use the obtained sample data as a first data set
  • a sorting unit configured to classify sample data acquired by the data acquiring unit, obtain weights of the rough classification categories of the sample data, and determine, according to the weights, sorting of the rough classification categories of the sample data in all categories Location
  • a comprehensive evaluation unit configured to obtain a comprehensive evaluation result according to a sorting position of the rough classification category of the sample data in all categories and a total number of sample data in the first data set;
  • a data cleaning unit configured to: when determining that the first data set needs to be cleaned according to the comprehensive evaluation result, deleting a predetermined number of ranked last positions according to a sorting position of the coarse classification category of the sample data in all categories Sample data.
  • the data cleaning method and device obtaineds the sample data of the first data set by using the sample data obtained by the coarse classification as the first data set, and obtains the sample data.
  • a weight of the coarse classification category determining, according to the weight, a ranking position of the coarse classification category of the sample data in all categories, and ranking positions and first data sets in all categories according to the coarse classification category of the sample data.
  • the total number of sample data is obtained, and a comprehensive evaluation result is obtained.
  • the specified quantity is deleted according to the sorting position of the coarse classification category of the sample data in all categories.
  • the cleaning of multi-category data can be performed at the same time.
  • the sample data of each category is not only compared with the sample data of the category, but also compared with the sample data of all other categories, and the sample data of the category is sorted and cleaned. , the variance of the sample within the same category is reduced, the number The accuracy of the classification is improved.
  • FIG. 1 is a schematic flowchart of a data cleaning method according to an embodiment of the present invention.
  • FIG. 2 is a schematic flowchart of another data cleaning method according to an embodiment of the present invention.
  • FIG. 3 is a schematic structural diagram of a data cleaning apparatus according to an embodiment of the present invention.
  • the embodiment of the present invention provides a data cleaning method, as shown in FIG. 1 , including:
  • sample data that is roughly classified, and obtain the sample data as a first data set; wherein, the “rough classification” refers to that the sample data in the sample database has been roughly classified, for example, the video sample data is coarse.
  • Classified as comedy, tragedy, love drama, etc., the above comedy, tragedy, love drama is the rough classification category of the corresponding sample data.
  • the sample data of each coarse classification category in the first data set may be divided into n groups, n being a positive integer greater than or equal to 2; m group sample data in n rough sample categories n sample data
  • test classification data the remaining nm group sample data is used as training sample data, m is a positive integer greater than or equal to 1 and less than n; the test classification data is classified according to the training sample data by a classifier.
  • the classifier can be a Bayes classifier, a KNN classifier, an SVM classifier or a class center Classes, etc.
  • the number of training samples in the category p ( c ) Ci
  • n + IVoeabularyl is substituted.
  • nk represents the number of occurrences of the feature wi
  • I Vocabulary I is the total number of features in the first data set
  • the feature is a keyword representing the category of the category.
  • the at least two sample data having the same sort position are sorted according to the weights of the coarse classification categories.
  • the predetermined number of the last ranked sample data are deleted according to the sorting position of the coarse classification category of the sample data in all categories.
  • the first data set is used as a final cleaning result when the comprehensive evaluation result is greater than the first threshold.
  • the sample data remaining after the cleaning is used as the second data set. Determining whether the ratio of the quantity of the second data set to the sample data of the first data set is greater than a predetermined ratio, and if so, continuing to clean the second data set; if not, the cleaning fails, and the cleaning is ended.
  • the same classification method as the first data set may be adopted, and when the same classification method as the first data set is adopted,
  • the second data set is processed, it is determined whether the comprehensive evaluation result of the second data set is greater than a first threshold, and if so, the second data set is used as a final cleaning result.
  • the second data set is cleaned directly by using the weight of the coarse classification category of the sample data obtained when processing the first data set and the sorting position of the coarse classification category of the sample data in all categories.
  • the comprehensive evaluation result of the second data set is not greater than the first threshold, determining whether the difference between the comprehensive evaluation result of the second data set and the comprehensive evaluation result of the first data set is greater than a second preset threshold, and if so, the data is The collection continues to perform the cycle cleaning; if not, it is determined whether the number of cleaning times exceeds the preset number. If not, the first data set is re-cleaned; if it is exceeded, the cleaning is exited, and the cleaning of the first data set fails.
  • the data cleaning method provided in this embodiment obtains the sample data of the first data set by using the sample data obtained as the first data set by acquiring the sample data that is subjected to the rough classification, and obtains the rough classification of the sample data.
  • a weight of the category determining, according to the weight, a sorting position of the coarse classification categories of the sample data in all categories, and sorting positions in all categories according to the coarse classification categories of the sample data and sample data in the first data set a total quantity, obtaining a comprehensive evaluation result, when determining that the first data set needs to be cleaned according to the comprehensive evaluation result, deleting a prescribed number of rankings according to the sorting position of the rough classification category of the sample data in all categories
  • the sample data of the last position, and the above cleaning operation is performed cyclically until the data satisfies the condition to complete the cleaning.
  • the cleaning of the multi-category data can be performed simultaneously, that is, the sample data of each category is not only compared with the sample data of the category, but also with the sample data of all other categories, and the sample data of the category is sorted and cleaned.
  • the variance of the sample within the same category is reduced, and the accuracy of the data classification is improved.
  • Bayes classifier is used to classify the sample data as an example, and the previous embodiment is further described in detail.
  • the data cleaning method in this embodiment includes:
  • the original training database stores the original training sample set that has been roughly classified, and provides training samples to the classifier.
  • the original training database may be an Internet or a text library, etc.
  • Further sample data may be text or video, etc., taking video as an example.
  • video sample data is roughly classified into comedy, tragedy, and love drama. Etc., the above comedy, tragedy, love drama is the rough classification category of the corresponding sample data.
  • class a is divided into a.groupl, a.group2, , a. group (n)
  • class ij b is divided into b. group 1, b.group2, , b. group
  • the classifier includes a bayes classifier, but is not limited to the classifier, and may be classified by using other classifiers, for example: a KNN classifier, an SVM classifier, a class center classifier, etc. may be used. Data cleaning.
  • Each sample data in the classification result set has record information such as a sample number, a rough classification category of the sample data, a weight of the rough classification category of the sample data, and a sort position of the coarse classification category in all categories.
  • the weight of the rough classification category of the sample data and the sort position of the coarse classification category in all categories are elements of the classification result set obtained after classification.
  • the test classification data is classified by the Bayes classifier to obtain the classification result 1.
  • test classification data the test classification data is classified by the Bayes classifier according to the training sample data, and the classification result n is obtained.
  • the classification results 1, 2, ..., n are combined as the classification result set 1.
  • X) can be converted to maximize the prior probability P(X
  • the sample data set is obtained by the following formula. The weight of the rough classification category of the sample data:
  • n + l VQeabular
  • n the total number of features that appear in the category
  • nk the number of occurrences of the feature wi.
  • I Vocabulary I is the total number of features in the first data set.
  • the feature is a keyword representing a category.
  • the sort position of the coarse classification category of the sample data in all categories is determined based on the obtained weight. For example, the sample data is sorted according to the position of its coarse classification category in all categories, and when the sorting positions of the coarse classification categories of at least two sample data in all categories are the same, the sorting position is determined according to the weight of the coarse classification category. The same at least two sample data are sorted.
  • the comprehensive evaluation result R1 is obtained according to the ranking position of the coarse classification categories of the sample data in the classification result set in all categories and the total number of sample data in the first data set:
  • the sample data belongs to the number of rough classification categories and
  • R 1 total number of sample data of data set A
  • the comprehensive evaluation result is used to indicate the correct rate of the rough classification of the sample data.
  • the sample belonging to the coarse classification category is determined according to the sorting position of the coarse classification category of the sample data in all categories. It may be defined that when the sort position of the rough classification category is before the predetermined rank, the sample data is considered to belong to the coarse classification category.
  • the categories include 10 categories such as comedy, tragedy, love drama, science fiction, etc., and the pre-position is the third place, wherein the rough classification category of the sample data is comedy, and the classification calculation through step 203 is performed.
  • the sort position obtained after is the first
  • the 3rd position after the love drama and the science fiction drama, can determine that the rough classification category is in the predetermined third position, meets the requirement, and considers the coarse classification category to be more accurate. Therefore, it is determined that the sample data belongs to the coarse classification category.
  • the threshold a is preset and used to indicate an acceptable classification accuracy rate, and can be flexibly set according to the requirement of the classification data classification accuracy rate.
  • step 208 Determine the ratio of the total sample data of the data set B to the total number of sample data in the data set A read from the original training database, that is, whether the ratio of the quantity of the sample data in the data set B to the data set A is greater than the agreed ratio. If the ratio of the sample data in the data set B to the data set A is greater than the agreed ratio, it is determined that there is enough sample data in the data set B, and the data set B is a qualified data set that can be used to evaluate the cleaning effect, and the step is entered. 209. Otherwise, it is determined that the total number of sample data in the data set B is too small, which is a non-conforming data set that cannot be used to evaluate the cleaning effect, and proceeds to step 216.
  • step 202 For the specific implementation of this step, refer to step 202, and details are not described herein again.
  • the data set B may be classified by the same classification as the data set A.
  • n sets of data of each category of the data set B determine, in the n sets of data of each category, the test group data, and determine the remaining nm group data of each category as the training sample data for classification, according to the Bayes classifier.
  • the training sample data classifies the test classification data to obtain a classification result set 2.
  • step 203 For the specific implementation of this step, refer to step 203, and details are not described herein again.
  • the sample data of the data set B is acquired according to the classification result set 2
  • the comprehensive evaluation result R2 is defined as the probability that the sample data belongs to the rough classification category.
  • Step 212 Determine whether the comprehensive evaluation result R2 is less than the threshold a. If R2>the threshold a, determine that the data set B does not need to be cleaned, and proceed to step 213. If R2 ⁇ threshold a, determine that the data set B needs to be cleaned and enters. Step 214;
  • threshold b ie, the second threshold
  • the ranking position of the rough classification category in all categories and the weight of the coarse classification category are directly obtained from the current classification result, and then in all categories according to the coarse classification category.
  • the sorting position sorts the sample data, and when the sorting positions of the coarse classification categories of at least two sample data in all categories are the same, the sample data is sorted according to the weight of the coarse classification category, and the specified number of rows are deleted. The last sample data.
  • step 215. Determine whether the total number of times the sample data in the data set A is cleaned exceeds a prescribed number of times! ⁇ . If the total number of cleanings exceeds the specified number of times K, it is determined that the sample data of the data set has been cleaned a plurality of times, but the classification effect of the data set after each cleaning is not improved, and the process proceeds to step 216. If the total number of cleanings does not exceed the specified number of times K, the cleaning process may be restarted for data set A due to improper random grouping of cockroaches.
  • three cleaning determination conditions are configured, that is, whether the comprehensive evaluation result is less than a predetermined threshold, and whether the total number of sample data of the current data set accounts for more than the total number of sample data read from the original training database is greater than The agreed ratio determines whether the difference between the currently calculated comprehensive evaluation result and the previous comprehensive evaluation result is greater than a prescribed threshold.
  • cleaning judgment conditions can be configured through a configuration file.
  • the data cleaning method provided in this embodiment obtains the sample data of the first data set by using the sample data obtained as the first data set by acquiring the sample data that is subjected to the rough classification, and obtains the rough classification of the sample data.
  • a weight of the category determining, according to the weight, a sorting position of the coarse classification categories of the sample data in all categories, and sorting positions in all categories according to the coarse classification categories of the sample data and sample data in the first data set a total quantity, obtaining a comprehensive evaluation result, when determining that the first data set needs to be cleaned according to the comprehensive evaluation result, deleting a prescribed number of rankings according to the sorting position of the rough classification category of the sample data in all categories
  • the sample data of the last position, and the above cleaning operation is performed cyclically until the data satisfies the condition to complete the cleaning.
  • the cleaning of the multi-category data can be performed simultaneously, that is, the sample data of each category is not only compared with the sample data of the category, but also with the sample data of all other categories, and the sample data of the category is sorted and cleaned.
  • the variance of the sample within the same category is reduced, and the accuracy of the data classification is improved.
  • the text that does not meet the cleaning judgment rule is gradually deleted from the read data set, and the training data is cleaned, thereby improving the accuracy of data feature extraction, thereby further improving the accuracy of data classification.
  • the embodiment of the present invention further provides a data cleaning device, as shown in FIG. 3, including:
  • the data obtaining unit 301 is configured to obtain the sample data that has been roughly classified, and use the obtained sample data as the first data set;
  • a sorting unit 302 configured to classify the sample data acquired by the data acquiring unit 301, obtain a weight of a rough classification category of the sample data, and determine, according to the weight, a rough classification category of the sample data in all categories Sort position
  • the comprehensive evaluation unit 303 is configured to obtain a comprehensive evaluation result according to the sorting position of the coarse classification category of the sample data in all categories and the total number of sample data in the first data set;
  • the data cleaning unit 304 is configured to: when it is determined that the first data set needs to be cleaned according to the comprehensive evaluation result obtained by the comprehensive evaluation unit 303, delete the sorted position in all categories according to the rough classification category of the sample data. A specified number of sample data ranked at the last position.
  • classifying and sorting unit 302 specifically includes:
  • a data grouping subunit configured to divide sample data of each coarse classification category in the first data set into n groups, where n is a positive integer greater than or equal to 2;
  • a data determining subunit configured to use m group sample data in each rough classification category n group sample data as test classification data, and remaining nm group sample data as training sample data, where m is a positive integer greater than or equal to 1 and less than n ;
  • a data classification subunit configured to classify the test classification data according to the training sample data by a classifier
  • a weight obtaining subunit configured to obtain a weight of a coarse classification category of the sample data
  • a data sorting subunit for determining a sorting position of the coarse classification categories of the sample data in all categories based on the weights.
  • the classifier includes a Bayes classifier, a KNN classifier, an SVM classifier, or a class center classifier.
  • the data sorting sub-unit is specifically configured to: when the sorting positions of the coarse classification categories of the at least two sample data in all categories are the same, according to the weights of the coarse classification categories, the at least two of the same sorting positions The sample data is sorted.
  • the data cleaning unit 304 includes:
  • a cleaning judging unit configured to: when it is determined that the comprehensive evaluation result is not greater than the first threshold, determining that the sample data needs to be cleaned; when determining that the comprehensive evaluation result is greater than the first threshold, the first data is Set as the final cleaning result;
  • a data deletion subunit configured to: when the cleaning determination subunit determines that the first data set needs to be cleaned, delete a specified number of rankings according to a sorting position of the coarse classification category of the sample data in all categories Bit sample data.
  • the data obtaining unit is further configured to use the sample data remaining after the cleaning as the second data set, and determine whether the ratio of the quantity of the second data set to the sample data in the first data set is greater than a predetermined ratio, and if so, Then, the second data set is used as an object for continuing cleaning; if not, the cleaning fails, and the cleaning is ended;
  • the data cleaning unit is further configured to directly adopt a weight of a coarse classification category of the sample data obtained when processing the first data set, and a sorting position of the coarse classification category of the sample data in all categories.
  • the second data set is cleaned.
  • the data obtaining unit is further configured to use the sample data remaining after the cleaning as the second data set, and determine whether the ratio of the quantity of the second data set to the sample data in the first data set is greater than a predetermined ratio, and if so, Then, the second data set is used as an object for continuing cleaning; if not, the cleaning fails, and the cleaning is ended; determining that the comprehensive evaluation result of the second data set is not greater than the first threshold, and the comprehensive evaluation result of the second data set is When the difference between the comprehensive evaluation results of the first data set is not greater than the second preset threshold, and the number of times of cleaning does not exceed the preset number of times, the first data set is used as the object of re-cleaning; and the comprehensive evaluation result of the second data set is determined.
  • the sorting unit is further configured to: use the same classification manner as the first data set, and obtain a weight of the rough classification category of the sample data of the second data set, according to the weighting Determining a sorting position of a coarse classification category of sample data of the second data set in all categories;
  • the comprehensive evaluation unit is further configured to obtain a comprehensive evaluation result according to a sorting position of the coarse classification categories of the sample data of the second data set in all categories and a total number of sample data in the second data set;
  • the data cleaning unit is further configured to: when determining that the comprehensive evaluation result of the second data set is greater than the first threshold, using the second data set as a final cleaning result; determining that the comprehensive evaluation result of the second data set is not greater than a threshold value, and when the difference between the comprehensive evaluation result of the second data set and the comprehensive evaluation result of the first data set is greater than the second predetermined threshold, the sorting position of the coarse classification category of the sample data according to the second data set in all categories Delete the specified number of sample data at the last position.
  • the data cleaning apparatus obtains the sample data of the first data set by using the sample data obtained as the first data set by acquiring the sample data that is subjected to the rough classification, and obtains the rough classification of the sample data.
  • a weight of the category determining, according to the weight, a sorting position of the coarse classification categories of the sample data in all categories, and sorting positions in all categories according to the coarse classification categories of the sample data and sample data in the first data set a total quantity, obtaining a comprehensive evaluation result, when determining that the first data set needs to be cleaned according to the comprehensive evaluation result, deleting a prescribed number of rankings according to the sorting position of the rough classification category of the sample data in all categories
  • the sample data of the last position, and the above cleaning operation is performed cyclically until the data satisfies the condition to complete the cleaning.
  • the cleaning of the multi-category data can be performed simultaneously, that is, the sample data of each category is not only compared with the sample data of the category, but also with the sample data of all other categories, and the sample data of the category is sorted and cleaned.
  • the variance of the sample within the same category is reduced, and the accuracy of the data classification is improved.
  • the storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Quality & Reliability (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

公开了一种数据清洗方法。该方法包括:获取经过粗分类的样本数据,将获取的样本数据作为第一数据集(101);对所述样本数据进行分类,获得所述样本数据的粗分类类别的权重,根据所述权重确定所述样本数据的粗分类类别在所有类别中的排序位置;根据所述样本数据的粗分类类别在所有类别中的排序位置和第一数据集中样本数据的总数量,获得综合评估结果(103);当根据所述综合评估结果确定需要对所述第一数据集进行清洗时,根据所述样本数据的粗分类类别在所有类别中的排序位置删除规定数量的排在末位的样本数据(104)。该方法用于数据分类处理,并能提高数据分类的准确性。

Description

数据清洗方法及装置
本申请要求于 2010年 12月 8日提交中国专利局、 申请号为 201010578479.9、发 明名称为"数据清洗方法及装置"的中国专利申请的优先权,其全部内容通过引用结合 在本申请中。 技术领域 本发明涉及通信领域, 尤其涉及一种数据清洗方法及装置。 背景技术 随着计算机技术和通讯技术的飞速发展, 人们可以获得越来越多的数字化信息, 但同时也需要投入更多的时间对信息进行组织和整理。为了减轻这种负担, 人们开始 研究使用计算机对数据进行自动分类。在实际应用中, 互联网和文本库提供了大量已 被粗分类的样本数据, 但其存在数据分类错误等质量问题, 因此, 需要针对这些样本 数据分类的正确性进行清洗。
目前, 使用如下方法对数据分类正确性进行清洗: 将文本权重及其特征项权重交 互迭代, 直到文本权重及其特征项权重趋于稳定停止迭代, 并且, 利用最终的迭代结 果删除低权重的文本。 其中, 每次迭代的具体操作如下:
Wt^ = (Amxn f Wf^
Wf^ = Amxn xWt^ 其中, ^( 是第 k+1次迭代之后得到的特征项权重估计值的改进值, ^(^和 wf k+l分别是第 k次和第 k+1次迭代之后得到的文本权重估计值的改进值, 是 特征项频次矩阵, m是总的样本数, n是特征项数。
在实现本发明的过程中,现有技术中至少存在如下问题: 在清洗多类别数据时需 要对每个粗分类类别的数据逐类别进行清洗, 由于缺乏类别间的对比, 因此, 粗分类 类别的数据中可能保留类别区分有误的样本,这样会使最终的迭代结果不准确, 从而 降低数据分类的准确性。 发明内容
本发明的实施例提供一种数据清洗方法及装置, 能够提高数据分类的准确性。 为达到上述目的, 本发明的实施例采用如下技术方案:
一种数据清洗方法, 包括:
获取经过粗分类的样本数据, 将获取的样本数据作为第一数据集;
对所述样本数据进行分类, 获得所述样本数据的粗分类类别的权重,根据所述权 重确定所述样本数据的粗分类类别在所有类别中的排序位置;
根据所述样本数据的粗分类类别在所有类别中的排序位置和第一数据集中样本 数据的总数量, 获得综合评估结果;
当根据所述综合评估结果确定需要对所述第一数据集进行清洗时,根据所述样本 数据的粗分类类别在所有类别中的排序位置删除规定数量的排在末位的样本数据。
一种数据清洗装置, 其特征在于, 包括:
数据获取单元,用于获取经过粗分类的样本数据,将获取的样本数据作为第一数 据集;
分类排序单元,用于对所述数据获取单元获取的样本数据进行分类, 获得所述样 本数据的粗分类类别的权重,根据所述权重确定所述样本数据的粗分类类别在所有类 别中的排序位置;
综合评估单元,用于根据所述样本数据的粗分类类别在所有类别中的排序位置和 第一数据集中样本数据的总数量, 获得综合评估结果;
数据清洗单元,用于当根据所述综合评估结果确定需要对所述第一数据集进行清 洗时,根据所述样本数据的粗分类类别在所有类别中的排序位置删除规定数量的排在 末位的样本数据。
本发明实施例提供的数据清洗方法及装置,通过获取经过粗分类的样本数据,将 获取的样本数据作为第一数据集,对所述第一数据集的样本数据进行分类, 获得所述 样本数据的粗分类类别的权重,根据所述权重确定所述样本数据的粗分类类别在所有 类别中的排序位置,并根据所述样本数据的粗分类类别在所有类别中的排序位置和第 一数据集中样本数据的总数量, 获得综合评估结果, 当根据所述综合评估结果确定需 要对所述第一数据集进行清洗时,根据所述样本数据的粗分类类别在所有类别中的排 序位置删除规定数量的排在末位的样本数据。因此,可以同时进行多类别数据的清洗, BP , 每个类别的样本数据不仅与该类别的样本数据作比较,还与所有其它类别的样本 数据作比较, 该类别的样本数据在经过排序清洗后, 同一类别内的样本方差减小, 数 据分类的准确性得到提高。 附图说明 为了更清楚地说明本发明实施例的技术方案,下面将对实施例描述中所需要使用 的附图作一简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例, 对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图 获得其他的附图。
图 1为本发明实施例提供的一种数据清洗方法的流程示意图;
图 2为本发明实施例提供的另一种数据清洗方法的流程示意图;
图 3为本发明实施例提供的一种数据清洗装置的构成示意图。
具体实施方式 下面将结合本发明实施例中的附图, 对本发明实施例中的技术方案进行清楚、完 整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。 基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的 所有其他实施例, 都属于本发明保护的范围。
为了能够提高数据分类的准确性, 本发明实施例提供一种数据清洗方法, 如图 1 所示, 包括:
101、 获取经过粗分类的样本数据, 将获取的样本数据作为第一数据集; 其中, 所述"粗分类 "是指样本数据库中录入时样本数据已经过粗略分类, 例如, 视频样本数据被粗分类为喜剧、 悲剧、 爱情剧等, 上述喜剧、 悲剧、 爱情剧即为相应 样本数据的粗分类类别。
102、 对所述第一数据集的各类别的样本数据进行分类, 获得所述样本数据的粗 分类类别的权重,根据所述权重确定所述样本数据的粗分类类别在所有类别中的排序 位置;
举例而言, 可以将所述第一数据集中的每个粗分类类别的样本数据分成 n组, n 为大于等于 2的正整数; 将每个粗分类类别 n组样本数据中的 m组样本数据作为测 试分类数据, 剩余的 n-m组样本数据作为训练样本数据, m为大于等于 1且小于 n 的正整数; 通过分类器根据所述训练样本数据对所述测试分类数据进行分类。 其中, 该分类器可以为 Bayes (贝叶斯) 分类器、 KNN分类器、 SVM分类器或者类中心分 类器等。
当通过 Bayes分类器根据所述训练样本数据对所述测试分类数据进行分类时,所 述样本数据的粗分类类别的权重由公式 P(Ci/X) = P(X/Ci)*P(Ci)/P(X)计算得到。其中, p ( c ) = Ci类别的训练样本数
1 训练样本总数 。 p(X/Ci)=P(xl/Ci)*P(x2/Ci)....P(xn/Ci), 样本数据用 一个 n维特征向量, BP : X={xl , x2, ..., xn} , 样本数据的粗分类类别共有 m个类, 分别用 CI, C2,..., Cm 表示。 并且, 当 P( x '' | C ) = 0时, 将所述 P( x I C )采用 nk + 1
n + IVoeabularyl进行替代。其中, n 为该类别中出现的特征的总数, nk代表特征 wi 出 现的次数, I Vocabulary I 为第一数据集中特征的总数, 而所述特征为代表所属类别的 关键词。
另外, 当至少两个样本数据的粗分类类别在所有类别中的排序位置相同时, 根据 所述粗分类类别的权重对排序位置相同的所述至少两个样本数据进行排序。
103、 根据所述样本数据的粗分类类别在所有类别中的排序位置和第一数据集中 样本数据的总数量, 获得综合评估结果;
104、 当根据所述综合评估结果确定需要对所述第一数据集进行清洗时, 根据所 述样本数据的粗分类类别在所有类别中的排序位置删除规定数量的排在末位的样本 数据。
举例而言, 在确定所述综合评估结果小于第一阈值时, 确定需要对所述样本数据 进行清洗。当所述综合评估结果大于第一阈值时,将所述第一数据集作为最终清洗结 果。
在对第一数据集的样本数据集进行清洗后,将清洗后剩余的样本数据作为第二数 据集。判断所述第二数据集与第一数据集中样本数据的数量比是否大于约定比例, 如 果是, 则对所述第二数据集继续进行清洗; 如果否, 则清洗失败, 结束清洗。
在对第二数据集继续进行清洗的过程中, 可以在对第二数据集进行分类时, 可以 采用与第一数据集相同的分类方式, 并且, 当采用与第一数据集相同的分类方式对第 二数据集进行处理时, 判断第二数据集的综合评估结果是否大于第一阈值, 如果是, 则将所述第二数据集作为最终清洗结果。或者,直接采用对第一数据集进行处理时获 得的所述样本数据的粗分类类别的权重和所述样本数据的粗分类类别在所有类别中 的排序位置对所述第二数据集进行清洗。 当第二数据集的综合评估结果不大于第一阈值时,判断第二数据集的综合评估结 果与第一数据集的综合评估结果之差是否大于第二预设阈值, 如果是, 则对数据集继 续进行循环清洗; 如果否, 则判断清洗次数是否超过预设次数, 如果未超过, 则对第 一数据集重新进行清洗; 如果超过, 则退出清洗, 对第一数据集的清洗失败。
本实施例提供的数据清洗方法, 通过获取经过粗分类的样本数据, 将获取的样本 数据作为第一数据集,对所述第一数据集的样本数据进行分类, 获得所述样本数据的 粗分类类别的权重,根据所述权重确定所述样本数据的粗分类类别在所有类别中的排 序位置,并根据所述样本数据的粗分类类别在所有类别中的排序位置和第一数据集中 样本数据的总数量, 获得综合评估结果, 当根据所述综合评估结果确定需要对所述第 一数据集进行清洗时,根据所述样本数据的粗分类类别在所有类别中的排序位置删除 规定数量的排在末位的样本数据,并循环进行上述清洗操作直至数据满足条件完成清 洗。 因此, 可以同时进行多类别数据的清洗, 即, 每个类别的样本数据不仅与该类别 的样本数据作比较,还与所有其它类别的样本数据作比较, 该类别的样本数据在经过 排序清洗后, 同一类别内的样本方差减小, 数据分类的准确性得到提高。
下面, 以 Bayes分类器对样本数据进行分类为例, 对上一实施例做进一步详细具 体的描述。
如图 2所示, 本实施例数据清洗方法, 包括:
201、 从原始训练数据库中按照粗分类类别分别读取经过粗分类的样本数据, 将 这些样本数据合并, 作为数据集 A (即第一数据集);
其中, 所述原始训练数据库中存储有已被粗分类的原始的训练样本集, 并向分类 器提供训练样本。例如, 所述原始训练数据库可以为互联网或文本库等, 进一步的样 本数据可以为文本或视频等, 以视频为例, 在原始训练数据库中, 视频样本数据被粗 分类为喜剧、 悲剧、 爱情剧等, 上述喜剧、 悲剧、 爱情剧即为相应样本数据的粗分类 类别。
202、 将数据集 A中每个粗分类类别的数据分别随机分成 n组。
例如, 假设数据集 A 中存在 X 个类别的数据, 分别将类别 a 分成 a.groupl, a.group2, , a. group (n), 将类另 ij b分成 b. group 1, b.group2, , b. group
(n), , 将类另 ij x分成 x.groupl , x.group2, , x. group (n)。
203、 在每个粗分类类别的 n组数据中轮换确定 m组数据为测试分类数据, 并确 定每个粗分类类别其余的 n-m组数据为分类用的训练样本数据,通过 Bayes分类器根 据该训练样本数据对测试分类数据进行分类,得到样本数据的粗分类类别的权重,进 一步的可以根据所述权重确定所述样本数据的粗分类类别在所有类别中的排序位置。 在本实施例中, 分类器包括 bayes分类器, 但不局限于该分类器, 还可以使用其 他的分类器进行分类, 例如: KNN分类器、 SVM分类器、 类中心分类器等都可以用 于数据清洗。所述分类结果集中的每个样本数据都会有样本号、样本数据的粗分类类 别、样本数据的粗分类类别的权重、粗分类类别在所有类别中的排序位置等记录信息。 其中,样本数据的粗分类类别的权重、粗分类类别在所有类别中的排序位置是进行分 类后所得到的分类结果集的元素。
例如, 假设 m=l, 将 a. group 1, a.group2 , , a. group ( n-1 ) , b.groupl, b.group2, , b. group (n-1 ), , x. group 1 , x.group2, , x. group (n-1 ) 作为训练样本数据, a. group (n), b. group (n), , x. group (n) 作为测试分类 数据, 根据这些训练样本数据通过 Bayes分类器对测试分类数据进行分类, 得到分类 结果 1。
将 a.groupl,a.group2, , a. group (n-2), a. group (n), b.groupl , b.group2, , b. group (n-2), b. group (n), , x. group 1 , x.group2, , x. group ( n-2 ) , x. group (n) 作为训练样本数据, a. group (n-1 ), b. group (n-1 ), , x. group (n-1 ) 作 为测试分类数据, 根据这些训练样本数据通过 Bayes 分类器对测试分类数据进行分 类, 得到分类结果 2。 将 a.group2, , a. group ( n ) , b.group2, , b. group ( n ) , , x.group2, , x. group (n)作为训练样本数据, 将 a. group ( 1 ), b. group ( 1 ), , x.group ( 1 ) 作为测试分类数据, 根据这些训练样本数据通过 Bayes分类器对测试分 类数据进行分类, 得到分类结果 n。
将分类结果 1,2, ... ..., n合并, 作为分类结果集 1。
Bayes分类器的 Bayes分类法具体可以为: 假设样本数据用一个 n维特征向量, BP : X={xl , x2, ..., xn} , 样本数据总共有 m个类, 分别用 CI, C2,..., Cm表示。 给定一个未知的样本数据 X (即没有类标号), 若 Bayes分类法将未知的样本数据配 给类 Ci, 则一定是 P(Ci|X)>P(Cj|X), 其中 j≤m, j≠i。
根据贝叶斯定理, 由于 P(X)对于所有类为常数, 最大化后验概率 P(Ci|X)可转化 为最大化先验概率 P(X|Ci)P(Ci)。 如果训练数据集有许多属性和元组, 各属性的取值 互相独立, 这样先验概率 P(xl|Ci), P(x2|Ci), ..., P(xn|Ci)可以由训样本据集通过下 述公式求得。 样本数据的粗分类类别的权重:
P(Ci/X) = P(X/Ci)*P(Ci)/P(X)
p ( c ) = Ci类别的训练样本数
其中, 1 _ ~训练样本总数 ^。
xl ...Xn为独立的事件, 贝 1J :
P(X/Ci)=P(xl/Ci)*P(x2/Ci)....P(xn/Ci)
由于 P(X)对于所有的分类均常数,因此 P(Ci/X)和 P(X/Ci)*P(Ci)成正比,即 P(Ci/X) 的大小依赖于 P(Ci)和 P(xl/Ci)..P(xn/Ci)0 在实际的分类过程中,为了避免出现 Ρ( Χ '' | C = ()的情况,对 Ρ( Χ '' | C 采用下式 nk + 1
进行替代: n + lVQeabular |。 其中 n 为该类别中出现的特征的总数, nk代表特征 wi 出现的次数。 I Vocabulary I 为第一数据集中特征的总数。
所述特征为代表所属类别的关键词。
用以上所述的方法求得样本数据的粗分类类别的权重后,根据求得的权重确定样 本数据的粗分类类别在所有类别中的排序位置。例如,将样本数据按照其粗分类类别 在所有类别中的位置进行排序,当至少两个样本数据的粗分类类别在所有类别中的排 序位置相同时,根据所述粗分类类别的权重对排序位置相同的该至少两个样本数据进 行排序。
204、 对分类结果集 1进行综合评估, 根据所述样本数据的粗分类类别在所有类 别中的排序位置和第一数据集中样本数据的总数量, 得到综合评估结果 Rl。
具体可以为,根据分类结果集中的样本数据的粗分类类别在所有类别中的排序位 置和第一数据集中样本数据的总数量, 获得综合评估结果 R1 :
样本数据归属粗分类类别的数量和
R1= 数据集 A的样本数据的总数量 综合评估结果用于表示样本数据粗分类的正确率。其中, 样本归属粗分类类别根 据样本数据的粗分类类别在所有类别中的排序位置确定。可以定义当粗分类类别的排 序位置在预定位次之前时, 则认为样本数据归属粗分类类别。例如, 以视频样本数据 为例, 类别包括喜剧、 悲剧、 爱情剧、 科幻剧等 10个分类, 预定位次为第 3位, 其 中,样本数据的粗分类类别为喜剧, 经过步骤 203的分类计算后获得的排序位置为第 3位, 排在爱情剧、 科幻剧之后, 则可以确定粗分类类别在预定的第 3位次, 符合要 求, 认为该粗分类类别较为准确, 因此, 确定该样本数据归属所述粗分类类别。
205、 判断综合评估结果 R1是否小于阈值 a (即为第一阈值), 若 Rl>阈值 a, 则 确定不需要对数据集 A进行清洗, 进入步骤 206, 若 Rl<=阈值 a, 则确定需要对数 据集 A进行清洗, 进入步骤 207;
其中, 所述阈值 a为预先设置好的, 用于表示可接受的分类准确率, 可以根据对 样本数据分类准确率的要求高低进行灵活设定。
206、 退出清洗流程, 将数据集 A作为最终清洗结果, 将数据集 A存入目标数据 库中。
207、 根据所述样本数据的粗分类类别在所有类别中的排序位置删除规定数量的 排在末位的样本数据。 将剩余的样本数据作为数据集 B (即第二数据集)。
208、判断数据集 B的样本数据总数占从原始训练数据库中读取的数据集 A中的 样本数据总数的比例, 即数据集 B与数据集 A中样本数据的数量比是否大于约定比 例。 若数据集 B与数据集 A中样本数据的数量比大于约定比例, 则确定数据集 B中 还有足够的样本数据, 数据集 B 为可以用来对清洗效果进行评测的合格数据集, 进 入步骤 209。 否则, 确定数据集 B中的样本数据总数过少, 其为不能用来对清洗效果 进行评测的不合格数据集, 则进入步骤 216。
209、 将数据集 B中每个类别的数据分别随机分成 n组。
本步骤的具体实现方式可参见步骤 202, 在此不再赘述。
另外, 也可以采用与数据集 A相同的分类方式对数据集 B进行分类处理。
210、在数据集 B的每个类别的 n组数据中,轮换确定 m组数据为测试分类数据, 并确定每个类别其余的 n-m组数据为分类用的训练样本数据,通过 Bayes分类器根据 该训练样本数据对测试分类数据进行分类, 得到分类结果集 2。
本步骤的具体实现方式可参见步骤 203, 在此不再赘述。
211、 对分类结果集 2进行综合评估, 得到综合评估结果 R2。
例如, 根据分类结果集 2获取数据集 B的样本数据归属粗分类类别的数量, 并 将综合评估结果 R2定义为样本数据归属粗分类类别的概率。
212、 判断综合评估结果 R2是否小于阈值 a, 若 R2>阈值 a, 则确定不需要对数 据集 B进行清洗, 进入步骤 213, 若 R2<阈值 a, 则确定需要对数据集 B进行清洗, 进入步骤 214;
213、 退出清洗流程, 将数据集 B作为最终清洗结果, 将数据集 B存入目标数据 库中。
214、 判断综合评估结果 R2 和 R1 之差是否大于阈值 b (即为第二阈值)。 若 R2-R1<=阈值 b, 则数据集 B的分类效果没有提高, 进入步骤 215中。 若 1 2-1 1>阈 值 b, 则确定 B的分类效果有提高, 则继续对数据集 B进行清洗, 将数据集 B作为 数据集 A, 返回步骤 201进行清洗处理。
另外, 也可以在确定需要继续对数据集 B 进行清洗时, 直接从当前的分类结果 中获知粗分类类别在所有类别中的排序位置和粗分类类别的权重,然后根据粗分类类 别在所有类别中的排序位置对样本数据进行排序, 并且,在至少两个样本数据的粗分 类类别在所有类别中的排序位置相同时,根据粗分类类别的权重对这些样本数据进行 排序, 删除规定数量的排在末位的样本数据。
215、 判断对数据集 A中的样本数据进行清洗的总次数是否超过规定次数!^。 若 清洗的总次数超过规定次数 K, 则确定对数据集 Α的样本数据已经进行过多次清洗, 但每次清洗后的数据集的分类效果都没有提高, 进入步骤 216。 若清洗的总次数未超 过规定次数 K, 则可能由于对 Α的随机分组不当造成, 对数据集 A重新开始清洗流 程。
216、 退出清洗流程, 对数据集 A的清洗操作失败。
在本实施例中, 配置了三个清洗判断条件, 即判断综合评估结果是否小于规定的 阈值,判断当前的数据集的样本数据总数占从原始训练数据库中读取的样本数据总数 的比例是否大于约定比例,判断当前计算出的综合评估结果和前一次得到的综合评估 结果之差是否大于规定的阈值。 当然, 也可以继续增加或者替换清洗判断条件。这些 清洗判断条件可以通过配置文件进行配置。
本实施例提供的数据清洗方法, 通过获取经过粗分类的样本数据, 将获取的样本 数据作为第一数据集,对所述第一数据集的样本数据进行分类, 获得所述样本数据的 粗分类类别的权重,根据所述权重确定所述样本数据的粗分类类别在所有类别中的排 序位置,并根据所述样本数据的粗分类类别在所有类别中的排序位置和第一数据集中 样本数据的总数量, 获得综合评估结果, 当根据所述综合评估结果确定需要对所述第 一数据集进行清洗时,根据所述样本数据的粗分类类别在所有类别中的排序位置删除 规定数量的排在末位的样本数据,并循环进行上述清洗操作直至数据满足条件完成清 洗。 因此, 可以同时进行多类别数据的清洗, 即, 每个类别的样本数据不仅与该类别 的样本数据作比较,还与所有其它类别的样本数据作比较, 该类别的样本数据在经过 排序清洗后, 同一类别内的样本方差减小, 数据分类的准确性得到提高。 并且, 通过 在迭代过程中逐步从读取的数据集中删除不符合清洗判断规则的文本,对训练数据进 行清洗,进而可以提高数据特征提取的准确性, 从而可以进一步提高数据分类的准确 性。
与上述方法相对应地, 本发明实施例还提供了一种数据清洗装置, 如图 3所示, 包括:
数据获取单元 301, 获取经过粗分类的样本数据, 将获取的样本数据作为第一数 据集;
分类排序单元 302, 用于对所述数据获取单元 301获取的样本数据进行分类, 获 得所述样本数据的粗分类类别的权重,根据所述权重确定所述样本数据的粗分类类别 在所有类别中的排序位置;
综合评估单元 303, 用于根据所述样本数据的粗分类类别在所有类别中的排序位 置和第一数据集中样本数据的总数量, 获得综合评估结果;
数据清洗单元 304, 用于当根据所述综合评估单元 303获得的综合评估结果确定 需要对所述第一数据集进行清洗时,根据所述样本数据的粗分类类别在所有类别中的 排序位置删除规定数量的排在末位的样本数据。
进一步地, 所述分类排序单元 302具体包括:
数据分组子单元, 用于将所述第一数据集中的每个粗分类类别的样本数据分成 n 组, n为大于等于 2的正整数;
数据确定子单元, 用于将每个粗分类类别 n组样本数据中的 m组样本数据作为 测试分类数据, 剩余的 n-m组样本数据作为训练样本数据, m为大于等于 1且小于 n 的正整数;
数据分类子单元,用于通过分类器根据所述训练样本数据对所述测试分类数据进 行分类;
权重获取子单元, 用于获得所述样本数据的粗分类类别的权重;
数据排序子单元,用于根据所述权重确定所述样本数据的粗分类类别在所有类别 中的排序位置。
进一步地, 所述分类器包括 Bayes分类器、 KNN分类器、 SVM分类器或类中心 分类器。
进一步地,当通过 Bayes分类器根据所述训练样本数据对所述测试分类数据进行 分类时, 所述权重获取子单元, 具体用于根据公式 P(Ci/X) = P(X/Ci)*P(Ci)/P(X)获取 p ( c ) = Ci类别的训练样本数 所述样本数据的粗分类类别的权重, 其中, 1 _ 训练样本总数 , P(X/Ci)=P(xl/Ci)*P(x2/Ci)....P(xn/Ci), 样本数据用一个 n维特征向量, S卩: X={xl , x2, ..., xn} , 样本数据的粗分类类别共有 m个类, 分别用 CI, C2,..., Cm表示。
进一步地, 所述数据排序子单元, 具体用于当至少两个样本数据的粗分类类别在 所有类别中的排序位置相同时,根据所述粗分类类别的权重对排序位置相同的所述至 少两个样本数据进行排序。
进一步地, 所述数据清洗单元 304包括:
清洗判断子单元, 用于当确定所述综合评估结果不大于第一阈值时, 确定需要对 所述样本数据进行清洗; 当确定所述综合评估结果大于第一阈值时,将所述第一数据 集作为最终清洗结果;
数据删除子单元,用于当所述清洗判断子单元确定需要对所述第一数据集进行清 洗时,根据所述样本数据的粗分类类别在所有类别中的排序位置删除规定数量的排在 末位的样本数据。
进一步地,所述数据获取单元,还用于将清洗后剩余的样本数据作为第二数据集, 判断所述第二数据集与第一数据集中样本数据的数量比是否大于约定比例, 如果是, 则将所述第二数据集作为继续清洗的对象; 如果否, 则清洗失败, 结束清洗;
所述数据清洗单元,还用于直接采用对第一数据集进行处理时获得的所述样本数 据的粗分类类别的权重和所述样本数据的粗分类类别在所有类别中的排序位置对所 述第二数据集进行清洗。
进一步地,所述数据获取单元,还用于将清洗后剩余的样本数据作为第二数据集, 判断所述第二数据集与第一数据集中样本数据的数量比是否大于约定比例, 如果是, 则将所述第二数据集作为继续清洗的对象; 如果否, 则清洗失败, 结束清洗; 在确定 第二数据集的综合评估结果不大于第一阈值,且第二数据集的综合评估结果与第一数 据集的综合评估结果之差不大于第二预设阈值, 且清洗次数未超过预设次数时,将第 一数据集作为重新进行清洗的对象;在确定第二数据集的综合评估结果不大于第一阈 值,且第二数据集的综合评估结果与第一数据集的综合评估结果之差不大于第二预设 阈值, 且清洗次数超过预设次数时, 对第一数据集的清洗失败, 结束清洗;
所述分类排序单元,还用于所述第二数据集的分类方式采用与第一数据集相同的 分类方式, 获得所述第二数据集的样本数据的粗分类类别的权重,根据所述权重确定 所述第二数据集的样本数据的粗分类类别在所有类别中的排序位置;
所述综合评估单元,还用于根据所述第二数据集的样本数据的粗分类类别在所有 类别中的排序位置和第二数据集中样本数据的总数量, 获得综合评估结果; 所述数据清洗单元, 还用于在确定第二数据集的综合评估结果大于第一阈值时, 将所述第二数据集作为最终清洗结果;在确定第二数据集的综合评估结果不大于第一 阈值,且第二数据集的综合评估结果与第一数据集的综合评估结果之差大于第二预设 阈值时,根据第二数据集的样本数据的粗分类类别在所有类别中的排序位置删除规定 数量的排在末位的样本数据。
本实施例数据清洗装置的工作方法可参考图 1和图 2所示的实施例。
本实施例提供的数据清洗装置, 通过获取经过粗分类的样本数据, 将获取的样本 数据作为第一数据集,对所述第一数据集的样本数据进行分类, 获得所述样本数据的 粗分类类别的权重,根据所述权重确定所述样本数据的粗分类类别在所有类别中的排 序位置,并根据所述样本数据的粗分类类别在所有类别中的排序位置和第一数据集中 样本数据的总数量, 获得综合评估结果, 当根据所述综合评估结果确定需要对所述第 一数据集进行清洗时,根据所述样本数据的粗分类类别在所有类别中的排序位置删除 规定数量的排在末位的样本数据,并循环进行上述清洗操作直至数据满足条件完成清 洗。 因此, 可以同时进行多类别数据的清洗, 即, 每个类别的样本数据不仅与该类别 的样本数据作比较,还与所有其它类别的样本数据作比较, 该类别的样本数据在经过 排序清洗后, 同一类别内的样本方差减小, 数据分类的准确性得到提高。
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以 通过计算机程序来指令相关的硬件来完成,所述的程序可存储于一计算机可读取存储 介质中, 该程序在执行时, 可包括如上述各方法的实施例的流程。 其中, 所述的存储 介质可为磁碟、 光盘、 只读存储记忆体 (Read-Only Memory, ROM) 或随机存储记 忆体 (Random Access Memory, RAM) 等。
以上所述, 仅为本发明的具体实施方式, 但本发明的保护范围并不局限于此, 任 何熟悉本技术领域的技术人员在本发明揭露的技术范围内, 可轻易想到变化或替换, 都应涵盖在本发明的保护范围之内。因此,本发明的保护范围应所述以权利要求的保 护范围为准。

Claims

权 利 要 求
1. 一种数据清洗方法, 其特征在于, 包括:
获取经过粗分类的样本数据, 将获取的样本数据作为第一数据集; 对所述样本数据进行分类, 获得所述样本数据的粗分类类别的权重, 根据所 述权重确定所述样本数据的粗分类类别在所有类别中的排序位置;
根据所述样本数据的粗分类类别在所有类别中的排序位置和第一数据集中 样本数据的总数量, 获得综合评估结果;
当根据所述综合评估结果确定需要对所述第一数据集进行清洗时,根据所述 样本数据的粗分类类别在所有类别中的排序位置删除规定数量的排在末位的样 本数据。
2. 根据权利要求 1 所述的数据清洗方法, 其特征在于, 根据所述综合评估 结果确定需要对所述第一数据集进行清洗包括:
当所述综合评估结果不大于第一阈值时,即为需要对所述第一数据集进行清 洗,当所述综合评估结果大于第一阈值时,将所述第一数据集作为最终清洗结果。
3. 根据权利要求 1或 2所述的数据清洗方法, 其特征在于, 还包括: 将清洗后剩余的样本数据作为第二数据集;
判断所述第二数据集与第一数据集中样本数据的数量比是否大于约定比例, 如果是, 则对所述第二数据集继续进行清洗; 如果否, 则清洗失败, 结束清洗。
4. 根据权利要求 1 所述的数据清洗方法, 其特征在于, 所述对所述样本数 据进行分类包括:
将所述第一数据集中的每个粗分类类别的样本数据分成 n组, n为大于等于 2的正整数;
将每个粗分类类别 n组样本数据中的 m组样本数据作为测试分类数据, 剩 余的 n-m组样本数据作为训练样本数据, m为大于等于 1且小于 n的正整数; 通过分类器根据所述训练样本数据对所述测试分类数据进行分类。
5. 根据权利要求 4所述的数据清洗方法, 其特征在于,
所述分类器包括 Bayes分类器、 KNN分类器、 SVM分类器或类中心分类器。
6. 根据权利要求 5所述的数据清洗方法, 其特征在于, 当通过 Bayes分类 器根据所述训练样本数据对所述测试分类数据进行分类时,所述样本数据的粗分 类类别的权重由下述公式计算得到:
P(Ci/X) = P(X/Ci)*P(Ci)/P(X) p ( C ) = Ci类别的训练样本数
其中, 1 _ ~训练样本总数 ^。
7. 根据权利要求 6所述的数据清洗方法, 其特征在于,
P(X/Ci)=P(xl/Ci)*P(x2/Ci)....P(xn/Ci)
其中, 样本数据用一个 n维特征向量, BP : X={xl , x2, ..., xn} , 样本数 据的粗分类类别共有 m个类, 分别用 C1, C2,..., Cm表示。
8. 根据权利要求 7所述的数据清洗方法, 其特征在于,
当 P( X l' | C;') = 0时, 将所述 Ρ( χ I C )采用下式进行替代: nk + 1
n + |Vocabulary|
其中, n 为该类别中出现的特征的总数, nk 代表特征 wi 出现的次数, I Vocabulary | 为第一数据集中特征的总数;
所述特征为代表所属类别的关键词。
9. 根据权利要求 3 所述的数据清洗的方法, 其特征在于, 所述对所述第二 数据集继续进行清洗的方法包括:
采用与第一数据集相同的分类方式; 或,
直接采用对第一数据集进行处理时获得的所述样本数据的粗分类类别的权 重和所述样本数据的粗分类类别在所有类别中的排序位置对所述第二数据集进 行清洗。
10. 根据权利要求 3或 9所述的数据清洗的方法, 其特征在于,
当采用与第一数据集相同的分类方式对第二数据集进行处理时,判断第二数 据集的综合评估结果是否大于第一阈值, 如果是, 则将所述第二数据集作为最终 清洗结果。
11. 根据权利要求 10所述的数据清洗方法, 其特征在于, 当第二数据集的 综合评估结果不大于第一阈值时,判断第二数据集的综合评估结果与第一数据集 的综合评估结果之差是否大于第二预设阈值, 如果是, 则对数据集继续进行循环 清洗; 如果否, 则判断清洗次数是否超过预设次数, 如果未超过, 则对第一数据 集重新进行清洗; 如果超过, 则退出清洗, 对第一数据集的清洗失败。
12. 根据权利要求 1所述的数据清洗的方法, 其特征在于, 所述根据所述样 本数据的粗分类类别在所有类别中的排序位置删除规定数量的排在末位的样本 数据还包括:
当至少两个样本数据的粗分类类别在所有类别中的排序位置相同时,根据所 述粗分类类别的权重对排序位置相同的所述至少两个样本数据进行排序。
13. 一种数据清洗装置, 其特征在于, 包括:
数据获取单元, 用于获取经过粗分类的样本数据, 将获取的样本数据作为第 一数据集;
分类排序单元, 用于对所述数据获取单元获取的样本数据进行分类, 获得所 述样本数据的粗分类类别的权重,根据所述权重确定所述样本数据的粗分类类别 在所有类别中的排序位置;
综合评估单元,用于根据所述样本数据的粗分类类别在所有类别中的排序位 置和第一数据集中样本数据的总数量, 获得综合评估结果;
数据清洗单元,用于当根据所述综合评估单元获得的综合评估结果确定需要 对所述第一数据集进行清洗时,根据所述样本数据的粗分类类别在所有类别中的 排序位置删除规定数量的排在末位的样本数据。
14. 根据权利要求 13 所述的数据清洗装置, 其特征在于, 所述分类排序单 元包括:
数据分组子单元,用于将所述第一数据集中的每个粗分类类别的样本数据分 成 n组, n为大于等于 2的正整数;
数据确定子单元, 用于将每个粗分类类别 n组样本数据中的 m组样本数据 作为测试分类数据, 剩余的 n-m组样本数据作为训练样本数据, m为大于等于 1 且小于 n的正整数;
数据分类子单元,用于通过分类器根据所述训练样本数据对所述测试分类数 据进行分类;
权重获取子单元, 用于获得所述样本数据的粗分类类别的权重;
数据排序子单元,用于根据所述权重确定所述样本数据的粗分类类别在所有 类别中的排序位置。
15. 根据权利要求 14所述的数据清洗装置, 其特征在于, 所述分类器包括
Bayes分类器、 K N分类器、 SVM分类器或类中心分类器。
16. 根据权利要求 15所述的数据清洗装置, 其特征在于, 当通过 Bayes分 类器根据所述训练样本数据对所述测试分类数据进行分类时,所述权重获取子单 元, 具体用于根据公式 P(Ci/X) = P(X/Ci)*P(Ci)/P(X)获取所述样本数据的粗分类
p ( c ) = Ci类别的训练样本数 类 别 的 权 重 , 其 中 , 1 训练样本总数 ,
P(X/Ci)=P(xl/Ci)*P(x2/Ci)....P(xn/Ci),样本数据用一个 n维特征向量,即: X={xl, x2, ..., xn} , 样本数据的粗分类类别共有 m个类, 分别用 CI, C2,..., Cm表示。
17. 根据权利要求 14所述的数据清洗装置, 其特征在于, 所述数据排序子 单元,具体用于当至少两个样本数据的粗分类类别在所有类别中的排序位置相同 时,根据所述粗分类类别的权重对排序位置相同的所述至少两个样本数据进行排 序。
18. 根据权利要求 13 所述的数据清洗装置, 其特征在于, 所述数据清洗单 元包括:
清洗判断子单元, 用于当确定所述综合评估结果不大于第一阈值时, 确定需 要对所述样本数据进行清洗; 当确定所述综合评估结果大于第一阈值时, 将所述 第一数据集作为最终清洗结果;
数据删除子单元,用于当所述清洗判断子单元确定需要对所述第一数据集进 行清洗时,根据所述样本数据的粗分类类别在所有类别中的排序位置删除规定数 量的排在末位的样本数据。
19. 根据权利要求 13-18任一所述的数据清洗装置, 其特征在于, 所述数据 获取单元, 还用于将清洗后剩余的样本数据作为第二数据集, 判断所述第二数据 集与第一数据集中样本数据的数量比是否大于约定比例, 如果是, 则将所述第二 数据集作为继续清洗的对象; 如果否, 则清洗失败, 结束清洗;
所述数据清洗单元,还用于直接采用对第一数据集进行处理时获得的所述样 本数据的粗分类类别的权重和所述样本数据的粗分类类别在所有类别中的排序 位置对所述第二数据集进行清洗。
20. 根据权利要求 13-18任一所述的数据清洗装置, 其特征在于, 所述数据 获取单元, 还用于将清洗后剩余的样本数据作为第二数据集, 判断所述第二数据 集与第一数据集中样本数据的数量比是否大于约定比例, 如果是, 则将所述第二 数据集作为继续清洗的对象; 如果否, 则清洗失败, 结束清洗; 在确定第二数据 集的综合评估结果不大于第一阈值,且第二数据集的综合评估结果与第一数据集 的综合评估结果之差不大于第二预设阈值, 且清洗次数未超过预设次数时, 将第 一数据集作为重新进行清洗的对象;在确定第二数据集的综合评估结果不大于第 一阈值,且第二数据集的综合评估结果与第一数据集的综合评估结果之差不大于 第二预设阈值, 且清洗次数超过预设次数时, 对第一数据集的清洗失败, 结束清 洗;
所述分类排序单元,还用于所述第二数据集的分类方式采用与第一数据集相 同的分类方式, 获得所述第二数据集的样本数据的粗分类类别的权重, 根据所述 权重确定所述第二数据集的样本数据的粗分类类别在所有类别中的排序位置; 所述综合评估单元,还用于根据所述第二数据集的样本数据的粗分类类别在 所有类别中的排序位置和第二数据集中样本数据的总数量, 获得综合评估结果; 所述数据清洗单元,还用于在确定第二数据集的综合评估结果大于第一阈值 时, 将所述第二数据集作为最终清洗结果; 在确定第二数据集的综合评估结果不 大于第一阈值,且第二数据集的综合评估结果与第一数据集的综合评估结果之差 大于第二预设阈值时,根据第二数据集的样本数据的粗分类类别在所有类别中的 排序位置删除规定数量的排在末位的样本数据。
PCT/CN2011/075350 2010-12-08 2011-06-03 数据清洗方法及装置 WO2011147366A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN2010105784799A CN102135979B (zh) 2010-12-08 2010-12-08 数据清洗方法及装置
CN201010578479.9 2010-12-08

Publications (1)

Publication Number Publication Date
WO2011147366A1 true WO2011147366A1 (zh) 2011-12-01

Family

ID=44295767

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2011/075350 WO2011147366A1 (zh) 2010-12-08 2011-06-03 数据清洗方法及装置

Country Status (2)

Country Link
CN (1) CN102135979B (zh)
WO (1) WO2011147366A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105653696A (zh) * 2015-12-29 2016-06-08 台山核电合营有限公司 一种核电站数据库数据处理方法及系统

Families Citing this family (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103365765B (zh) * 2012-03-28 2016-10-12 腾讯科技(深圳)有限公司 测试用例筛选方法和系统
WO2013190084A1 (en) 2012-06-21 2013-12-27 Philip Morris Products S.A. Systems and methods for generating biomarker signatures with integrated bias correction and class prediction
CN104750861B (zh) * 2015-04-16 2019-05-21 中国电力科学研究院 一种储能电站海量数据清洗方法及系统
CN105868165B (zh) * 2016-04-15 2018-06-12 华中科技大学 一种电站锅炉运行数据清洗方法
CN106838872B (zh) * 2017-01-13 2018-11-30 华中科技大学 一种余热锅炉汽水泄漏诊断的数据预处理方法
CN108664497B (zh) * 2017-03-30 2020-11-03 大有秦鼎(北京)科技有限公司 数据匹配的方法和装置
CN107028718A (zh) * 2017-05-24 2017-08-11 深圳先进技术研究院 一种基于压力传感器的上下床监护系统和方法
CN109829315A (zh) * 2017-11-23 2019-05-31 西门子(中国)有限公司 日志处理的方法、装置及计算机可读存储介质
CN110400208B (zh) * 2018-04-25 2021-03-12 上海方付通商务服务有限公司 一种小微风险控制模型构建方法及应用方法
CN108804533B (zh) * 2018-05-04 2021-11-30 佛山科学技术学院 一种异构大数据信息的过滤方法及装置
CN111277451B (zh) * 2018-12-05 2021-10-15 中国移动通信集团北京有限公司 一种业务评估方法、装置、终端设备和介质
CN110990384B (zh) * 2019-11-04 2023-08-22 武汉中卫慧通科技有限公司 一种大数据平台bi分析方法
CN112633320B (zh) * 2020-11-26 2023-04-07 西安电子科技大学 基于相像系数和dbscan的雷达辐射源数据清洗方法
CN113315813A (zh) * 2021-05-08 2021-08-27 重庆第二师范学院 一种大数据网际信息链系统的信息交换方法及系统

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1679027A (zh) * 2002-08-26 2005-10-05 皇家飞利浦电子股份有限公司 用于检测视频图像序列中内容属性的设备和方法

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8150814B2 (en) * 2009-04-07 2012-04-03 Business Objects Software Ltd. System and method of data cleansing using rule based formatting

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1679027A (zh) * 2002-08-26 2005-10-05 皇家飞利浦电子股份有限公司 用于检测视频图像序列中内容属性的设备和方法

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
LI XINGYI ET AL.: "Outlier Data Mining Algorithms Based on Weighted Fast Clustering.", COMPUTER ENGINEERING AND APPLICATIONS., vol. 43, no. 35, 21 December 2007 (2007-12-21), pages 153 - 155 *
LUKASZ CISZAK.: "Application of Clustering and Association Methods in Data Cleaning.", PROCEEDINGS OF THE INTERNATIONAL MULTICONFERENCE ON COMPUTER SCIENCE AND INFORMATION TECHNOLOGY, 2008. IMCSIT 2008, 20 October 2008 (2008-10-20), pages 97 - 103 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105653696A (zh) * 2015-12-29 2016-06-08 台山核电合营有限公司 一种核电站数据库数据处理方法及系统

Also Published As

Publication number Publication date
CN102135979A (zh) 2011-07-27
CN102135979B (zh) 2013-10-09

Similar Documents

Publication Publication Date Title
WO2011147366A1 (zh) 数据清洗方法及装置
US10459971B2 (en) Method and apparatus of generating image characteristic representation of query, and image search method and apparatus
CN107609121B (zh) 基于LDA和word2vec算法的新闻文本分类方法
Liu et al. Unsupervised one-class learning for automatic outlier removal
CN108363810B (zh) 一种文本分类方法及装置
WO2018196798A1 (zh) 用户客群分类方法和装置
WO2019169700A1 (zh) 一种数据分类方法、装置、设备及计算机可读存储介质
CA2777506C (en) System and method for grouping multiple streams of data
Arguello et al. Classification-based resource selection
CN107305637B (zh) 基于K-Means算法的数据聚类方法和装置
US20120310864A1 (en) Adaptive Batch Mode Active Learning for Evolving a Classifier
CN101477563B (zh) 一种短文本聚类的方法、系统及其数据处理装置
Fahy et al. Dynamic feature selection for clustering high dimensional data streams
WO2010071997A1 (en) Method and system for hybrid text classification
NZ533105A (en) Systems, methods, and software for classifying documents
WO2016155493A1 (zh) 数据处理方法及装置
WO2017113592A1 (zh) 模型生成方法、词语赋权方法、装置、设备及计算机存储介质
CN113139134B (zh) 一种社交网络中用户生成内容的流行度预测方法、装置
He et al. Finding good feedback documents
US20030229604A1 (en) Large margin perceptrons for document categorization
Vinagre et al. Collaborative filtering with recency-based negative feedback
Shoohi et al. DCGAN for Handling Imbalanced Malaria Dataset based on Over-Sampling Technique and using CNN.
JP4807880B2 (ja) 蓄積文書分類装置、蓄積文書分類方法、プログラムおよび記録媒体
Su et al. Automatic hierarchical classification of structured deep web databases
CN112733006B (zh) 用户画像的生成方法、装置、设备及存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 11786138

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 11786138

Country of ref document: EP

Kind code of ref document: A1