Download presentation
Presentation is loading. Please wait.
Published byAngel Torbett Modified over 9 years ago
1
1 Copyright by Jiawei Han, modified by Charles Ling for cs411a/538a Data Mining and Data Warehousing v Introduction v Data warehousing and OLAP for data mining v Data preprocessing v Primitives for data mining v Concept description v Mining association rules in large databases v Classification and prediction v Cluster analysis v Mining complex types of data Applications and trends in data mining
2
2 Copyright by Jiawei Han, modified by Charles Ling for cs411a/538a Data Mining and Warehousing: Session 3 Data Preprocessing
3
3 Copyright by Jiawei Han, modified by Charles Ling for cs411a/538a Session 3: Data Preprocessing v Motivation: Why data preprocessing? v Data cleaning v Data integration and transformation v Data reduction v Discretization and concept hierarchy generation v Conclusions
4
4 Copyright by Jiawei Han, modified by Charles Ling for cs411a/538a Why Data Preprocessing? v Real world data is dirty, inconsistent, or incomplete V Quality decisions must be based on quality data V Data could be incomplete, inconsistent, or missing V Data warehouse needs consistent integration of quality data v Major tasks in data preprocessing V Data cleaning: V Data integration V Data transformation V Data reduction r reduced representation but produces the same/similar analysis results V Data discretization
5
5 Copyright by Jiawei Han, modified by Charles Ling for cs411a/538a Forms of data preprocessing
6
6 Copyright by Jiawei Han, modified by Charles Ling for cs411a/538a Data Cleaning v Fill in missing values v Identify outliers and Smooth out noisy data v Correct inconsistent data
7
7 Copyright by Jiawei Han, modified by Charles Ling for cs411a/538a Missing Data v Data is not always available V E.g., many tuples have no recorded value for several attributes, such as customer income in sales data v Missing data may be due to V equipment malfunction V inconsistent with other recorded data and thus deleted V data not entered due to misunderstanding V certain data may not be considered important at the time of entry V not register history or changes of the data v Missing data may need to be inferred.
8
8 Copyright by Jiawei Han, modified by Charles Ling for cs411a/538a How to Handle Missing Data? v Ignore the tuple: when class label is missing, but not effective when the missing values in attributes spread in different tuples. v Fill in the missing value manually: tedious + infeasible? v Using a global constant to fill in the missing value: e.g., “unknown”, a new value? v Use the attribute mean to fill in the missing value v Use the attribute mean for all samples belonging to the same class to fill in the missing value: smarter v Use the most probable value to fill in the missing value: inference-based such as Bayesian formula or decision tree
9
9 Copyright by Jiawei Han, modified by Charles Ling for cs411a/538a Noise and Incorrect (Inconsistent) Data v Noisy data: V random error or variance in a measured variable v Incorrect attribute values may due to V faulty data collection instruments V data entry problems V data transmission problems V technology limitation V inconsistency in naming convention v Other data problems which requires data cleaning V duplicate records V incomplete data V inconsistent data
10
10 Copyright by Jiawei Han, modified by Charles Ling for cs411a/538a How to Handle Noisy Data? v Binning method: V first sort data and partition into (equi-width) bins V then one can smooth by bin means, smooth by bin median, smooth by bin boundaries, etc. v Clustering V detect and remove outliers v Combined computer and human inspection V detect suspicious values and check by human v Regression V smooth by fitting the data into regression functions
11
11 Copyright by Jiawei Han, modified by Charles Ling for cs411a/538a Binning Methods for Data Smoothing * Sorted data for price (in dollars): 4, 8, 9, 15, 21, 21, 24, 26, 25, 28, 29, 34 * Partition into (equi-width) bins: - Bin 1: 4, 8, 9, 15 - Bin 2: 21, 21, 24, 26 - Bin 3: 25, 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, 26, 26 - Bin 3: 25, 25, 25, 29
12
12 Copyright by Jiawei Han, modified by Charles Ling for cs411a/538a Clustering Analysis
13
13 Copyright by Jiawei Han, modified by Charles Ling for cs411a/538a Regression: x y y = x + 1 X1 Y1 Y1’
14
14 Copyright by Jiawei Han, modified by Charles Ling for cs411a/538a Noise and Incorrect Classification v Some database will store class labels determined by experts or data classification/reduction software v Human experts may make incorrect or inconsistent classification v Data mining/classification software may not do good jobs in all the cases -- overfit the data v Data and situations may change over time v Need to account for uncertainty/probabilistic nature of data values and class values
15
15 Copyright by Jiawei Han, modified by Charles Ling for cs411a/538a Session 3: Data Preprocessing v Motivation: Why data preprocessing? v Data cleaning v Data integration and transformation v Data reduction v Discretization and concept hierarchy generation v Conclusions
16
16 Copyright by Jiawei Han, modified by Charles Ling for cs411a/538a Data Integration v Data integration: V combines data from multiple sources into a coherent store v Schema integration V integrate metadata from different sources V Entity identification problem: identify real world entities from multiple data sources, e.g., A.cust-id B.cust-# v Detecting and resolving data value conflicts V for the same real world entity, attribute values from different sources are different V possible reasons: different representations, different scales
17
17 Copyright by Jiawei Han, modified by Charles Ling for cs411a/538a Handling Redundant Data in Integration v Redundant data occur often when integration of multiple databases V The same attribute may have different names in different databases V One attribute may be a “derived” attribute in another table, e.g., annual revenue v Redundant data may be able to be detected by correlation analysis v Careful integration of the data from multiple sources may help reduce/avoid redundancies and inconsistencies and improve mining speed and quality
18
18 Copyright by Jiawei Han, modified by Charles Ling for cs411a/538a Data Transformation v Normalization: scaled to fall within a small, specified range V min-max normalization V z-score normalization V normalization by decimal scaling v Smoothing: remove noise from data v Aggregation: summarization, data cube construction v Generalization: concept hierarchy climbing
19
19 Copyright by Jiawei Han, modified by Charles Ling for cs411a/538a Session 3: Data Preprocessing v Motivation: Why data preprocessing? v Data cleaning v Data integration and transformation v Data reduction v Discretization and concept hierarchy generation v Conclusions
20
20 Copyright by Jiawei Han, modified by Charles Ling for cs411a/538a From Data Reduction to Dimension Reduction v Warehouse may store terabytes of data v Complex data analysis/mining may take a very long time to run on the complete data set v Data reduction is to obtain a reduced representation of the data set that is much smaller in volume but yet produces the same (or almost the same) analytical results v Data reduction includes V Data cube aggregation V Dimension reduction V Numerosity reduction: V Discretization and concept hierarchy generation
21
21 Copyright by Jiawei Han, modified by Charles Ling for cs411a/538a Data Cube Aggregation v The lowest level of a data cube V the aggregated data for an individual entity of interest V e.g., a customer in a phone calling data warehouse. v Multiple levels of aggregation in data cubes V Further reduce the size of data to deal with v Reference appropriate levels V Use the smallest representation which is enough to solve the task v Queries regarding aggregated information should be answered using data cube, when possible
22
22 Copyright by Jiawei Han, modified by Charles Ling for cs411a/538a Dimensionality Reduction v Feature selection (i.e., attribute subset selection): V 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 to the original distribution given the values of all features V reduce # of patterns in the patterns, easier to understand v Heuristic methods (due to exponential # of choices): V step-wise forward selection V step-wise backward elimination V combining forward selection and backward elimination V decision-tree induction
23
23 Copyright by Jiawei Han, modified by Charles Ling for cs411a/538a 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}
24
24 Copyright by Jiawei Han, modified by Charles Ling for cs411a/538a Heuristic Feature Selection Methods v There are 2^d possible sub-features of d features v Several heuristic feature selection methods: V Best single features under the feature independence assumption: choose by significance tests. V Best step-wise feature selection: r The best single-feature is picked first r Then next best feature condition to the first,... V Step-wise feature elimination: r Repeatedly eliminate the worst feature V Best combined feature selection and elimination: V Optimal branch and bound: r Use feature elimination and backtracking
25
25 Copyright by Jiawei Han, modified by Charles Ling for cs411a/538a Data Compression v String compression: V There are extensive theory and well-tuned algorithms V Typically lossless V But only limited manipulation is possible without expansion v Audio/video compression: V Typically lossless compression, with progressive refinement V Sometimes small fragments of signal can be reconstructed without reconstructing the whole v Time sequence is not audio: V Typically short and vary slowly with time
26
26 Copyright by Jiawei Han, modified by Charles Ling for cs411a/538a Wavelet Transforms v Discrete wavelet transform (DWT): linear signal processing v compressed approximation : store only a small fraction of the strongest of the wavelet coefficients v Similar to discrete Fourier transform (DFT), but better lossy compression, localized in space v Method: V Length, L, must be an integer power of 2 (padding with 0s, when necessary) V Each transform has 2 functions: smoothing, difference V applies to pairs of data, resulting in two set of data of length L/2 V apply two functions recursively, until reaches the desired length
27
27 Copyright by Jiawei Han, modified by Charles Ling for cs411a/538a v Given N data vectors from k-dimensions, find c <= k orthogonal vectors that can be best used to represent data V The original data set is reduced to one consisting of N data vectors on c principal components, reduced the dimensions v Used in data compression: V Once c components are found, what one need to do is to transmit c numbers (the reconstruction coefficients) v Each data vector is a linear combination of the c principal component vectors, works for numeric data only v Used when the number of dimensions is large Principal Component Analysis
28
28 Copyright by Jiawei Han, modified by Charles Ling for cs411a/538a X1 X2 Y1 Y2 Principal Component Analysis
29
29 Copyright by Jiawei Han, modified by Charles Ling for cs411a/538a Numerosity Reduction v Parametric methods: * Assume the data fits some model, estimate model parameters, store only the parameters, and discard the data (except possible outliers). V Log-linear models: obtain value at a point in m-D space as the product on appropriate marginal subspaces. v Non-parametric methods: V Not assume models V Three major families: r Clustering r Sampling r Aggregation
30
30 Copyright by Jiawei Han, modified by Charles Ling for cs411a/538a Clustering v Partition data set into clusters v Store cluster representation only v Can be very effective if data is clustered but not if data is “smeared” v Can have hierarchical clustering v There are many choices of clustering definitions and clustering algorithms v Detailed in session 7.
31
31 Copyright by Jiawei Han, modified by Charles Ling for cs411a/538a Sampling v Allow a mining algorithm to run in complexity that is potentially sub-linear to the size of the data v Choose a representative subset of the data V Simple random sampling may have very poor performance in the presence of skew v Develop adaptive sampling methods V Stratified sampling: r Approximate the percentage of each class (or subpopulation of interest) in the overall database r Used in conjunction with skewed data v Sampling may not reduce database I/Os (page at a time).
32
32 Copyright by Jiawei Han, modified by Charles Ling for cs411a/538a Sampling SRSWOR SRSWR Raw Data
33
33 Copyright by Jiawei Han, modified by Charles Ling for cs411a/538a Sampling Raw Data Cluster/Stratified Sample
34
34 Copyright by Jiawei Han, modified by Charles Ling for cs411a/538a Histograms v A popular data reduction technique v Divide data into buckets and store average (sum) for each bucket v Can be constructed optimally in one dimension using dynamic programming v Related to quantization problems.
35
35 Copyright by Jiawei Han, modified by Charles Ling for cs411a/538a Hierarchical Reduction v Use multi-resolution structure with different degrees of reduction v Hierarchical clustering is often performed but tends to define partitions of data sets rather than “clusters” v Parametric methods are usually not amenable to hierarchical representation v Hierarchical aggregation V An index tree hierarchically divides a data set into partitions by value range of some attributes V Each partition can be considered as a bucket V Thus an index tree with aggregates stored at each node is a hierarchical histogram.
36
36 Copyright by Jiawei Han, modified by Charles Ling for cs411a/538a Session 3: Data Preprocessing v Motivation: Why data preprocessing? v Data cleaning v Data integration and transformation v Data reduction v Discretization and concept hierarchy generation v Conclusions
37
37 Copyright by Jiawei Han, modified by Charles Ling for cs411a/538a Discretization and Concept hierachy v Discretization can be used to reduce the number of values for a given continuous attribute, by dividing the range of the attribute into intervals. Interval labels can then be used to replace actual data values. v Concept hierarchies can be used to 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 senior).
38
38 Copyright by Jiawei Han, modified by Charles Ling for cs411a/538a Discretization v Three types of attributes: V nominal -- values from an unordered set V ordinal -- values from an ordered set V continuous -- real numbers v Discretization: * divide the range of a continuous attribute into intervals V Some classification algorithms only accept categorical attributes. V Reduce data size by discretization V Prepare for further analysis
39
39 Copyright by Jiawei Han, modified by Charles Ling for cs411a/538a Discretization and concept hierarchy generation for numeric data v Binning v Histogram analysis v Clustering analysis v Entropy-based discretization v Segmentation by natural partitioning
40
40 Copyright by Jiawei Han, modified by Charles Ling for cs411a/538a Simple Discretization Methods: Binning v Equal-width (distance) partitioning: V It divides the range into N intervals of equal size: uniform grid V if A and B are the lowest and highest values of the attribute, the width of intervals will be: W = (B-A)/N. V The most straightforward V But outliers may dominate presentation V Skewed data is not handled well. v Equal-depth (frequency) partitioning: V It divides the range into N intervals, each containing approximately same number of samples V Good data scaling V Managing categorical attributes can be tricky.
41
41 Copyright by Jiawei Han, modified by Charles Ling for cs411a/538a Entropy-Based Discretization v Given a set of samples S, if S is partitioned into two intervals S1 and S2 using boundary T, the entropy after partitioning is v The boundary that minimizes the entropy function over all possible boundaries is selected as a binary discretization. v The process is recursively applied to partitions obtained until some stopping criterion is met, e.g., v Experiements show that it may reduce data size and improve classification accuracy
42
42 Copyright by Jiawei Han, modified by Charles Ling for cs411a/538a Segmentation by natural partitioning 3-4-5 rule can be used to segment numeric data into relatively uniform, “natural” intervals. * 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 significant digit, partition the range into 5 intervals
43
43 Copyright by Jiawei Han, modified by Charles Ling for cs411a/538a Example of 3-4-5 rule (-$4000 -$5,000) (-$400 - 0) (-$400 - -$300) (-$300 - -$200) (-$200 - -$100) (-$100 - 0) (0 - $1,000) (0 - $200) ($200 - $400) ($400 - $600) ($600 - $800) ($800 - $1,000) ($2,000 - $5, 000) ($2,000 - $3,000) ($3,000 - $4,000) ($4,000 - $5,000) ($1,000 - $2, 000) ($1,000 - $1,200) ($1,200 - $1,400) ($1,400 - $1,600) ($1,600 - $1,800) ($1,800 - $2,000) msd=1,000Low=-$1,000High=$2,000 Step 2: Step 4: Step 1: -$351-$159profit $1,838 $4,700 Min Low (i.e, 5%-tile) High(i.e, 95%-0 tile) Max count (-$1,000 - $2,000) (-$1,000 - 0) (0 -$ 1,000) Step 3: ($1,000 - $2,000)
44
44 Copyright by Jiawei Han, modified by Charles Ling for cs411a/538a Concept hierarchy generation for categorical data v Specification of a partial ordering of attributes explicitly at the schema level by users or experts v Specification of a portion of a hierarchy by explicit data grouping v Specification of a set of attributes, but not of their partial ordering v Specification of only a partial set of attributes
45
45 Copyright by Jiawei Han, modified by Charles Ling for cs411a/538a 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 set. The attribute 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
46
46 Copyright by Jiawei Han, modified by Charles Ling for cs411a/538a Session 3: Data Preprocessing v Motivation: Why data preprocessing? v Data cleaning v Data integration and transformation v Data reduction v Discretization and concept hierarchy generation v Conclusions
47
47 Copyright by Jiawei Han, modified by Charles Ling for cs411a/538a Conclusions v Data preparation is a big issue for both warehousing and mining v Data preparation includes V Data cleaning and data integration V Data reduction and feature selection V Discretization v A lot a methods have been developed but still an active area of research
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.