Preprocessing
Preprocessing
Preprocessing
Y1
Y1’ y=x+1
X1 x
•Linear regression (best line to fit
two variables)
•Multiple linear regression (more
than two variables, fit to a
multidimensional surface
How to Handle Inconsistent Data?
• Manual correction using external references
• Semi-automatic using various tools
– To detect violation of known functional
dependencies and data constraints
– To correct redundant data
Agenda
• z-score normalization
v mean A
v'
stand _ dev A
• Solution?
– Data reduction…
Data Reduction
•Obtains a reduced representation of the data
set that is much smaller in volume but yet
produces the same (or almost the same)
analytical results
•Data reduction strategies
–Data cube aggregation
–Dimensionality reduction
–Data compression
–Numerosity reduction
–Discretization and concept hierarchy generation
Data Cube Aggregation
• Multiple levels of aggregation in data cubes
– Further reduce the size of data to deal with
• Reference appropriate levels
– Use the smallest representation capable to solve the
task
• Queries regarding aggregated information should
be answered using data cube, when possible
Dimensionality Reduction
• Problem: Feature selection (i.e., attribute subset selection):
– Select a minimum set of features such that the probability
distribution of different classes given the values for those features
is as close as possible to the original distribution given the values
of all features
– Nice side-effect: reduces # of attributes in the discovered patterns
(which are now easier to understand)
• Solution: Heuristic methods (due to exponential # of
choices) usually greedy:
– step-wise forward selection
– step-wise backward elimination
– combining forward selection and backward elimination
– decision-tree induction
Example of Decision Tree Induction
nonleaf nodes: tests
branches: outcomes of tests
leaf nodes: class prediction
Initial attribute set:
A4 ? {A1, A2, A3, A4, A5, A6}
A1? A6?
os sy
l
Original Data
Approximated
Wavelet Transforms
• Discrete wavelet transform (DWT):
linear signal processing Haar2 Daubechie4
X1
Numerosity Reduction
• Parametric methods
– Assume the data fits some model, estimate model
parameters, store only the parameters, and discard the
data (except possible outliers)
– E.g.: Log-linear models: 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
Regression and Log-Linear Models
• Linear regression: Data are 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 (predictor variables)
• Log-linear model: approximates discrete
multidimensional joint probability distributions
Regression Analysis and Log-Linear Models
• Linear regression: Y = + X
– Two parameters , and 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, ….
• Multiple regression: Y = b0 + b1 X1 + b2 X2.
– Many nonlinear functions can be transformed into the above.
• Log-linear models:
– The multi-way table of joint probabilities is approximated
by a product of lower-order tables.
– Probability: p(a, b, c, d) = ab acad bcd
Histograms
• Approximate data
distributions
• Divide data into buckets and
store average (sum) for each
bucket
• A bucket represents an
attribute-value/frequency
pair
• Can be constructed
optimally in one dimension
using dynamic programming
• Related to quantization
problems.
Clustering
• Partition data set into clusters, and store cluster representation only
• Quality of clusters measured by their diameter (max distance
between any two objects in the cluster) or centroid distance (avg.
distance of each cluster object from its centroid)
• Can be very effective if data is clustered but not if data is “smeared”
• Can have hierarchical clustering (possibly stored in multi-
dimensional index tree structures (B+-tree, R-tree, quad-tree, etc))
• There are many choices of clustering definitions and clustering
algorithms (further details later)
Sampling
• Allow a mining algorithm to run in complexity that is
potentially sub-linear to the size of the data
• Cost of sampling: proportional to the size of the sample,
increases linearly with the number of dimensions
• Choose a representative subset of the data
– Simple random sampling may have very poor performance in the
presence of skew
• Develop adaptive sampling methods
– Stratified sampling:
• Approximate the percentage of each class (or subpopulation of
interest) in the overall database
• Used in conjunction with skewed data
• Sampling may not reduce database I/Os (page at a time).
• Sampling: natural choice for progressive refinement of a
reduced data set.
Sampling
W O R
SRS le random
i m p ho ut
( s e wi t
l
samp ment)
p l a ce
re
SRSW
R
Raw Data
Sampling
Raw Data Cluster/Stratified Sample
Hierarchical Reduction
• Use multi-resolution structure with different degrees of
reduction
• Hierarchical clustering is often performed but tends to
define partitions of data sets rather than “clusters”
• Parametric methods are usually not amenable to
hierarchical representation
• Hierarchical aggregation
– An index tree hierarchically divides a data set into partitions
by value range of some attributes
– Each partition can be considered as a bucket
– Thus an index tree with aggregates stored at each node is a
hierarchical histogram
Agenda
y1 y2 y3 y4 y5 y6
– Some classification algorithms only accept categorical
attributes.
– Reduce data size by discretization
– Prepare for further analysis
Discretization and Concept Hierarchy
• Discretization
– 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.
• Concept Hierarchies
– reduce the data by collecting and replacing low level
concepts (such as numeric values for the attribute age) by
higher level concepts (such as young, middle-aged, or
senior).
Discretization and concept hierarchy
generation for numeric data
• Hierarchical and recursive decomposition using:
• Entropy-based discretization
(-$4000 -$5,000)
Step 4: