data$mining$mtat.03.183$ descripveanalysis,preprocessing,$ …€¦ · march 6, 2014 data mining:...
TRANSCRIPT
Data Mining MTAT.03.183
Descrip5ve analysis, preprocessing, visualisa5on...
Jaak Vilo 2012 Fall
March 6, 2014 Data Mining: Concepts and Techniques 2
Why Data Preprocessing?
n Data in the real world is dirty n incomplete: lacking attribute values, lacking
certain attributes of interest, or containing only aggregate data
n e.g., occupation=“ ”
n noisy: containing errors or outliers n e.g., Salary=“-10”
n inconsistent: containing discrepancies in codes or names
n e.g., Age=“42” Birthday=“03/07/1997” n e.g., Was rating “1,2,3”, now rating “A, B, C” n e.g., discrepancy between duplicate records
March 6, 2014 Data Mining: Concepts and Techniques 3
Why Is Data Dirty?
n Incomplete data may come from n “Not applicable” data value when collected n Different considerations between the time when the data was
collected and when it is analyzed. n Human/hardware/software problems
n Noisy data (incorrect values) may come from n Faulty data collection instruments n Human or computer error at data entry n Errors in data transmission
n Inconsistent data may come from n Different data sources n Functional dependency violation (e.g., modify some linked data)
n Duplicate records also need data cleaning
March 6, 2014 Data Mining: Concepts and Techniques 4
Why Is Data Preprocessing Important?
n No quality data, no quality mining results!
n Quality decisions must be based on quality data n e.g., duplicate or missing data may cause incorrect or even
misleading statistics.
n Data warehouse needs consistent integration of quality data
n Data extraction, cleaning, and transformation comprises the majority of the work of building a data warehouse
n Garbage in, garbage out
High quality data requirements
n High-quality data needs to pass a set of quality criteria. Those include:
n Accuracy: an aggregated value over the criteria of integrity, consistency, and density
n Integrity: an aggregated value over the criteria of completeness and validity
n Completeness: achieved by correcting data containing anomalies n Validity: approximated by the amount of data satisfying integrity
constraints n Consistency: concerns contradictions and syntactical anomalies n Uniformity: directly related to irregularities and in compliance with
the set 'unit of measure' n Density: the quotient of missing values in the data and the number
of total values ought to be known n http://en.wikipedia.org/wiki/Data_cleansing n March 6, 2014 Data Mining: Concepts and Techniques 5
March 6, 2014 Data Mining: Concepts and Techniques 6
March 6, 2014 Data Mining: Concepts and Techniques 7
Multi-Dimensional Measure of Data Quality
n A well-accepted multidimensional view: n Accuracy n Completeness n Consistency n Timeliness n Believability n Value added n Interpretability n Accessibility
n Broad categories: n Intrinsic, contextual, representational, and accessibility
March 6, 2014 Data Mining: Concepts and Techniques 8
Major Tasks in Data Preprocessing
n Data cleaning n Fill in missing values, smooth noisy data, identify or remove
outliers, and resolve inconsistencies
n Data integration n Integration of multiple databases, data cubes, or files
n Data transformation n Normalization and aggregation
n Data reduction n Obtains reduced representation in volume but produces the same
or similar analytical results
n Data discretization n Part of data reduction but with particular importance, especially
for numerical data
March 6, 2014 Data Mining: Concepts and Techniques 9
Forms of Data Preprocessing
March 6, 2014 Data Mining: Concepts and Techniques 10
Chapter 2: Data Preprocessing
n Why preprocess the data?
n Descriptive data summarization
n Data cleaning
n Data integration and transformation
n Data reduction
n Discretization and concept hierarchy generation
n Summary
• 0.48 0.03 0.06 0.05 0.43 0.19 0.16 0.35 0.25 0.07 0.29 0.14 0.96 0.02 0.11 0.22 0.80 0.05 0.54 0.36 0.23 0.28 0.02 0.10 0.48 0.31 0.36 0.21 0.33 0.45 0.64 0.04 0.48 0.56 0.16 0.58 0.33 0.11 0.42 0.06 0.00 0.23 0.24 0.00 0.54 0.02 0.26 0.20 0.18 0.01 0.17 0.17 0.04 0.97 0.25 0.04 0.34 0.01 0.50 0.15 0.43 0.05 0.50 0.16 0.52 0.82 0.23 0.09 0.02 0.21 0.13 0.17 0.33 0.26 0.00 0.33 0.57 0.43 0.09 0.43 0.24 0.08 0.08 0.54 0.08 0.02 0.02 0.01 0.35 0.62 0.10 0.03 0.14 0.78 0.30 0.07 0.08 0.48 0.57 0.30
Jaak Vilo and other authors UT: Data Mining 2009 11
0,00#
0,20#
0,40#
0,60#
0,80#
1,00#
1,20#
0# 20# 40# 60# 80# 100# 120#
Series1#
Jaak Vilo and other authors UT: Data Mining 2009 12
0,00#
0,20#
0,40#
0,60#
0,80#
1,00#
1,20#
0# 20# 40# 60# 80# 100# 120#
Series1#
Jaak Vilo and other authors UT: Data Mining 2009 13
Characterise data
use Big_University_DB mine characteris5cs as "Science_Students" in relevance to name,gender,major,birth_date,residence,phone#,gpa from student where status in graduate
Jaak Vilo and other authors UT: Data Mining 2009 14
March 6, 2014 Data Mining: Concepts and Techniques 15
Mining Data Descriptive Characteristics
n Motivation
n To better understand the data: central tendency, variation and spread
n Data dispersion characteristics
n median, max, min, quantiles, outliers, variance, etc.
n Numerical dimensions correspond to sorted intervals
n Data dispersion: analyzed with multiple granularities of precision
n Boxplot or quantile analysis on sorted intervals
n Dispersion analysis on computed measures
n Folding measures into numerical dimensions
n Boxplot or quantile analysis on the transformed cube
March 6, 2014 Data Mining: Concepts and Techniques 16
Measuring the Central Tendency
n Mean (algebraic measure) (sample vs. population):
n Weighted arithmetic mean:
n Trimmed mean: chopping extreme values
n Median: A holistic measure
n Middle value if odd number of values, or average of the middle two
values otherwise
n Estimated by interpolation (for grouped data):
n Mode
n Value that occurs most frequently in the data
n Unimodal, bimodal, trimodal
n Empirical formula:
∑=
=n
iixn
x1
1
∑
∑
=
== n
ii
n
iii
w
xwx
1
1
cf
lfnLmedian
median
))(2/
(1∑−
+=
)(3 medianmeanmodemean −×=−
Nx∑=µ
• Histograms and Probability Density FuncSons • Probability Density FuncSons
– Total area under curve integrates to 1
• Frequency Histograms – Y-‐axis is counts – Simple interpretaSon – Can't be directly related to probabiliSes or density funcSons
• RelaSve Frequency Histograms – Divide counts by total number of observaSons – Y-‐axis is relaSve frequency – Can be interpreted as probabiliSes for each range – Can't be directly related to density funcSon
• Bar heights sum to 1 but won't integrate to 1 unless bar width = 1
• Density Histograms – Divide counts by (total number of observaSons X bar width) – Y-‐axis is density values – Bar height X bar width gives probability for each range – Can be directly related to density funcSon
• Bar areas sum to 1
Jaak Vilo and other authors UT: Data Mining 2009 17
http://www.geog.ucsb.edu/~joel/g210_w07/lecture_notes/lect04/oh07_04_1.html
Jaak Vilo and other authors UT: Data Mining 2009 18
Jaak Vilo and other authors UT: Data Mining 2009 19
Jaak Vilo and other authors UT: Data Mining 2009 20
histograms
• equal sub-‐intervals, known as `bins‘
• break points
• bin width
Jaak Vilo and other authors UT: Data Mining 2009 21
Jaak Vilo and other authors UT: Data Mining 2009 22
The data are (the log of) wing spans of aircraft built in from 1956 - 1984.
Jaak Vilo and other authors UT: Data Mining 2009 23
Jaak Vilo and other authors UT: Data Mining 2009 24
Histogram vs kernel density
• properSes of histograms with these two examples: – they are not smooth – depend on end points of bins – depend on width of bins
• We can alleviate the first two problems by using kernel density es5mators.
• To remove the dependence on the end points of the bins, we centre each of the blocks at each data point rather than fixing the end points of the blocks.
Jaak Vilo and other authors UT: Data Mining 2009 25
Jaak Vilo and other authors UT: Data Mining 2009 26
block of width 1 and height 1/12 (the dotted boxes) as they are 12 data points, and then add them up
• Blocks -‐ it is sSll disconSnuous as we have used a disconSnuous kernel as our building block
• If we use a smooth kernel for our building block, then we will have a smooth density esSmate.
Jaak Vilo and other authors UT: Data Mining 2009 27
• It's important to choose the most appropriate bandwidth as a value that is too small or too large is not useful.
• If we use a normal (Gaussian) kernel with bandwidth or standard deviaSon of 0.1 (which has area 1/12 under the each curve) then the kernel density esSmate is said to undersmoothed as the bandwidth is too small in the figure below.
• It appears that there are 4 modes in this density -‐ some of these are surely arSfices of the data.
Jaak Vilo and other authors UT: Data Mining 2009 28
Jaak Vilo and other authors UT: Data Mining 2009 29
Jaak Vilo and other authors UT: Data Mining 2009 30
• Choose opSmal bandwith – Methods to esSmate it
• AMISE = AsymptoSc Mean Integrated Squared Error • opSmal bandwidth = arg min AMISE
Jaak Vilo and other authors UT: Data Mining 2009 31
• The opSmal value of the bandwidth for our dataset is about 0.25.
• From the opSmally smoothed kernel density esSmate, there are two modes. As these are the log of aircrai wing span, it means that there were a group of smaller, lighter planes built, and these are clustered around 2.5 (which is about 12 m).
• Whereas the larger planes, maybe using jet engines as these used on a commercial scale from about the 1960s, are grouped around 3.5 (about 33 m).
Jaak Vilo and other authors UT: Data Mining 2009 32
Jaak Vilo and other authors UT: Data Mining 2009 33
• The properSes of kernel density esSmators are, as compared to histograms: – smooth – no end points – depend on bandwidth
Jaak Vilo and other authors UT: Data Mining 2009 34
Kernel Density esSmaSon
• Ricardo GuSerrez-‐Osuna hmp://research.cs.tamu.edu/prism/lectures/pr/pr_l7.pdf
• Tutorial and Java applet for tesSng: – hmp://parallel.vub.ac.be/research/causalModels/tutorial/kde.html
Jaak Vilo and other authors UT: Data Mining 2009 35
Jaak Vilo and other authors UT: Data Mining 2009 36
R – example (due K. Tretjakov) d = c(1,2,2,2,2,1,2,2,2,3,2,3,4,5,4,3,2,3,4,4,5,6,7); kernelsmooth <-‐ funcSon(data, sigma, x) { result = 0; for (d in data) { result = result + exp(-‐(x-‐d)^2/2/sigma^2); } result/sqrt(2*pi)/sigma; } x = seq(min(d), max(d), by=0.1); y = sapply(x, funcSon(x) { kernelsmooth(d, 1, x) }); hist(d); lines(x,y);
Jaak Vilo and other authors UT: Data Mining 2009 37
hmp://parallel.vub.ac.be/research/causalModels/tutorial/kde.html
Jaak Vilo and other authors UT: Data Mining 2009 38
Jaak Vilo and other authors UT: Data Mining 2009 39
Jaak Vilo and other authors UT: Data Mining 2009 40
AggregaSon, analysis and visualizaSon of geodata
• hmp://sightsmap.com • Several large crowd-‐sourced datasets:
– The whole Panoramio photobank used by Google maps – The whole Wikipedia, geotags and wikipedia arScle logs – Foursquare – ... More
• Aggregate data, calculate popularites of places, calculate type tags • Translate and categorize Stles and descripSons to get types • Improve aggregaSon algorithms by learning • Visualize heatmaps, type tags, aggregated sources
By: Tanel Tammet
By: Tanel Tammet
By: Tanel Tammet
By: Tanel Tammet
By: Tanel Tammet
By: Tanel Tammet
• hmp://176.32.89.45/~hideaki/res/kernel.html
Jaak Vilo and other authors UT: Data Mining 2009 47
hmp://jmlr.csail.mit.edu/proceedings/papers/v2/kontkanen07a/kontkanen07a.pdf
Jaak Vilo and other authors UT: Data Mining 2009 48
Jaak Vilo and other authors UT: Data Mining 2009 49
Jaak Vilo and other authors UT: Data Mining 2009 50
• R tutorial – hmp://cran.r-‐project.org/doc/manuals/R-‐intro.html
– hmp://www.google.com/search?q=R+tutorial
Jaak Vilo and other authors UT: Data Mining 2009 51
More links on R and kernel density • hmp://en.wikipedia.org/wiki/Kernel_density_esSmaSon
• hmp://sekhon.berkeley.edu/stats/html/density.html
• hmp://stat.ethz.ch/R-‐manual/R-‐patched/library/stats/html/density.html
• hmp://www.google.com/search?q=kernel+density+esSmaSon+R
Jaak Vilo and other authors UT: Data Mining 2009 52
Jaak Vilo and other authors UT: Data Mining 2009 53
Jaak Vilo and other authors UT: Data Mining 2009 54
Jaak Vilo and other authors UT: Data Mining 2009 55
Jaak Vilo and other authors UT: Data Mining 2009 56
March 6, 2014 Data Mining: Concepts and Techniques 57
Symmetric vs. Skewed Data
n Median, mean and mode of symmetric, positively and negatively skewed data
March 6, 2014 Data Mining: Concepts and Techniques 58
Measuring the Dispersion of Data
n Quartiles, outliers and boxplots
n Quartiles: Q1 (25th percentile), Q3 (75th percentile)
n Inter-quartile range: IQR = Q3 – Q1
n Five number summary: min, Q1, M, Q3, max n Boxplot: ends of the box are the quartiles, median is marked, whiskers, and
plot outlier individually
n Outlier: usually, a value higher/lower than 1.5 x IQR
n Variance and standard deviation (sample: s, population: σ)
n Variance: (algebraic, scalable computation)
n Standard deviation s (or σ) is the square root of variance s2 (or σ2)
∑ ∑∑= ==
−−
=−−
=n
i
n
iii
n
ii x
nx
nxx
ns
1 1
22
1
22 ])(1[11)(
11
∑∑==
−=−=n
ii
n
ii x
Nx
N 1
22
1
22 1)(1µµσ
March 6, 2014 Data Mining: Concepts and Techniques 59
Properties of Normal Distribution Curve
n The normal (distribution) curve n From μ–σ to μ+σ: contains about 68% of the
measurements (μ: mean, σ: standard deviation) n From μ–2σ to μ+2σ: contains about 95% of it n From μ–3σ to μ+3σ: contains about 99.7% of it
March 6, 2014 Data Mining: Concepts and Techniques 60
March 6, 2014 Data Mining: Concepts and Techniques 61
Boxplot Analysis
n Five-number summary of a distribution:
Minimum, Q1, M, Q3, Maximum
n Boxplot
n Data is represented with a box
n The ends of the box are at the first and third quartiles, i.e., the height of the box is IRQ
n The median is marked by a line within the box
n Whiskers: two lines outside the box extend to Minimum and Maximum
Box Plots
• Tukey77: John W. Tukey, "Exploratory Data Analysis". Addison-‐Wesley, Reading, MA. 1977.
• hmp://informaSonandvisualizaSon.de/blog/box-‐plot
•
Jaak Vilo and other authors UT: Data Mining 2009 62
Jaak Vilo and other authors UT: Data Mining 2009 63
Jaak Vilo and other authors UT: Data Mining 2009 64
Jaak Vilo and other authors UT: Data Mining 2009 65
1.5 x IQR – Inter Quartile range
Jaak Vilo and other authors UT: Data Mining 2009 66
March 6, 2014 Data Mining: Concepts and Techniques 67
Visualization of Data Dispersion: Boxplot Analysis
March 6, 2014 Data Mining: Concepts and Techniques 68
March 6, 2014 Data Mining: Concepts and Techniques 69
Violin plot
70
Violin plot - R
71 http://gallery.r-enthusiasts.com/graph/Violin_plot,43
n Example of plots-containing article: n http://www.kgs.ku.edu/Magellan/WaterLevels/
CD/Reports/OFR04_57/rep00.htm
March 6, 2014 Data Mining: Concepts and Techniques 72
Quantile-Quantile (q-q) Plots
n http://onlinestatbook.com/2/advanced_graphs/q-q_plots.html
March 6, 2014 Data Mining: Concepts and Techniques 73
Cumulative Distribution Function (CDF)
March 6, 2014 Data Mining: Concepts and Techniques 74
March 6, 2014 Data Mining: Concepts and Techniques 75
March 6, 2014 Data Mining: Concepts and Techniques 76
March 6, 2014 Data Mining: Concepts and Techniques 77
March 6, 2014 Data Mining: Concepts and Techniques 78
A Q–Q plot comparing the distributions of standardizeddaily maximum temperatures at 25 stations in the US state of Ohio in March and in July. The curved pattern suggests that the central quantiles are more closely spaced in July than in March, and that the March distribution is skewed to the right compared to the July distribution. The data cover the period 1893–2001.
n Parametric modeling usually involves making assumptions about the shape of data, or the shape of residuals from a regression fit. Verifying such assumptions can take many forms, but an exploration of the shape using histograms and q-q plots is very effective. The q-q plot does not have any design parameters such as the number of bins for a histogram.
March 6, 2014 Data Mining: Concepts and Techniques 79
Kemmeren et.al. (Mol. Cell, 2002)
Randomized expression data
Yeast 2-hybrid studies
Known (literature) PPI
MPK1 YLR350w SNF4 YCL046W"
SNF7 YGR122W.
March 6, 2014 Data Mining: Concepts and Techniques 81
Scatter plot
n Provides a first look at bivariate data to see clusters of points, outliers, etc
n Each pair of values is treated as a pair of coordinates and plotted as points in the plane
March 6, 2014 Data Mining: Concepts and Techniques 82
March 6, 2014 Data Mining: Concepts and Techniques 83
Not Correlated Data
Numerical summary?
March 6, 2014 Data Mining: Concepts and Techniques 84
Anscombe’s quartet
March 6, 2014 Data Mining: Concepts and Techniques 85
March 6, 2014 Data Mining: Concepts and Techniques 86
March 6, 2014 Data Mining: Concepts and Techniques 87
Loess Curve
n Adds a smooth curve to a scatter plot in order to provide better perception of the pattern of dependence
n Loess curve is fitted by setting two parameters: a smoothing parameter, and the degree of the polynomials that are fitted by the regression
March 6, 2014 Data Mining: Concepts and Techniques 88
Graphic Displays of Basic Statistical Descriptions
n Histogram: (shown before) n Boxplot: (covered before) n Quantile plot: each value xi is paired with fi indicating
that approximately 100 fi % of data are ≤ xi n Quantile-quantile (q-q) plot: graphs the quantiles of one
univariant distribution against the corresponding quantiles of another
n Scatter plot: each pair of values is a pair of coordinates and plotted as points in the plane
n Loess (local regression) curve: add a smooth curve to a scatter plot to provide better perception of the pattern of dependence
March 6, 2014 Data Mining: Concepts and Techniques 89
Chapter 2: Data Preprocessing
n Why preprocess the data?
n Descriptive data summarization
n Data cleaning
n Data integration and transformation
n Data reduction
n Discretization and concept hierarchy generation
n Summary
March 6, 2014 Data Mining: Concepts and Techniques 90
Data Cleaning
n Importance n “Data cleaning is one of the three biggest problems
in data warehousing”—Ralph Kimball n “Data cleaning is the number one problem in data
warehousing”—DCI survey
n Data cleaning tasks
n Fill in missing values
n Identify outliers and smooth out noisy data
n Correct inconsistent data
n Resolve redundancy caused by data integration
March 6, 2014 Data Mining: Concepts and Techniques 91
Missing Data
n Data is not always available
n E.g., many tuples have no recorded value for several attributes, such as customer income in sales data
n Missing data may be due to
n equipment malfunction
n inconsistent with other recorded data and thus deleted
n data not entered due to misunderstanding
n certain data may not be considered important at the time of entry
n not register history or changes of the data
n Missing data may need to be inferred.
March 6, 2014 Data Mining: Concepts and Techniques 92
How to Handle Missing Data?
n 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.
n Fill in the missing value manually: tedious + infeasible?
n Fill in it automatically with
n a global constant : e.g., “unknown”, a new class?!
n the attribute mean
n the attribute mean for all samples belonging to the same class:
smarter
n the most probable value: inference-based such
as Bayesian formula or decision tree
K-NN impute
n K nearest neighbours imputation
n Find K neighbours on available data points
n Estimate the missing value
n (Hastie, Tibshirani, Troyanskaya, … Stanford 1999-2001)
March 6, 2014 Data Mining: Concepts and Techniques 93
March 6, 2014 Data Mining: Concepts and Techniques 94
March 6, 2014 Data Mining: Concepts and Techniques 95
Noisy Data
n Noise: random error or variance in a measured variable n Incorrect attribute values may due to
n faulty data collection instruments n data entry problems n data transmission problems n technology limitation n inconsistency in naming convention
n Other data problems which requires data cleaning n duplicate records n incomplete data n inconsistent data
March 6, 2014 Data Mining: Concepts and Techniques 96
How to Handle Noisy Data?
n Binning n first sort data and partition into (equal-frequency) bins n then one can smooth by bin means, smooth by bin
median, smooth by bin boundaries, etc. n Regression
n smooth by fitting the data into regression functions n Clustering
n detect and remove outliers n Combined computer and human inspection
n detect suspicious values and check by human (e.g., deal with possible outliers)
March 6, 2014 Data Mining: Concepts and Techniques 97
Simple Discretization Methods: Binning
n Equal-width (distance) partitioning
n Divides the range into N intervals of equal size: uniform grid
n if A and B are the lowest and highest values of the attribute, the
width of intervals will be: W = (B –A)/N.
n The most straightforward, but outliers may dominate presentation
n Skewed data is not handled well
n Equal-depth (frequency) partitioning
n Divides the range into N intervals, each containing approximately
same number of samples
n Good data scaling
n Managing categorical attributes can be tricky
March 6, 2014 Data Mining: Concepts and Techniques 98
Binning Methods for Data Smoothing
q 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
March 6, 2014 Data Mining: Concepts and Techniques 99
Regression
x
y
y = x + 1
X1
Y1
Y1’
March 6, 2014 Data Mining: Concepts and Techniques 100
Cluster Analysis
G1
G2
G3
March 6, 2014 Data Mining: Concepts and Techniques 101
Data Cleaning as a Process
n Data discrepancy detection n Use metadata (e.g., domain, range, dependency, distribution) n Check field overloading n Check uniqueness rule, consecutive rule and null rule n Use commercial tools
n Data scrubbing: use simple domain knowledge (e.g., postal code, spell-check) to detect errors and make corrections
n Data auditing: by analyzing data to discover rules and relationship to detect violators (e.g., correlation and clustering to find outliers)
n Data migration and integration n Data migration tools: allow transformations to be specified n ETL (Extraction/Transformation/Loading) tools: allow users to
specify transformations through a graphical user interface n Integration of the two processes
n Iterative and interactive (e.g., Potter’s Wheels)
March 6, 2014 Data Mining: Concepts and Techniques 102
Chapter 2: Data Preprocessing
n Why preprocess the data?
n Data cleaning
n Data integration and transformation
n Data reduction
n Discretization and concept hierarchy generation
n Summary
March 6, 2014 Data Mining: Concepts and Techniques 103
Data Integration
n Data integration: n Combines data from multiple sources into a coherent
store n Schema integration: e.g., A.cust-id ≡ B.cust-#
n Integrate metadata from different sources n Entity identification problem:
n Identify real world entities from multiple data sources, e.g., Bill Clinton = William Clinton
n Detecting and resolving data value conflicts n For the same real world entity, attribute values from
different sources are different n Possible reasons: different representations, different
scales, e.g., metric vs. British units
March 6, 2014 Data Mining: Concepts and Techniques 104
Handling Redundancy in Data Integration
n Redundant data occur often when integration of multiple databases
n Object identification: The same attribute or object may have different names in different databases
n Derivable data: One attribute may be a “derived” attribute in another table, e.g., annual revenue
n Redundant attributes may be able to be detected by correlation analysis
n Careful integration of the data from multiple sources may help reduce/avoid redundancies and inconsistencies and improve mining speed and quality
Normalisation
n Making data comparable…
March 6, 2014 Data Mining: Concepts and Techniques 105
Elements of microarray statistics Reference Test
M = log2R – log2G = log2(R/G)
A = 1/2 (log2R + log2G)
Jaak Vilo and other authors UT: Data Mining 2009 107
Expression Profiler 108
Normalisation can be used to transform data
March 6, 2014 Data Mining: Concepts and Techniques 109
Chapter 2: Data Preprocessing
n Why preprocess the data?
n Data cleaning
n Data integration and transformation
n Data reduction
n Discretization and concept hierarchy generation
n Summary
March 6, 2014 Data Mining: Concepts and Techniques 110
Data Reduction Strategies
n Why data reduction? n A database/data warehouse may store terabytes of data n Complex data analysis/mining may take a very long time to run
on the complete data set n Data reduction
n Obtain a reduced representation of the data set that is much smaller in volume but yet produce the same (or almost the same) analytical results
n Data reduction strategies n Data cube aggregation: n Dimensionality reduction — e.g., remove unimportant attributes n Data Compression n Numerosity reduction — e.g., fit data into models n Discretization and concept hierarchy generation
March 6, 2014 Data Mining: Concepts and Techniques 111
Data Cube Aggregation
n The lowest level of a data cube (base cuboid)
n The aggregated data for an individual entity of interest
n E.g., a customer in a phone calling data warehouse
n Multiple levels of aggregation in data cubes
n Further reduce the size of data to deal with
n Reference appropriate levels
n Use the smallest representation which is enough to solve the task
n Queries regarding aggregated information should be answered using data cube, when possible
March 6, 2014 Data Mining: Concepts and Techniques 112
Attribute Subset Selection
n Feature selection (i.e., attribute subset selection): n 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
n reduce # of patterns in the patterns, easier to understand
n Heuristic methods (due to exponential # of choices): n Step-wise forward selection n Step-wise backward elimination n Combining forward selection and backward elimination n Decision-tree induction
March 6, 2014 Data Mining: Concepts and Techniques 113
Chapter 2: Data Preprocessing
n Why preprocess the data?
n Data cleaning
n Data integration and transformation
n Data reduction
n Discretization and concept hierarchy generation
n Summary
March 6, 2014 Data Mining: Concepts and Techniques 114
Discretization
n Three types of attributes:
n Nominal — values from an unordered set, e.g., color, profession
n Ordinal — values from an ordered set, e.g., military or academic
rank
n Continuous — real numbers, e.g., integer or real numbers
n Discretization:
n Divide the range of a continuous attribute into intervals
n Some classification algorithms only accept categorical attributes.
n Reduce data size by discretization
n Prepare for further analysis
March 6, 2014 Data Mining: Concepts and Techniques 115
Discretization and Concept Hierarchy
n Discretization
n Reduce the number of values for a given continuous attribute by
dividing the range of the attribute into intervals
n Interval labels can then be used to replace actual data values
n Supervised vs. unsupervised
n Split (top-down) vs. merge (bottom-up)
n Discretization can be performed recursively on an attribute
n Concept hierarchy formation
n Recursively reduce the data by collecting and replacing low level
concepts (such as numeric values for age) by higher level concepts
(such as young, middle-aged, or senior)
March 6, 2014 Data Mining: Concepts and Techniques 116
Segmentation by Natural Partitioning
n A simply 3-4-5 rule can be used to segment numeric data
into relatively uniform, “natural” intervals.
n If an interval covers 3, 6, 7 or 9 distinct values at the
most significant digit, partition the range into 3 equi-
width intervals
n If it covers 2, 4, or 8 distinct values at the most
significant digit, partition the range into 4 intervals
n If it covers 1, 5, or 10 distinct values at the most
significant digit, partition the range into 5 intervals
March 6, 2014 Data Mining: Concepts and Techniques 117
Example of 3-4-5 Rule
(-$400 -$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,000 Low=-$1,000 High=$2,000 Step 2:
Step 4:
Step 1: -$351 -$159 profit $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)
Example
March 6, 2014 Data Mining: Concepts and Techniques 118
-351,976.00 .. 4,700,896.50 MIN= -351,976.00 MAX=4,700,896.50 LOW = 5th percentile -159,876 HIGH = 95th percentile 1,838,761 msd = 1,000,000 (most significant digit) LOW = -1,000,000 (round down) HIGH = 2,000,000 (round up) 3 value ranges 1. (-1,000,000 .. 0] 2. (0 .. 1,000,000] 3. (1,000,000 .. 2,000,000] Adjust with real MIN and MAX 1. (-400,000 .. 0] 2. (0 .. 1,000,000] 3. (1,000,000 .. 2,000,000] 4. (2,000,000 .. 5,000,000]
Jaak Vilo and other authors UT: Data Mining 2009 119
Recursive … 1.1. (-400,000 .. -300,000 ] 1.2. (-300,000 .. -200,000 ] 1.3. (-200,000 .. -100,000 ] 1.4. (-100,000 .. 0 ] 2.1. (0 .. 200,000 ] 2.2. (200,000 .. 400,000 ] 2.3. (400,000 .. 600,000 ] 2.4. (600,000 .. 800,000 ] 2.5. (800,000 .. 1,000,000 ] 3.1. (1,000,000 .. 1,200,000 ] 3.2. (1,200,000 .. 1,400,000 ] 3.3. (1,400,000 .. 1,600,000 ] 3.4. (1,600,000 .. 1,800,000 ] 3.5. (1,800,000 .. 2,000,000 ] 4.1. (2,000,000 .. 3,000,000 ] 4.2. (3,000,000 .. 4,000,000 ] 4.3. (4,000,000 .. 5,000,000 ]
Concept Hierarchy Generation for Categorical 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} March 6, 2014 Data Mining: Concepts and Techniques 120
March 6, 2014 Data Mining: Concepts and Techniques 121
Automatic Concept Hierarchy Generation
n Some hierarchies can be automatically generated based on the analysis of the number of distinct values per attribute in the data set n The attribute with the most distinct values is placed
at the lowest level of the hierarchy n Exceptions, e.g., weekday, month, quarter, year
country
province_or_ state
city
street
15 distinct values
365 distinct values
3567 distinct values
674,339 distinct values
March 6, 2014 Data Mining: Concepts and Techniques 122
Chapter 2: Data Preprocessing
n Why preprocess the data?
n Data cleaning
n Data integration and transformation
n Data reduction
n Discretization and concept hierarchy
generation
n Summary
March 6, 2014 Data Mining: Concepts and Techniques 123
Summary
n Data preparation or preprocessing is a big issue for both data warehousing and data mining
n Discriptive data summarization is need for quality data preprocessing
n Data preparation includes
n Data cleaning and data integration
n Data reduction and feature selection
n Discretization
n A lot a methods have been developed but data preprocessing still an active area of research
March 6, 2014 Data Mining: Concepts and Techniques 124
References
n D. P. Ballou and G. K. Tayi. Enhancing data quality in data warehouse environments. Communications of ACM, 42:73-78, 1999
n T. Dasu and T. Johnson. Exploratory Data Mining and Data Cleaning. John Wiley & Sons, 2003
n T. Dasu, T. Johnson, S. Muthukrishnan, V. Shkapenyuk.
Mining Database Structure; Or, How to Build a Data Quality Browser. SIGMOD’02.
n H.V. Jagadish et al., Special Issue on Data Reduction Techniques. Bulletin of the Technical
Committee on Data Engineering, 20(4), December 1997
n D. Pyle. Data Preparation for Data Mining. Morgan Kaufmann, 1999
n E. Rahm and H. H. Do. Data Cleaning: Problems and Current Approaches. IEEE Bulletin of the Technical Committee on Data Engineering. Vol.23, No.4
n V. Raman and J. Hellerstein. Potters Wheel: An Interactive Framework for Data Cleaning and
Transformation, VLDB’2001
n T. Redman. Data Quality: Management and Technology. Bantam Books, 1992
n Y. Wand and R. Wang. Anchoring data quality dimensions ontological foundations. Communications of
ACM, 39:86-95, 1996
n 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