数据预处理.ppt

上传人:sccc 文档编号:5360063 上传时间:2023-06-29 格式:PPT 页数:52 大小:679.51KB
返回 下载 相关 举报
数据预处理.ppt_第1页
第1页 / 共52页
数据预处理.ppt_第2页
第2页 / 共52页
数据预处理.ppt_第3页
第3页 / 共52页
数据预处理.ppt_第4页
第4页 / 共52页
数据预处理.ppt_第5页
第5页 / 共52页
点击查看更多>>
资源描述

《数据预处理.ppt》由会员分享,可在线阅读,更多相关《数据预处理.ppt(52页珍藏版)》请在三一办公上搜索。

1、Data Preprocessing,School of Software,Nanjing University,Knowledge Discovery in Databases,Chapter 3:Data Preprocessing,Why data preprocessing?Data cleaning Data integration and transformationData reductionDiscretization and concept hierarchy generationSummary,Why Data Preprocessing?,Data in the real

2、 world is dirtyincomplete:lacking attribute values,lacking certain attributes of interest,or containing only aggregate datanoisy:containing errors or outliersinconsistent:containing discrepancies in codes or namesNo quality data,no quality mining results!Quality decisions must be based on quality da

3、taData warehouse needs consistent integration of quality data,Major Tasks in Data Preprocessing,Data cleaningFill in missing values,smooth noisy data,identify or remove outliers,and resolve inconsistenciesData integrationIntegration of multiple databases,data cubes,or filesData transformationNormali

4、zation and aggregationData reductionObtains reduced representation in volume but produces the same or similar analytical resultsData discretizationPart of data reduction but with particular importance,especially for numerical data,Forms of data preprocessing,Chapter 3:Data Preprocessing,Why data pre

5、processing?Data cleaning Data integration and transformationData reductionDiscretization and concept hierarchy generationSummary,Data Cleaning,Data cleaning tasksFill in missing valuesIdentify outliers and smooth out noisy data Correct inconsistent data,Missing Data,Data is not always availableE.g.,

6、many tuples have no recorded value for several attributes,such as“customer income”in sales dataMissing data may be due to equipment malfunctioninconsistent with other recorded data and thus deleteddata not entered due to misunderstandingcertain data may not be considered important at the time of ent

7、rynot register history or changes of the dataMissing data may need to be inferred.,How to Handle Missing Data?,Ignore the tuple:usually done when class label is missing(assuming the tasks in classification)not effective when the percentage of missing values per attribute varies considerably.Fill in

8、the missing value manually:tedious+infeasible?Use a global constant to fill in the missing value:e.g.,“unknown”,a new class?!Use the attribute mean to fill in the missing valueUse the attribute mean for all samples belonging to the same class to fill in the missing value:smarterUse the most probable

9、 value to fill in the missing value:inference-based such as Bayesian formula or decision tree,Noisy Data,Noise:random error or variance in a measured variableIncorrect attribute values may due tofaulty data collection instrumentsdata entry problemsdata transmission problemstechnology limitation(e.g.

10、Input cache capacity)inconsistency in naming convention Other data problems which requires data cleaningduplicate recordsincomplete datainconsistent data,How to Handle Noisy Data?,Binning method:first sort data and partition into(equi-depth)binsthen one can smooth by bin means,smooth by bin median,s

11、mooth by bin boundaries,etc.Clusteringdetect and remove outliersCombined computer and human inspectiondetect suspicious values and check by humanRegressionsmooth by fitting the data into regression functions,Simple Discretization Methods:Binning,Equal-width(distance)partitioning:It divides the range

12、 into N intervals of equal size:uniform gridif A and B are the lowest and highest values of the attribute,the width of intervals will be:W=(B-A)/N.The most straightforwardBut outliers may dominate presentationSkewed data is not handled well.Equal-depth(frequency)partitioning:It divides the range int

13、o N intervals,each containing approximately same number of samplesGood data scalingManaging categorical attributes can be tricky.,Binning Methods for Data Smoothing,*Sorted data for price(in dollars):4,8,9,15,21,21,24,25,26,28,29,34*Partition into(equi-depth)bins:-Bin 1:4,8,9,15-Bin 2:21,21,24,25-Bi

14、n 3:26,28,29,34*Smoothing by bin means:-Bin 1:9,9,9,9-Bin 2:23,23,23,23-Bin 3:29,29,29,29*Smoothing by bin boundaries:-Bin 1:4,4,4,15-Bin 2:21,21,25,25-Bin 3:26,26,26,34,Cluster Analysis,Regression,x,y,y=x+1,X1,Y1,Y1,Chapter 3:Data Preprocessing,Why data preprocessing?Data cleaning Data integration

15、and transformationData reductionDiscretization and concept hierarchy generationSummary,Data Integration,Data integration:combines data from multiple sources into a coherent storeSchema integrationintegrate metadata from different sourcesEntity identification problem:identify real world entities from

16、 multiple data sources,e.g.,A.cust-id B.cust-#Detecting and resolving data value conflictsfor the same real world entity,attribute values from different sources are differentpossible reasons:different representations,different scales,e.g.,metric vs.British units,Handling Redundant Data in Data Integ

17、ration,Redundant data occur often when integration of multiple databasesThe same attribute may have different names in different databasesOne attribute may be a“derived”attribute in another table,e.g.,annual revenueRedundant data may be able to be detected by correlational analysisCareful integratio

18、n of the data from multiple sources may help reduce/avoid redundancies and inconsistencies and improve mining speed and quality,Data Transformation,Smoothing:remove noise from dataAggregation:summarization,data cube constructionGeneralization:concept hierarchy climbingNormalization:scaled to fall wi

19、thin a small,specified rangemin-max normalizationz-score normalizationnormalization by decimal scalingAttribute/feature constructionNew attributes constructed from the given ones,Data Transformation:Normalization,min-max normalizationz-score normalizationnormalization by decimal scaling,Where j is t

20、he smallest integer such that Max(|)1,Samples,Min-max normalizationAn attribute:income,having values from 12000 to 98000If we want to map a value 73000 to a new scope 0.0,1.0Then(73000-12000)/(98000-12000)(1.0-0)=0.716Z-score normalizationIf the average of the attribute“income”is 54000,and the stand

21、ard deviation is 16000Then(73000-54000)/16000=1.225 Normalization by decimal scalingGiven an attribute A,having values from 986 to 987,the maximum absolution is 987,so we get j=3(that is 1000)-986 will be transformed to 0.986,Chapter 3:Data Preprocessing,Why data preprocessing?Data cleaning Data int

22、egration and transformationData reductionDiscretization and concept hierarchy generationSummary,Data Reduction Strategies,Warehouse may store terabytes of data:Complex data analysis/mining may take a very long time to run on the complete data setData reduction Obtains a reduced representation of the

23、 data set that is much smaller in volume but yet produces the same(or almost the same)analytical resultsData reduction strategiesData cube aggregationDimensionality reductionNumerosity reductionDiscretization and concept hierarchy generation,Data Cube Aggregation,The lowest level of a data cubeThe a

24、ggregated data for an individual entity of intereste.g.,a customer in a phone calling data warehouse.Multiple levels of aggregation in data cubesFurther reduce the size of data to deal withReference appropriate levelsUse the smallest representation which is enough to solve the taskQueries regarding

25、aggregated information should be answered using data cube,when possible,Dimensionality Reduction,Feature selection(i.e.,attribute subset selection):Select a minimum set of features such that the probability distribution of different classes given the values for those features is as close as possible

26、 to the original distribution given the values of all featuresreduce#of patterns in the patterns,easier to understandThere are 2d possible sub-features of d featuresTo test all these subsets is probably impossible if the number of features is too hugeSo heuristic methods is often used to solve the p

27、roblem,Heuristic Feature Selection Methods,Several heuristic feature selection methods:Best single features under the feature independence assumption:choose by significance tests.Best step-wise feature selection:The best single-feature is picked firstThen next best feature condition to the first,.St

28、ep-wise feature elimination:Repeatedly eliminate the worst featureBest combined feature selection and eliminationDecision tree:ID3,C4.5,etc.,Example of Decision Tree Induction,Initial attribute set:A1,A2,A3,A4,A5,A6,A4?,A1?,A6?,Class 1,Class 2,Class 1,Class 2,Reduced attribute set:A1,A4,A6,Data Comp

29、ression,String compressionThere are extensive theories and well-tuned algorithmsTypically losslessBut only limited manipulation is possible without expansionAudio/video compressionTypically lossy compression,with progressive refinementSometimes small fragments of signal can be reconstructed without

30、reconstructing the whole,Data Compression,Original Data,Compressed Data,lossless,Original DataApproximated,lossy,Numerosity Reduction,Parametric methodsAssume the data fits some model,estimate model parameters,store only the parameters,and discard the data(except possible outliers)RegressionLog-line

31、ar models:obtain value at a point in m-D space as the product on appropriate marginal subspaces Non-parametric methods Do not assume modelsMajor families:histograms,clustering,sampling,Regression and Log-Linear Models,Linear regression:Data are modeled to fit a straight lineOften uses the least-squa

32、re method to fit the lineMultiple regression:allows a response variable Y to be modeled as a linear function of multidimensional feature vectorLog-linear model:approximates discrete multidimensional probability distributions,Linear regression:Y=+XTwo parameters,and specify the line and are to be est

33、imated by using the data at hand.using the least squares criterion to the known values of Y1,Y2,X1,X2,.Multiple regression:Y=b0+b1 X1+b2 X2.Many nonlinear functions can be transformed into the above.Log-linear models:The multi-way table of joint probabilities is approximated by a product of lower-or

34、der tables.Probability:p(a,b,c,d)=ab acad bcd,Regress Analysis and Log-Linear Models,Histograms,A popular data reduction techniqueDivide data into buckets and store average(sum)for each bucketCan be constructed optimally in one dimension using dynamic programmingRelated to quantization problems.,Clu

35、stering,Partition data set into clusters,and one can store cluster representation onlyCan be very effective if data is clustered but not if data is“smeared”Can have hierarchical clustering and be stored in multi-dimensional index tree structuresThere are many choices of clustering definitions and cl

36、ustering algorithms,further detailed in Chapter 8,Sampling,Allow a mining algorithm to run in complexity that is potentially sub-linear to the size of the dataChoose a representative subset of the dataSimple random sampling may have very poor performance in the presence of skewDevelop adaptive sampl

37、ing methodsStratified sampling:Approximate the percentage of each class(or subpopulation of interest)in the overall database Used in conjunction with skewed data,Sampling,SRSWOR(simple random sample without replacement),SRSWR,Raw Data,Sampling,Raw Data,Cluster/Stratified Sample,Chapter 3:Data Prepro

38、cessing,Why data preprocessing?Data cleaning Data integration and transformationData reductionDiscretization and concept hierarchy generationSummary,Discretization,Three types of attributes:Nominal values from an unordered setOrdinal values from an ordered setContinuous real numbersDiscretization:di

39、vide the range of a continuous attribute into intervalsSome classification algorithms only accept categorical attributes.Reduce data size by discretizationPrepare for further analysis,Discretization and Concept hierachy,Discretization reduce the number of values for a given continuous attribute by d

40、ividing the range of the attribute into intervals.Interval labels can then be used to replace actual data values.Concept hierarchies reduce the data by collecting and replacing low level concepts(such as numeric values for the attribute age)by higher level concepts(such as young,middle-aged,or senio

41、r).,Discretization and concept hierarchy generation for numeric data,Binning(see sections before)Histogram analysis(see sections before)Clustering analysis(see sections before)Entropy-based discretization(will be introduced later)Segmentation by natural partitioning,Entropy-Based Discretization,Give

42、n a set of samples S,if S is partitioned into two intervals S1 and S2 using boundary T,the entropy after partitioning isThe boundary that minimizes the entropy function over all possible boundaries is selected as a binary discretization.The process is recursively applied to partitions obtained until

43、 some stopping criterion is met,e.g.,Experiments show that it may reduce data size and improve classification accuracySee the chapter”concept description and discrimination mining”,Segmentation by natural partitioning,3-4-5 rule can be used to segment numeric data into relatively uniform,“natural”in

44、tervals.*If an interval covers 3,6,7 or 9 distinct values at the most significant digit,partition the range into 3 equi-width intervals*If it covers 2,4,or 8 distinct values at the most significant digit,partition the range into 4 intervals*If it covers 1,5,or 10 distinct values at the most signific

45、ant digit,partition the range into 5 intervals,Example of 3-4-5 rule,(-$400-$5,000),Step 4:,Concept hierarchy generation for categorical data,Specification of a partial ordering of attributes explicitly at the schema level by users or expertsSpecification of a portion of a hierarchy by explicit data

46、 groupingSpecification of a set of attributes,but not of their partial orderingSpecification of only a partial set of attributes,Specification of a set of attributes,Concept hierarchy can be automatically generated based on the number of distinct values per attribute in the given attribute setThe at

47、tribute with the most distinct values is placed at the lowest level of the hierarchy,country,province_or_ state,city,street,15 distinct values,65 distinct values,3567 distinct values,674,339 distinct values,Chapter 3:Data Preprocessing,Why data preprocessing?Data cleaning Data integration and transf

48、ormationData reductionDiscretization and concept hierarchy generationSummary,Summary,Data preparation is a big issue for both warehousing and miningData preparation includesData cleaning and data integrationData reduction and feature selectionDiscretizationA lot of methods have been developed but st

49、ill an active area of research,References,J.Han and M.Kamber.Data Mining:Concepts and Techniques.Morgan Kaufmann,2000.(Including Materials)D.P.Ballou and G.K.Tayi.Enhancing data quality in data warehouse environments.Communications of ACM,42:73-78,1999.Jagadish et al.,Special Issue on Data Reduction

50、 Techniques.Bulletin of the Technical Committee on Data Engineering,20(4),December 1997.D.Pyle.Data Preparation for Data Mining.Morgan Kaufmann,1999.T.Redman.Data Quality:Management and Technology.Bantam Books,New York,1992.Y.Wand and R.Wang.Anchoring data quality dimensions ontological foundations.

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 建筑/施工/环境 > 农业报告


备案号:宁ICP备2025010119号-1

经营许可证:宁B2-20210002

宁公网安备 64010402000987号