🎧 New: AI-Generated Podcasts Turn your study notes into engaging audio conversations. Learn more

Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...

Full Transcript

Data Mining and Machine Learning Bioinspired computational methods Biological data mining Data Prepocessing Francesco Marcelloni Department of Information...

Data Mining and Machine Learning Bioinspired computational methods Biological data mining Data Prepocessing Francesco Marcelloni Department of Information Engineering University of Pisa ITALY Some slides belong to the collection Jiawei Han, Micheline Kamber, and Jian Pei University of Illinois at Urbana-Champaign Simon Fraser University ©2011 Han, Kamber, and Pei. All rights reserved. 1 Chapter 3: Data Preprocessing ◼ Data Preprocessing: An Overview ◼ Data Quality ◼ Major Tasks in Data Preprocessing ◼ Data Cleaning ◼ Data Integration ◼ Data Reduction ◼ Data Transformation and Data Discretization ◼ Summary 2 2 1 Data Quality: Why Preprocess the Data? ◼ Measures for data quality: A multidimensional view ◼ Accuracy: correct or wrong, accurate or not ◼ Completeness: not recorded, unavailable, … ◼ Consistency: some modified but some not, dangling, … ◼ Timeliness: timely update? ◼ Believability: how trustable the data are correct? ◼ Interpretability: how easily the data can be understood? 3 3 Major Tasks in Data Preprocessing ◼ Data cleaning ◼ Fill in missing values, smooth noisy data, identify or remove outliers, and resolve inconsistencies ◼ Data integration ◼ Integration of multiple databases, data cubes, or files ◼ Problems ◼ for instance, the attribute for customer identification could be identified as cust_id in one data base and customer_id in another; ◼ the same name could be registered as Bill in one database and William in another. ◼ At the end of data integration, a new data cleaning pre-process can be needed for removing redundancies. 4 4 2 Major Tasks in Data Preprocessing ◼ Data reduction ◼ Is there any way to reduce the size of data set without jeopardizing the data mining results? ◼ Dimensionality reduction: data encoding schemes are applied to obtain a compressed representation of the original data ◼ Compression techniques ◼ Attribute subset selection ◼ Attribute construction ◼ Numerosity reduction: smaller representations using parametric models (regression models) or nonparametric models (cluster, sampling, ecc.) ◼ Data transformation and data discretization ◼ Normalization ◼ Concept hierarchy generation 5 5 Major Tasks in Data Preprocessing ◼ Data transformation and data discretization ◼ Normalization: scaled to a smaller range such as [0.0, 1.0] ◼ Let us consider age and annual salary: in the computation of the distance the distance measurements taken on annual salary will outweigh distance measurements taken on age. ◼ Concept hierarchy generation ◼ Raw values are replaced by higher-level concepts (youth, adult or senior) ◼ Data mining at different levels of abstraction 6 6 3 Major Tasks in Data Preprocessing 7 7 Chapter 3: Data Preprocessing ◼ Data Preprocessing: An Overview ◼ Data Quality ◼ Major Tasks in Data Preprocessing ◼ Data Cleaning ◼ Data Integration ◼ Data Reduction ◼ Data Transformation and Data Discretization ◼ Summary 8 8 4 Data Cleaning ◼ Data in the Real World is Dirty: Lots of potentially incorrect data, e.g., instrument faulty, human or computer error, transmission error ◼ incomplete: lacking attribute values, lacking certain attributes of interest, or containing only aggregate data ◼ e.g., Occupation=“ ” (missing data) ◼ noisy: containing noise, errors, or outliers ◼ e.g., Salary=“−10” (an error) ◼ inconsistent: containing discrepancies in codes or names, e.g., ◼ Age=“42”, Birthday=“03/07/2010” ◼ Was rating “1, 2, 3”, now rating “A, B, C” ◼ discrepancy between duplicate records ◼ Intentional (e.g., disguised missing data) ◼ Jan. 1 as everyone’s birthday? 9 9 Incomplete (Missing) Data ◼ Data is not always available ◼ E.g., many tuples have no recorded value for several attributes, such as customer income in sales data ◼ Missing data may be due to ◼ equipment malfunction ◼ inconsistent with other recorded data and thus deleted ◼ data not entered due to misunderstanding ◼ certain data may not be considered important at the time of entry ◼ not register history or changes of the data ◼ Missing data may need to be inferred 10 10 5 How to Handle Missing Data? ◼ Ignore the tuple: usually done when class label is missing (when doing classification)—not effective when the % of missing values per attribute varies considerably ◼ Fill in the missing value manually: tedious + infeasible? ◼ Fill in it automatically with ◼ a global constant: e.g., “unknown”, a new class?! ◼ the attribute mean ◼ the attribute mean for all samples belonging to the same class: smarter ◼ the most probable value: inference-based such as Bayesian formula or decision tree 11 11 Noisy Data ◼ Noise: random error or variance in a measured variable ◼ Incorrect attribute values may be due to ◼ faulty data collection instruments ◼ data entry problems ◼ data transmission problems ◼ technology limitation ◼ inconsistency in naming convention ◼ Other data problems which require data cleaning ◼ duplicate records ◼ incomplete data ◼ inconsistent data 12 12 6 How to Handle Noisy Data? ◼ In many applications of ambient intelligence, the true signal amplitudes (y-axis values) change rather smoothly as a function of the x-axis values, whereas many kinds of noise are seen as rapid, random changes in amplitude from point to point within the signal. ◼ The noise can be reduced by a process called smoothing. ◼ Smoothing: the data points of a signal are modified so that individual points that are higher than the immediately adjacent points (presumably because of noise) are reduced, and points that are lower than the adjacent points are increased. ◼ This naturally leads to a smoother signal. 13 13 Smoothing Algorithms Rectangular or unweighted sliding-average smooth ▪ The simplest smoothing algorithm ▪ It simply replaces each point in the signal with the average of m adjacent points, where m is a positive integer called the smooth width. For example, for a 3- point smooth (m = 3): for j = 2 to n-1, where Sj the jth point in the smoothed signal, Yj the jth point in the original signal, and n is the total number of points in the signal. 14 7 Smoothing Algorithms Rectangular or unweighted sliding-average smooth Filtered with 11 and 51 point moving average filters 15 Smoothing Algorithms Rectangular or unweighted sliding-average smooth ▪ If the underlying function is constant, or is changing linearly with time (increasing or decreasing), then no bias is introduced into the result. ▪ A bias is introduced, however, if the underlying function has a nonzero second derivative. At a local maximum, for example, moving window averaging always reduces the function value. 16 8 Smoothing Algorithms Triangular smooth ▪ Implements a weighted smoothing function. For example, for a 5-point smooth (m = 5): for j = 3 to n-2. This smooth is more effective at reducing high-frequency noise in the signal than the simpler rectangular smooth. ▪ The 5-point triangular smooth above is equivalent to two passes of a 3-point rectangular smooth ▪ The width of the smooth m is an odd integer and the smooth coefficients are symmetrically balanced around the central point, which is important point because it preserves the x- axis position of peaks and other features in the signal. 17 Smoothing Algorithms The Savitzky-Golay Smoothing Filters ▪ In general, the simplest type of digital filter (the nonrecursive or finite impulse response filter) replaces each data value Yj by a linear combination Si of itself and some number of nearby neighbors where nL is the number of points used “to the left” of a data point i, i.e., earlier than it, while nR is the number used to the right, i.e., later. 18 9 Smoothing Algorithms The Savitzky-Golay Smoothing Filters ▪ In the unweighted sliding-average smooth where nL is the number of points used “to the left” of a data point i, i.e., earlier than it, while nR is the number used to the right, i.e., later. 19 Smoothing Algorithms The Savitzky-Golay Smoothing Filters ▪ The idea of Savitzky-Golay filtering is to find filter coefficients cn that preserve higher moments. Equivalently, the idea is to approximate the underlying function within the moving window not by a constant (whose estimate is the average), but by a polynomial of higher order, typically quadratic or quartic. ▪ For each point Yi, we least-squares fit a polynomial to all nL +nR + 1 points in the moving window, and then set Si to be the value of that polynomial at position i. 20 10 Smoothing Algorithms The Savitzky-Golay Smoothing Filters ▪ All these least-squares fits would be laborious if done as described. ▪ Luckily, since the process of least-squares fitting involves only a linear matrix inversion, the coefficients of a fitted polynomial are themselves linear in the values of the data. ▪ Thus, we can do all the fitting in advance, for fictitious data consisting of all zeros except for a single 1, and then do the fits on the real data just by taking linear combinations. 21 Smoothing Algorithms The Savitzky-Golay Smoothing Filters Some example 22 11 Smoothing Algorithms The Savitzky-Golay Smoothing Filters Some example Sliding-average smooth with window of 33 points Savitzky-Golay of degree 4 with window of 33 points 23 Smoothing Algorithms ▪ The larger the smooth width, the greater the noise reduction, but also the greater the possibility that the signal will be distorted by the smoothing operation. ▪ The optimum choice of smooth width depends upon the width and shape of the signal and the digitization interval. ▪ For peak-type signals, the critical factor is the smoothing ratio, the ratio between the smooth width and the number of points in the half-width of the peak. In general, increasing the smoothing ratio improves the signal-to-noise ratio but causes a reduction in amplitude and an increase in the bandwidth of the peak. 24 12 Smoothing Algorithms 7/80 = 0.09 7/33 = 0.21 25/80 = 0.31 25/33 = 0.76 51/80 = 0.64 51/33 = 1.55 half-width of half-width of the peak 80 pts the peak 33 pts 25 Smoothing Algorithms Optimization of smoothing ▪ If the objective of the measurement is to measure the true peak height and width, then smooth ratios below 0.2 should be used. ▪ If the objective of the measurement is to measure the peak position (x-axis value of the peak), much larger smoothing ratios can be employed if desired, because smoothing has no effect at all on the peak position (unless the increase in peak width is so much that it causes adjacent peaks to overlap). 26 13 Smoothing Algorithms When should you smooth a signal? 1. for cosmetic reasons, to prepare a nicer-looking graphic of a signal for visual inspection or publication; 2. if the signal will be subsequently processed by an algorithm that would be adversely affected by the presence of too much high-frequency noise in the signal, for example if the location of maxima, minima, or inflection points in the signal is to be automatically determined by detecting zero- crossings in derivatives of the signal. 27 Smoothing Algorithms When should NOT you smooth a signal? 1. Prior to statistical procedures such as least-squares curve fitting, because: (a) smoothing will not significantly improve the accuracy of parameter measurement by least-squares measurements between separate independent signal samples; (b) all smoothing algorithms are at least slightly "lossy", entailing some change in signal shape and amplitude, (c) it is harder to evaluate the fit by inspecting the residuals if the data are smoothed, because smoothed noise may be mistaken for an actual signal, and (d) smoothing the signal will seriously underestimate the parameters errors predicted by propagation-of-error calculations and the bootstrap method. 28 14 How to Handle Noisy Data? ◼ Binning: smooth a sorted data value by consulting its neighborhood ◼ first sort data and partition into (equal-frequency) bins ◼ then one can smooth by bin means, smooth by bin median, smooth by bin boundaries, etc. 29 29 How to Handle Noisy Data? ◼ Regression ◼ smooth by fitting the data into regression functions ◼ Linear regression (two attributes) ◼ Multiple linear regression (multiple attributes) ◼ Clustering ◼ detect and remove outliers ◼ Combined computer and human inspection ◼ detect suspicious values and check by human (e.g., deal with possible outliers) 30 30 15 How to Handle Noisy Data? 31 31 Data Cleaning as a Process ◼ Data discrepancy detection ◼ Use metadata (e.g., domain, range, dependency, distribution) ◼ Check field overloading (typically results when developers squeeze new attribute definitions into unused portions of already defined attributes (an unused bit of an attribute that has a value range that uses only, say, 31 out of 32 bits). ◼ Check ◼ uniqueness rule: each value of a given attribute must be different from all other values for that attribute ◼ consecutive rule: there can be no missing values between the lowest and the highest values ◼ null rule: specifies the use of blanks, question mark, and so on ◼ Use commercial tools ◼ Data scrubbing: use simple domain knowledge (e.g., postal code, spell-check) to detect errors and make corrections ◼ Data auditing: by analyzing data to discover rules and relationship to detect violators (e.g., correlation and clustering to find outliers) 32 32 16 Data Cleaning as a Process ◼ Data migration and integration ◼ Data migration tools: allow transformations to be specified, such as to replace the string “gender” by “sex”. ◼ ETL (Extraction/Transformation/Loading) tools: allow users to specify transformations through a graphical user interface 33 33 Data Cleaning as a Process ◼ ETL (Extraction/Transformation/Loading) tools: 1. Extraction: data is extracted from the source system into the staging area. Transformations if any are done in staging area so that performance of source system in not degraded. 2. Transformation: Data extracted from source server is raw and not usable in its original form. Therefore it needs to be cleansed, mapped and transformed. 34 34 17 Data Cleaning as a Process ◼ ETL (Extraction/Transformation/Loading) tools: 2. Transformation (continued): Some possible data integrity problems a) Different spelling of the same person like Jon, John, etc. b) There are multiple ways to denote company name like Google, Google Inc. c) Use of different names like Cleaveland, Cleveland. d) There may be a case that different account numbers are generated by various applications for the same customer. e) In some data required files remains blank f) Invalid product collected at POS as manual entry can lead to mistakes. Validation are performed during this stage: filtering (select only certain columns to load), character set conversion, conversion of units of measurements, data threshold validation check, required fields not blank, and so on 35 35 Data Cleaning as a Process ◼ ETL (Extraction/Transformation/Loading) tools: 3. Loading: Huge volume of data needs to be loaded in a relatively short period: load process has to be optimized Types of loading: a)Initial load - populating all the Data Warehouse tables b)Incremental load - applying ongoing changes as when needed periodically c)Full refresh - Erasing the contents of one or more tables and reloading with fresh data Load verification: key field data is neither missing nor null, data checks in dimension table as well as history table, and so on Several commercial softwares 36 36 18 Chapter 3: Data Preprocessing ◼ Data Preprocessing: An Overview ◼ Data Quality ◼ Major Tasks in Data Preprocessing ◼ Data Cleaning ◼ Data Integration ◼ Data Reduction ◼ Data Transformation and Data Discretization ◼ Summary 37 37 Data Integration ◼ Data integration: ◼ Combines data from multiple sources into a coherent store ◼ Schema integration: e.g., A.cust-id  B.cust-# ◼ Integrate metadata from different sources ◼ Entity identification problem: ◼ Identify real world entities from multiple data sources, e.g., Bill Clinton = William Clinton ◼ Detecting and resolving data value conflicts ◼ For the same real world entity, attribute values from different sources are different ◼ Possible reasons: different representations, different scales, e.g., metric vs. British units 38 38 19 Handling Redundancy in Data Integration ◼ Redundant data occur often when integration of multiple databases ◼ Object identification: The same attribute or object may have different names in different databases ◼ Derivable data: One attribute may be a “derived” attribute in another table, e.g., annual revenue ◼ Redundant attributes may be able to be detected by correlation analysis and covariance analysis ◼ Careful integration of the data from multiple sources may help reduce/avoid redundancies and inconsistencies and improve mining speed and quality 39 39 Correlation Analysis (Nominal Data) ◼ Χ2 (chi-square) test: The chi-square independence test is a procedure for testing if two categorical variables A and B are related in some population. ◼ Suppose: ◼ A= {a1,…, ac} ◼ B= {b1,…, br} ◼ The data tuples can be represented by a contingency table b1 b2 … br a1 o1,1 o1,2 o1,c o1,. a2 o2,1 o2,2 o2,c o2,. … ac or,1 or,2 or,c or,. o.,1 o.,2 o.,r Tot 40 40 20 Correlation Analysis (Nominal Data) ◼ Χ2 (chi-square) test: (Observed − Expected) 2 2 =  Expected ◼ The larger the Χ2 value, the more likely the variables are related ◼ The cells that contribute the most to the Χ2 value are those whose actual count is very different from the expected count 41 41 Chi-Square Calculation: An Example Preferred reading Play chess Not play chess Sum (row) Like science fiction 250(90) 200(360) 450 Not like science fiction 50(210) 1000(840) 1050 Sum(col.) 300 1200 1500 ◼ Χ2 (chi-square) calculation ◼ numbers in parenthesis are expected counts calculated based on the data distribution in the two categories count( A = a )  count( B = b ) e = ij i j N (250 − 90) (50 − 210) (200 − 360) (1000 − 840) 2 2 2 2  = 2 + + + = 507.93 90 210 360 840 ◼ It shows that like_science_fiction and play_chess are correlated in the group 42 42 21 How can we determine independence? ◼ Parametric test: hypothesis test based on the assumption that observed data are distributed according to some distributions of well- known form (normal, Bernoulli, and so on) up to some unknown parameter on which we want to make inference (say the mean, or the success probability) ◼ Nonparametric test: hypothesis test where it is not necessary (or not possible) to specify the parametric form of the distribution(s) of the underlying population(s). 43 43 How can we determine independence? 44 44 22 How can we determine independence? ◼ Null Hypothesis (H0): states that no association exists between the two cross-tabulated variables in the population and therefore the variables are statistically independent. ◼ Alternative Hypothesis (H1): proposes that the two variables are related in the population. ◼ Be Careful: Correlation does not imply causality ◼ # of hospitals and # of car-theft in a city are correlated ◼ Both are causally linked to the third variable: population 45 45 How can we determine independence? ◼ Degrees of Freedom: are the number of cells in the two-way table of the categorical variables that can vary, given the constraints of the row and column marginal totals. So each "observation" in this case is a frequency in a cell. ◼ The number of degrees of freedom df is equal to df= (r-1) (c-1), where r is the number of rows and c is the number of columns. 46 46 23 How can we determine independence? ◼ Examples: df=1 df=2 47 47 How can we determine independence? ◼ The Χ2 distribution is a type of probability distribution. ◼ Probability distributions provide the probability of every possible value that may occur. ◼ Distributions that are cumulative give the probability of a random variable being less than or equal to a particular value. ◼ To find the probability of a particular value, we find the area under the curve before the value. The area that's after the value is called the p- value 48 48 24 How can we determine independence? ◼ The Χ2 distribution vary depending on the degrees of freedom and are asymmetric. ◼ The shape is always skewed right 49 49 How can we determine independence? ◼ Many statistical analyses involve using the p-value. However, calculating a portion of the area under the curve can be difficult. Alternatively When Χ2 = 5 and K=4, the p-value is app. 0.3 50 50 25 How can we determine independence? ◼ It's often more efficient to use a Χ2 table. In this table, each row represents a different degree of freedom along with several Χ2 values. The corresponding p-values are listed at the top of each column ◼ The null hypothesis is rejected when the probability of a larger value of Χ2 is lower than the significance level 𝛼. 51 51 Chi-Square Calculation: Another Example ◼ A scientist wants to know if education level and marital status are related for all people in some country. He collects data on a simple random sample of n = 300 people 52 52 26 Chi-Square Calculation: Another Example ◼ Expected frequencies 53 53 Chi-Square Calculation: Another Example ◼ DF = 12 ◼ Conclusion: marital status and education are related in our population 54 54 27 Correlation Analysis (Numeric Data) ◼ Correlation coefficient (also called Pearson’s product moment coefficient) where n is the number of tuples, 𝐴ҧ and 𝐵ത are the respective means of A and B, σA and σB are the respective standard deviations of A and B, and Σ(aibi) is the sum of the AB cross- product. ◼ If rA,B > 0, A and B are positively correlated (A’s values increase as B’s). The higher, the stronger correlation. ◼ rA,B = 0: independent; rAB < 0: negatively correlated 55 55 Correlation Analysis (Numeric Data) ◼ Be careful: The Pearson’s product moment coefficient only detects linear relationships Correlation 0 Correlation 0.8 56 56 28 Visually Evaluating Correlation Scatter plots showing the similarity from –1 to 1. 57 57 Correlation (viewed as linear relationship) ◼ Correlation measures the linear relationship between objects ◼ To compute correlation, we standardize data objects, A and B, and then take their dot product a'k = (ak − mean( A)) / std ( A) b'k = (bk − mean( B)) / std ( B) correlation( A, B) = A' B' 58 58 29 Covariance (Numeric Data) ◼ Covariance is similar to correlation Correlation coefficient: where n is the number of tuples, 𝐴ҧ and 𝐵ത are the respective mean or expected values of A and B, σA and σB are the respective standard deviation of A and B. 59 59 Covariance (Numeric Data) ◼ Positive covariance: If CovA,B > 0, then A and B both tend to be larger than their expected values. ◼ Negative covariance: If CovA,B < 0 then if A is larger than its expected value, B is likely to be smaller than its expected value. ◼ Independence: CovA,B = 0 but the converse is not true: ◼ Some pairs of random variables may have a covariance of 0 but are not independent. Only under some additional assumptions (e.g., the data follow multivariate normal distributions) does a covariance of 0 imply independence 60 60 30 Co-Variance: An Example ◼ It can be simplified in computation as ◼ Suppose two stocks A and B have the following values in one week: (2, 5), (3, 8), (5, 10), (4, 11), (6, 14). ◼ Question: If the stocks are affected by the same industry trends, will their prices rise or fall together? ◼ E(A) = (2 + 3 + 5 + 4 + 6)/ 5 = 20/5 = 4 ◼ E(B) = (5 + 8 + 10 + 11 + 14) /5 = 48/5 = 9.6 ◼ Cov(A,B) = (2×5+3×8+5×10+4×11+6×14)/5 − 4 × 9.6 = 4 ◼ Thus, A and B rise together since Cov(A, B) > 0. 61 Chapter 3: Data Preprocessing ◼ Data Preprocessing: An Overview ◼ Data Quality ◼ Major Tasks in Data Preprocessing ◼ Data Cleaning ◼ Data Integration ◼ Data Reduction ◼ Data Transformation and Data Discretization ◼ Summary 62 62 31 Data Reduction Strategies ◼ Data reduction: 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 ◼ Why data reduction? — A database/data warehouse may store terabytes of data. Complex data analysis may take a very long time to run on the complete data set. ◼ Data reduction strategies ◼ Dimensionality reduction, e.g., remove unimportant attributes ◼ Wavelet transforms ◼ Principal Components Analysis (PCA) ◼ Feature subset selection, feature creation ◼ Numerosity reduction (some simply call it: Data Reduction) ◼ Regression and Log-Linear Models ◼ Histograms, clustering, sampling ◼ Data cube aggregation ◼ Data compression 63 63 Data Reduction 1: Dimensionality Reduction ◼ Curse of dimensionality ◼ When dimensionality increases, data becomes increasingly sparse ◼ Density and distance between points, which is critical to clustering, outlier analysis, becomes less meaningful ◼ The possible combinations of subspaces will grow exponentially ◼ Dimensionality reduction ◼ Avoid the curse of dimensionality ◼ Help eliminate irrelevant features and reduce noise ◼ Reduce time and space required in data mining ◼ Allow easier visualization ◼ Dimensionality reduction techniques ◼ Wavelet transforms ◼ Principal Component Analysis ◼ Supervised and nonlinear techniques (e.g., feature selection) 64 64 32 Principal Component Analysis (PCA) ◼ Find a projection that captures the largest amount of variation in data ◼ The original data are projected onto a much smaller space, resulting in dimensionality reduction. We find the eigenvectors of the covariance matrix, and these eigenvectors define the new space x2 e x1 95 95 Principal Component Analysis (PCA) ◼ The projection error is less than in the original dataset ◼ Newly projected red points are more widely spread out than in the original dataset, i.e. more variance. 96 96 33 Principal Component Analysis (Steps) ◼ Given N data vectors from f dimensions, find k ≤ f orthogonal vectors (principal components) that can be best used to represent data ◼ Normalize input data: Each attribute falls within the same range ◼ Compute k orthonormal (unit) vectors, i.e., principal components ◼ Each input data (vector) is a linear combination of the k principal component vectors ◼ The principal components are sorted in order of decreasing “significance” or strength ◼ Since the components are sorted, the size of the data can be reduced by eliminating the weak components, i.e., those with low variance (i.e., using the strongest principal components, it is possible to reconstruct a good approximation of the original data) ◼ Works for numeric data only 97 97 Principal Component Analysis (Steps) ◼ Given N data vectors from f-dimensions, find k ≤ f orthogonal vectors (principal components) that can be best used to represent data Step #1: Calculate Adjusted Data Set Adjusted Data Set: A Data Set: D Mean values: M Mi is calculated by … f … - taking the mean = dims of the values in dimension i N data samples 98 98 34 Principal Component Analysis (Steps) Step #2: Calculate Co-variance matrix, C, from adjusted data set, A Remember: It is a measure of the extent to which corresponding elements from two sets of ordered data move in the same direction. Co-variance Matrix: C σ𝑁 ത ത 𝑖=1 𝑋𝑖 − 𝑋 𝑌𝑖 − 𝑌 COV X, Y = 𝑁−1 f Note: Since the means of the dimensions in the adjusted data set, A, are 0, the covariance f matrix can simply be written as: Cij = cov(i,j) C = (A AT) / (n-1) 99 99 Principal Component Analysis (Steps) Example computation Covariance matrix Suppose that you have a set of N=5 data items, representing 5 people, where each data item has a Height, test Score, and Age (therefore f = 3) S1 S2 S3 S4 S5 Mean Height 64 66 68 69 73 68 Score 580 570 590 660 600 600 Age 29 33 37 46 55 40 Var(Height) = [ (64–68.0)^2 + (66–68.0^2 + (68-68.0)^2 + (69-68.0)^2 +(73-68.0)^2 ] / (5-1) = (16.0 + 4.0 + 0.0 + 1.0 + 25.0) / 4 = 46.0 / 4 = 11.50. 100 100 35 Principal Component Analysis (Steps) Example computation Covariance matrix Covar(Height-Score) = [ (64-68.0)*(580-600.0) + (66-68.0)*(570-600.0) + (68-68.0)*(590-600.0) + (69-68.0)*(660-600.0) + (73-68.0)*(600-600.0) ] / (5-1) = [80.0 + 60.0 + 0 + 60.0 + 0] / 4 = 200 / 4 = 50.0 Height Score Age Height 11.5 50 34.75 Score 50 1250 205 Age 34.75 205 110 101 101 Principal Component Analysis (Steps) Step #3: Calculate eigenvectors and eigenvalues of C Matrix E Matrix E Eigenvalues Eigenvalues x x Eigenvectors Eigenvectors If some eigenvalues are 0 or very small, we can essentially discard those eigenvalues and the corresponding eigenvectors, hence reducing the dimensionality of the new basis. 102 102 36 Principal Component Analysis (Steps) Step #4: Transforming data set to the new basis F = ETA Note that the dimensions of the new dataset, F, are less than the where: data set A F is the transformed data set ET is the transpose of the E matrix To recover A from F: containing the eigenvectors A is the adjusted data set (ET)-1F = (ET)-1ETA (ET)TF = A EF = A * E is orthogonal, therefore E-1 = ET 103 103 Attribute Subset Selection ◼ Attribute subset selection: Another way to reduce dimensionality of data ◼ Redundant attributes ◼ Duplicate much or all of the information contained in one or more other attributes ◼ E.g., purchase price of a product and the amount of sales tax paid ◼ Irrelevant attributes ◼ Contain no information that is useful for the data mining task at hand ◼ E.g., students' ID is often irrelevant to the task of predicting students' GPA (Grade-Point Average) 104 104 37 Heuristic Search in Attribute Selection ◼ There are 2d possible attribute combinations of d attributes ◼ Greedy approaches: make what looks to be the best choice at the time ◼ Typical heuristic attribute selection methods: ◼ Best single attribute under the attribute independence assumption: choose by significance tests ◼ Best step-wise feature selection: ◼ The best single-attribute is picked first ◼ Then next best attribute condition to the first,... ◼ Step-wise attribute elimination: ◼ Repeatedly eliminate the worst attribute ◼ Best combined attribute selection and elimination ◼ Optimal branch and bound: ◼ Use attribute elimination and backtracking 105 105 Heuristic Search in Attribute Selection 106 106 38 Example of Heuristic Approach Example of heuristic approaches Pablo A. Estévez, Michel Tesmer, Claudio A. Perez, and Jacek M. Zurada, “Normalized Mutual Information Feature Selection”, IEEE Transactions on neural networks, Vol. 20, N. 2, February 2009. Consider two discrete variables X and Y, with alphabets XX and YY, respectively. The mutual information (I) between X and Y with a joint probability mass function p(x,y) and marginal probabilities p(x) and p(y) is defined as follows: 𝑝 𝑥, 𝑦 𝐼 𝑋, 𝑌 = ෍ ෍ 𝑝 𝑥, 𝑦 ∙ log 𝑝 𝑥 𝑝 𝑦 𝑥∈𝑋𝑋 𝑦∈𝑌𝑌 Alphabets XX and YY contain the possible values for X and Y, respectively. 107 107 Example of heuristic approach Digression: Information and Entropy Suppose we want to encode and transmit a long sequence of symbols from the set {a, c, e, g} drawn randomly according to the following probability distribution D: Since there are 4 symbols, one possibility is to use 2 bits per symbol In fact, it’s possible to use 1.75 bits per symbol, on average Can you see how? 108 108 39 Example of heuristic approach Digression: Information and Entropy Here’s one way: Average number of bits per symbol = 1/8 *3 + 1/8 * 3 +1/4 *2 + ½ *1 = 1.75 Information theory: Optimal length code assigns log2 1/p = - log2 p bits to a message having probability p 109 109 Example of heuristic approach Digression: Information and Entropy Given a distribution D over a finite set, where are the corresponding probabilities, define the entropy of D by 𝐻 𝐷 = − ෍ 𝑝𝑖 𝑙𝑜𝑔2 𝑝𝑖 𝑖 For example, the entropy of the distribution we just examined, , is 1.75 (bits) Also called information In general, entropy is higher the closer the distribution is to being uniform 110 110 40 Example of Heuristic Approach MI has two main properties: The capacity of measuring any kind of relationship between variables Its invariance under space transformations (translations, rotations and any transformation that preserve the order of the original elements of the variables) Feature selection based on MI: Extremely sensitive to the estimation of the pdfs 111 111 Example of Heuristic Approach Problem statement ▪ Given an initial set F with n features, find subset S ⊂ F with k features that maximizes the MI I(C;S) between the class variable C, and the subset of selected features S. ▪ Normalized MI between fi and fs 𝐼(𝑓𝑖; 𝑓𝑠) 𝑁𝐼(𝑓𝑖, 𝑓𝑠) = 𝑚𝑖𝑛 𝐻 𝑓𝑖 , 𝐻(𝑓𝑠) ▪ The selection criterion used in NMIFS consists in selecting the feature that maximizes the measure G 1 𝐺 = 𝐼 𝐶, 𝑓𝑖 − ෍ 𝑁𝐼(𝑓𝑖; 𝑓𝑠) 𝑆 𝑓𝑠∈𝑆 𝑝 𝑐,𝑓𝑖 where 𝐼(𝐶, 𝑓𝑖) = σ𝑐∈𝐶𝐶 σ𝑓𝑖∈𝐹𝐹 𝑝 𝑐, 𝑓𝑖 ∙ log 𝑝 𝑐 𝑝(𝑓𝑖) 112 112 41 Example of Heuristic Approach Problem statement The ▪ Given an initial set Fnormalization compensates with n features, find subset S ⊂ F for with the k MI bias toward multivalued features, and C, features that maximizes the MI I(C;S) between the class variable and the subsetrestricts its features of selected values to S. the range ▪ Normalized MI between fi and fs 𝐼(𝑓𝑖; 𝑓𝑠) 𝑁𝐼(𝑓𝑖, 𝑓𝑠) = 𝑚𝑖𝑛 𝐻 𝑓𝑖 , 𝐻(𝑓𝑠) ▪ The selection criterion used in NMIFS consists in selecting the feature that maximizes the measure G 1 𝐺 = 𝐼 𝐶, 𝑓𝑖 − ෍ 𝑁𝐼(𝑓𝑖; 𝑓𝑠) 𝑆 𝑓𝑠∈𝑆 𝑝 𝑐,𝑓𝑖 where 𝐼(𝐶, 𝑓𝑖) = σ𝑐∈𝐶𝐶 σ𝑓𝑖∈𝐹𝐹 𝑝 𝑐, 𝑓𝑖 ∙ log 𝑝 𝑐 𝑝(𝑓𝑖) 113 113 Example of Heuristic Approach Problem statementAdaptive redundancy penalization Given an initial set F with n features, find subset S ⊂ F with k features term, which corresponds to the average that maximizes the MI I(C;S) between the class variable C, and the normalized subset of selected features S. MI between Normalized the candidate MI between fi and fs feature and the set of selected 𝑁𝐼(𝑓𝑖, 𝑓𝑠) = features. 𝐼(𝑓𝑖; 𝑓𝑠) 𝑚𝑖𝑛 𝐻 𝑓𝑖 , 𝐻(𝑓𝑠) The selection criterion used in NMIFS consists in selecting the feature that maximizes the measure G 1 𝐺 = 𝐼 𝐶, 𝑓𝑖 − ෍ 𝑁𝐼(𝑓𝑖; 𝑓𝑠) 𝑆 𝑓𝑠∈𝑆 𝑝 𝑐,𝑓𝑖 where 𝐼(𝐶, 𝑓𝑖) = σ𝑐∈𝐶𝐶 σ𝑓𝑖∈𝐹𝐹 𝑝 𝑐, 𝑓𝑖 ∙ log 𝑝 𝑐 𝑝(𝑓𝑖) 114 114 42 Example of Heuristic Approach The algorithm 1. Initialization: Set F = {𝑓𝑖 /i = 1,…,N}, initial set of N features, and S = {∅}, empty set. 2. Calculate the MI with respect to the classes: calculate I(𝑓𝑖 ;C), for each 𝑓𝑖 ∈ F. 3. Select the first feature: Find 𝑓෡𝑖 = maxi=1,…,N{I(𝑓𝑖 ;C)}. Set F ← F \ {𝑓෡𝑖}; set S ← {𝑓෡𝑖} 4. Greedy Selection: Repeat until 𝑆 = k. a. Calculate the MI between features: Calculate I(𝑓𝑖 ; 𝑓𝑠 ) for all pairs (𝑓𝑖 ; 𝑓𝑠 ), with 𝑓𝑖 ∈ F and 𝑓𝑠 ∈ S b. Select next feature: Select feature 𝑓𝑖 ∈ F that maximizes G. Set F ← F \ {𝑓෡𝑖}; set S ← {𝑓෡𝑖}. 5. Output the set S containing the selected features. 115 115 Attribute Creation (Feature Generation) ◼ Create new attributes (features) that can capture the important information in a data set more effectively than the original ones ◼ Three general methodologies ◼ Attribute extraction ◼ Domain-specific ◼ Mapping data to new space (see: data reduction) ◼ E.g., Fourier transformation, wavelet transformation, manifold approaches (not covered) ◼ Attribute construction ◼ Combining features ◼ Data discretization 116 116 43 Data Reduction 2: Numerosity Reduction ◼ Reduce data volume by choosing alternative, smaller forms of data representation ◼ Parametric methods (e.g., regression) ◼ Assume the data fits some model, estimate model parameters, store only the parameters, and discard the data (except possible outliers) ◼ Ex.: linear regression — obtain value at a point in m- D space as the product on appropriate marginal subspaces ◼ Non-parametric methods ◼ Do not assume models ◼ Major families: histograms, clustering, sampling, … 117 117 Parametric Data Reduction: Regression Models ◼ Linear regression ◼ Data modeled to fit a straight line ◼ Often uses the least-square method to fit the line ◼ Multiple regression ◼ Allows a response variable Y to be modeled as a linear function of multidimensional feature vector 118 118 44 y Regression Analysis y1 ◼ Regression analysis: A collective name for techniques for the modeling and analysis y1’ y=x+1 of numerical data consisting of values of a dependent variable (also called response variable or measurement) and x1 x of one or more independent variables (aka. explanatory variables or predictors) ◼ Used for prediction ◼ The parameters are estimated so as to give (including forecasting of a "best fit" of the data time-series data), inference, hypothesis testing, and ◼ Most commonly the best fit is evaluated by modeling of causal using the least squares method, but relationships other criteria have also been used 120 120 Regression Analysis ◼ Linear regression: y = w1 x + w0 ◼ Two regression coefficients, w1 and w0, specify the line and are to be estimated by using the data at hand ◼ Using the least squares criterion to the known values of y1, y2, …, x1, x2, …. Size of the dataset D  ( x − x )( y i i − y) w1 = i =1 D w0 = y − w1  x  ( xi − x ) 2 i =1 121 121 45 Regression Analysis ◼ Linear regression: Example ◼ the xi column shows scores on the aptitude test. Similarly, the yi column shows statistics grades 122 122 Regression Analysis ◼ Linear regression: Example ◼ Computation of the squares of the deviation scores 123 123 46 Regression Analysis ◼ Linear regression: Example ◼ Computation of the product of the deviation scores 124 124 Regression Analysis ◼ Linear regression: Example ◼ Computation of w1 w1 = 470/730 = 0.644 ◼ Computation of w0 w0 = 77 - 0.644 ·78 = 26.768 ◼ Linear regression equation y = 0.644x + 26.768 125 125 47 Regression Analysis ◼ Multiple linear regression: y= w0 + w1 x1 + w2 x2 ◼ Many nonlinear functions can be transformed into the above W = ( XT X ) XT Y −1 126 126 Non-linear Regression Analysis ◼ Polynomial regression: y = w0 + w1 x + w2 x 2 + w3 x 3 ◼ To convert this equation to linear form, we apply the following transformation ◼ x1=x ◼ x2=x2 ◼ x3=x3 Thus, the equation becomes y= w0 + w1 x1 + w2 x2 + w3 x3 which can be solved by using the methods for multiple regression analysis. 127 127 48 Histogram Analysis ◼ Divide data into buckets and store average (sum) for each bucket ◼ Partitioning rules: ◼ Equal-width: equal bucket range ◼ Equal-frequency (or equal-depth) 129 129 Histogram Analysis 130 130 49 Clustering ◼ Partition data set into clusters based on similarity, and store cluster representation (e.g., centroid and diameter) only ◼ Can 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 structures ◼ There are many choices of clustering definitions and clustering algorithms ◼ Cluster analysis will be studied in depth in the following 131 131 Sampling ◼ Sampling: obtaining a small sample s to represent the whole data set N ◼ Allow a mining algorithm to run in complexity that is potentially sub-linear to the size of the data ◼ Key principle: Choose a representative subset of the data ◼ Simple random sampling may have very poor performance in the presence of skew ◼ Develop adaptive sampling methods, e.g., stratified sampling ◼ Note: Sampling may not reduce database I/Os (page at a time) 132 132 50 Types of Sampling ◼ Simple random sampling ◼ There is an equal probability of selecting any particular item ◼ Sampling without replacement ◼ Once an object is selected, it is removed from the population ◼ Sampling with replacement ◼ A selected object is not removed from the population ◼ Stratified sampling: ◼ Partition the data set, and draw samples from each partition (proportionally, i.e., approximately the same percentage of the data) ◼ Used in conjunction with skewed data (also the smaller group of items will be sure to be represented) 133 133 Types of Sampling ◼ Sampling with and without replacement. What is the difference ◼ When we sample with replacement, the two sample values are independent. ◼ what we get on the first one doesn't affect what we get on the second. ◼ The covariance between the two is zero. ◼ In sampling without replacement, the two sample values aren't independent. ◼ what we got on for the first one affects what we can get for the second one. ◼ The covariance between the two is from a population with variance σ2 134 134 51 Sampling: With or without Replacement Raw Data 135 135 Sampling: Cluster or Stratified Sampling Raw Data Cluster/Stratified Sample 136 136 52 Sampling: Cluster or Stratified Sampling 137 137 Data Cube Aggregation ◼ The lowest level of a data cube (base cuboid) ◼ The aggregated data for an individual entity of interest ◼ E.g., a customer in a phone calling data warehouse ◼ Multiple levels of aggregation in data cubes ◼ Further reduce the size of data to deal with ◼ Reference appropriate levels ◼ Use the smallest representation which is enough to solve the task ◼ Queries regarding aggregated information should be answered using data cube, when possible 138 138 53 Data Cube Aggregation 139 139 Data Reduction 3: Data Compression ◼ String compression ◼ There are extensive theories and well-tuned algorithms ◼ Typically lossless, but only limited manipulation is possible without expansion ◼ Audio/video compression ◼ Typically lossy compression, with progressive refinement ◼ Sometimes small fragments of signal can be reconstructed without reconstructing the whole ◼ Time sequence is not audio ◼ Typically short and vary slowly with time ◼ Dimensionality and numerosity reduction may also be considered as forms of data compression 140 140 54 Data Compression Original Data Compressed Data lossless Original Data Approximated 141 141 Chapter 3: Data Preprocessing ◼ Data Preprocessing: An Overview ◼ Data Quality ◼ Major Tasks in Data Preprocessing ◼ Data Cleaning ◼ Data Integration ◼ Data Reduction ◼ Data Transformation and Data Discretization ◼ Summary 142 142 55 Data Transformation ◼ A function that maps the entire set of values of a given attribute to a new set of replacement values such that each old value can be identified with one of the new values ◼ Methods ◼ Smoothing: Remove noise from data ◼ Attribute/feature construction ◼ New attributes constructed from the given ones ◼ Aggregation: Summarization, data cube construction ◼ Normalization: Scaled to fall within a smaller, specified range ◼ min-max normalization ◼ z-score normalization ◼ normalization by decimal scaling ◼ Discretization: Concept hierarchy climbing 143 143 Normalization ◼ Min-max normalization: to [new_minA, new_maxA] v − minA v' = (new _ maxA − new _ minA) + new _ minA maxA − minA ◼ Ex. Let income range $12,000 to $98,000 normalized to [0.0, 1.0]. Then $73,600 is mapped to 73,600 − 12,000 (1.0 − 0) + 0 = 0.716 98,000 − 12,000 ◼ Z-score normalization (μ: mean, σ: standard deviation): v − A v' =  A 73,600 − 54,000 ◼ Ex. Let μ = 54,000, σ = 16,000. Then = 1.225 16,000 144 144 56 Normalization ◼ Normalization by decimal scaling v v'= where j is the smallest integer such that Max(|ν’|) < 1 10 j ◼ Suppose that the recorded values of A range from -986 to 917. The maximum absolute value of A is 986. To normalize by decimal scaling, we therefore divide each value by 1000 (i.e., j = 3) so that - 986 normalizes to -0.986 and 917 normalizes to 0.917. 145 145 Discretization ◼ Three types of attributes ◼ Nominal—values from an unordered set, e.g., color, profession ◼ Ordinal—values from an ordered set, e.g., military or academic rank ◼ Numeric—real numbers, e.g., integer or real numbers ◼ Discretization: Divide the range of a continuous attribute into intervals ◼ Interval labels can then be used to replace actual data values ◼ Reduce data size by discretization ◼ Supervised (uses information on the class) vs. unsupervised ◼ Split (top-down) vs. merge (bottom-up) ◼ Discretization can be performed recursively on an attribute ◼ Prepare for further analysis, e.g., classification 146 146 57 Data Discretization Methods ◼ Typical methods: All the methods can be applied recursively ◼ Binning ◼ Top-down split, unsupervised ◼ Histogram analysis ◼ Top-down split, unsupervised ◼ Clustering analysis (unsupervised, top-down split or bottom-up merge) ◼ Decision-tree analysis (supervised, top-down split) ◼ Correlation (e.g., 2) analysis (supervised, bottom-up merge) 147 147 Simple Discretization: Binning ◼ Equal-width (distance) partitioning ◼ Divides the range into N intervals of equal size: uniform grid ◼ if A and B are the lowest and highest values of the attribute, the width of intervals will be: W = (B –A)/N. ◼ The most straightforward, but outliers may dominate presentation ◼ Skewed data is not handled well ◼ Equal-depth (frequency) partitioning ◼ Divides the range into N intervals, each containing approximately same number of samples ◼ Good data scaling 148 148 58 Binning Methods ❑ Sorted data for price (in dollars): 4, 8, 9, 15, 21, 21, 24, 25, 26, 28, 29, 34 * Partition into equal-frequency (equi-depth) bins: - Bin 1: 4, 8, 9, 15 - Bin 2: 21, 21, 24, 25 - Bin 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 149 149 Discretization Without Using Class Labels (Binning vs. Clustering) Data Equal width (binning) Equal interval width (binning) Equal frequency (binning) K-means clustering leads to better results 150 150 59 Discretization by Classification & Correlation Analysis ◼ Classification (e.g., decision tree analysis) ◼ Supervised: Given class labels, e.g., cancerous vs. benign ◼ Using entropy to determine split point (discretization point) ◼ Top-down, recursive split ◼ Details to be covered in the following ◼ Correlation analysis (e.g., Chi-merge: χ2-based discretization) ◼ Supervised: use class information ◼ Bottom-up merge: find the best neighboring intervals (those having similar distributions of classes, i.e., low χ2 values) to merge ◼ Merge performed recursively, until a predefined stopping condition 151 151 ChiMerge Discretization ◼ Statistical approach to Data Sample F K 1 1 1 Discretization 2 3 2 ◼ Applies the Chi Square method to 3 7 1 determine the probability of 4 8 1 similarity of data between two 5 9 1 6 11 2 intervals. 7 23 2 8 37 1 ◼ F -> feature 9 39 2 10 45 1 ◼ K -> class 11 46 1 12 59 1 152 152 60 ChiMerge Discretization Sample F K Intervals 1 1 1 ◼ Sort and order the attributes that {0,2} 2 3 2 {2,5} you want to group (in this 3 7 1 {5,7.5} example attribute F). Start with having every unique 4 8 1 {7.5,8.5} ◼ value in the attribute be in its own 5 9 1 {8.5,10} interval. 6 11 2 {10,17} 7 23 2 {17,30} ◼ Independence: change in the 8 37 1 {30,38} values of the feature, same label 9 39 2 {38,42} for the class 10 45 1 {42,45.5} 11 46 1 {45.5,52} 12 59 1 {52,60} 153 153 ChiMerge Discretization Sample F K 1 1 1 ◼ Begin calculating the Chi Square 2 3 2 test on every interval 3 7 1 Sample K=1 K=2 4 8 1 2 0 1 1 5 9 1 3 1 0 1 6 11 2 total 1 1 2 7 23 2 8 37 1 Sample K=1 K=2 9 39 2 3 1 0 1 4 1 0 1 10 45 1 total 2 0 2 11 46 1 12 59 1 154 154 61 ChiMerge Discretization Sample K=1 K=2 E11 = (1/2)*1 =.5 2 0 1 1 E12 = (1/2)*1 =.5 3 1 0 1 E21 = (1/2)*1 =.5 total 1 1 2 E22 = (1/2)*1 =.5 X2 = (0-.5)2/.5 + (0-.5)2/.5 + (0-.5)2/.5 + (0-.5)2/.5 = 2 Sample K=1 K=2 E11 = (1/2)*2 = 1 3 1 0 1 E12 = (0/2)*2 = 0 4 1 0 1 E21 = (1/2)*2 = 1 total 2 0 2 E22 = (0/2)*2 = 0 X2 = (1-1)2/1+(0-0)2/0+ (1-1)2/1+(0-0)2/0 = 0 Threshold.1 with df=1 from Chi square distribution chart merge if X2 < 2.7024 155 155 ChiMerge Sample F K Discretization Intervals Chi 2 1 1 1 {0,2} 2 2 3 2 {2,5} Calculate all 2 the Chi 3 7 1 {5,7.5} Square value 0 for all 4 8 1 {7.5,8.5} 0 intervals 5 9 1 {8.5,10} 2 Merge the 6 11 2 {10,17} intervals with 0 the smallest 7 23 2 {17,30} 2 Chi values 8 37 1 {30,38} 2 9 39 2 {38,42} 2 10 45 1 {42,45.5} 0 11 46 1 {45.5,52} {52,60} 0 12 59 1 156 156 62 ChiMerge Discretization Sample F K Intervals Chi2 1 1 1 {0,2} 2 2 3 2 {2,5} 3 7 1 4 4 8 1 {5,10} 5 9 1 5 Repeat 6 11 2 7 23 2 {10,30} 3 8 37 1 {30,38} 2 9 39 2 {38,42} 10 45 1 4 11 46 1 {42,60} 12 59 1 157 157 ChiMerge Discretization Sample F K Intervals Chi2 1 1 1 2 3 2 {0,5} 1.875 3 7 1 4 8 1 {5,10} 5 9 1 5 Again 6 11 2 7 23 2 {10,30} 1.33 8 37 1 9 39 2 {30,42} 10 45 1 1.875 11 46 1 {42,60} 12 59 1 158 158 63 ChiMerge Discretization Sample F K Intervals Chi2 1 1 1 2 3 2 {0,5} 1.875 3 7 1 4 8 1 {5,10} 5 9 1 3.93 6 11 2 7 23 2 Until 8 37 1 {10,30} 9 39 2 3.93 10 45 1 11 46 1 {42,60} 12 59 1 159 159 ChiMerge Discretization Sample F K Intervals Chi2 1 1 1 2 3 2 {0,10} 3 7 1 4 8 1 There are no more 5 9 1 2.72 intervals that can satisfy the Chi 6 11 2 Square test. 7 23 2 8 37 1 {10,30} 9 39 2 3.93 10 45 1 11 46 1 {42,60} 12 59 1 160 160 64 Concept Hierarchy Generation ◼ Concept hierarchy organizes concepts (i.e., attribute values) hierarchically and is usually associated with each dimension in a data warehouse ◼ Concept hierarchies facilitate drilling and rolling in data warehouses to view data in multiple granularity ◼ Concept hierarchy formation: Recursively reduce the data by collecting and replacing low level concepts (such as numeric values for age) by higher level concepts (such as youth, adult, or senior) ◼ Concept hierarchies can be explicitly specified by domain experts and/or data warehouse designers ◼ Concept hierarchy can be automatically formed for both numeric and nominal data. For numeric data, use discretization methods shown. 161 161 Concept Hierarchy Generation for Nominal Data ◼ Specification of a partial/total ordering of attributes explicitly at the schema level by users or experts ◼ street < city < state < country ◼ Specification of a hierarchy for a set of values by explicit data grouping ◼ {Urbana, Champaign, Chicago} < Illinois ◼ Specification of only a partial set of attributes ◼ E.g., only street < city, not others ◼ Automatic generation of hierarchies (or attribute levels) by the analysis of the number of distinct values ◼ E.g., for a set of attributes: {street, city, state, country} 162 162 65 Automatic Concept Hierarchy Generation ◼ Some hierarchies can be automatically generated based on the analysis of the number of distinct values per attribute in the data set ◼ The attribute with the most distinct values is placed at the lowest level of the hierarchy ◼ Exceptions, e.g., weekday, month, quarter, year country 15 distinct values province_or_ state 365 distinct values city 3567 distinct values street 674,339 distinct values 163 163 Chapter 3: Data Preprocessing ◼ Data Preprocessing: An Overview ◼ Data Quality ◼ Major Tasks in Data Preprocessing ◼ Data Cleaning ◼ Data Integration ◼ Data Reduction ◼ Data Transformation and Data Discretization ◼ Summary 164 164 66 Summary ◼ Data quality: accuracy, completeness, consistency, timeliness, believability, interpretability ◼ Data cleaning: e.g. missing/noisy values, outliers ◼ Data integration from multiple sources: ◼ Entity identification problem ◼ Remove redundancies ◼ Detect inconsistencies ◼ Data reduction ◼ Dimensionality reduction ◼ Numerosity reduction ◼ Data compression ◼ Data transformation and data discretization ◼ Normalization ◼ Concept hierarchy generation 165 165 References ◼ D. P. Ballou and G. K. Tayi. Enhancing data quality in data warehouse environments. Comm. of ACM, 42:73-78, 1999 ◼ A. Bruce, D. Donoho, and H.-Y. Gao. Wavelet analysis. IEEE Spectrum, Oct 1996 ◼ T. Dasu and T. Johnson. Exploratory Data Mining and Data Cleaning. John Wiley, 2003 ◼ J. Devore and R. Peck. Statistics: The Exploration and Analysis of Data. Duxbury Press, 1997. ◼ H. Galhardas, D. Florescu, D. Shasha, E. Simon, and C.-A. Saita. Declarative data cleaning: Language, model, and algorithms. VLDB'01 ◼ M. Hua and J. Pei. Cleaning disguised missing data: A heuristic approach. KDD'07 ◼ H. V. Jagadish, et al., Special Issue on Data Reduction Techniques. Bulletin of the Technical Committee on Data Engineering, 20(4), Dec. 1997 ◼ H. Liu and H. Motoda (eds.). Feature Extraction, Construction, and Selection: A Data Mining Perspective. Kluwer Academic, 1998 ◼ J. E. Olson. Data Quality: The Accuracy Dimension. Morgan Kaufmann, 2003 ◼ D. Pyle. Data Preparation for Data Mining. Morgan Kaufmann, 1999 ◼ V. Raman and J. Hellerstein. Potters Wheel: An Interactive Framework for Data Cleaning and Transformation, VLDB’2001 ◼ T. Redman. Data Quality: The Field Guide. Digital Press (Elsevier), 2001 ◼ R. Wang, V. Storey, and C. Firth. A framework for analysis of data quality research. IEEE Trans. Knowledge and Data Engineering, 7:623-640, 1995 166 166 67

Use Quizgecko on...
Browser
Browser