Data Pre-Processing: - Data Cleaning - Data Integration - Data Transformation - Data Reduction - Data Discretization
Data Pre-Processing: - Data Cleaning - Data Integration - Data Transformation - Data Reduction - Data Discretization
• 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
• Data transformation
– Normalization and aggregation
• Data reduction
– Obtains reduced representation in volume but produces the same or
similar analytical results
• Data discretization
– Part of data reduction but with particular importance, especially for
numerical data
Why Data Preprocessing?
Y1
Y1’ y=x+1
X1 x
Data Integration
• Data integration:
– combines data from multiple sources into a coherent store
• Schema integration
– integrate metadata from different sources
– Entity identification problem: identify real world entities from
multiple data sources, e.g., A.cust-id B.cust-#
• 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
Handling Redundant Data
• Redundant data occur often when integration of
multiple databases
– The same attribute may have different names in different
databases
– One attribute may be a “derived” attribute in another table,
e.g., annual revenue
• Redundant data may be able to be detected by
correlational analysis
• Careful integration of the data from multiple sources
may help reduce/avoid redundancies and
inconsistencies and improve mining speed and quality
Data Transformation
• Smoothing: remove noise from data
• Aggregation: summarization, data cube construction
• Generalization: concept hierarchy climbing
• Normalization: scaled to fall within a small,
specified range
– min-max normalization
– z-score normalization
– normalization by decimal scaling
• Attribute/feature construction
– New attributes constructed from the given ones
Data Transformation:
Normalization
• min-max normalization
v minA
v' (new _ maxA new _ minA) new _ minA
maxA minA
• z-score normalization
v meanA
v'
stand _ devA
• normalization by decimal scaling
v
v' j Where j is the smallest integer such that Max(| v ' |)<1
10
Data Reduction Strategies
• Warehouse may store terabytes of data: Complex data
analysis/mining may take a very long time to run on the
complete data set
• 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
– Numerosity reduction
– Discretization and concept hierarchy generation
Dimensionality Reduction
• Feature selection (i.e., attribute subset selection):
– Select a minimum set of features such that the probability
distribution of different classes given the values for those
features is as close as possible to the original distribution
given the values of all features
– reduce # of patterns in the patterns, easier to understand
• Heuristic methods (due to exponential # of choices):
– step-wise forward selection
– step-wise backward elimination
– combining forward selection and backward elimination
– decision-tree induction
Example of Decision Tree Induction
A1? A6?
Original Data
Approximated
Numerosity Reduction
• Parametric methods
– Assume the data fits some model, estimate model
parameters, store only the parameters, and discard the data
(except possible outliers)
– 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
• Related to quantization 0
10000 30000 50000 70000 90000
problems.
Clustering
• Partition data set into clusters, and one can
store cluster representation 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
Sampling
• Allow a mining algorithm to run in complexity that is
potentially sub-linear to the size of the data
• 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
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
Discretization
• Three types of attributes:
– Nominal — values from an unordered set
– Ordinal — values from an ordered set
– Continuous — real numbers
• Discretization:
divide the range of a continuous attribute into intervals
– 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
• Binning (see sections before)
• Entropy-based discretization
(-$1,000 - $2,000)
Step 3:
(-$4000 -$5,000)
Step 4:
income
Supervised Unsupervised
Learning Learning
debt debt
* +
* +
* o o o + + + +
* o o + + +
* ** * o + ++ + +
* o + +
* * o o +++ +
o +
income
income
• Associations
– relationship between attributes (recurring patterns)
• Dependency Modelling
– Deriving causal structure within the data
• Change and Deviation Detection
– These methods accounts for sequence information (time-series
in financial applications pr protein sequencing in genome
mapping)
– Finding frequent sequences in database is feasible given
sparseness in real-world transactional database
Basic Components of Data Mining Algorithms
• Model Representation (Knowledge Representation) :
– the language for describing discoverable patterns / knowledge
• (e.g. decision tree, rules, neural network)
• Model Evaluation:
– estimating the predictive accuracy of the derived patterns
• Search Methods:
– Parameter Search : when the structure of a model is fixed, search for
the parameters which optimise the model evaluation criteria (e.g.
backpropagation in NN)
– Model Search: when the structure of the model(s) is unknown, find
the model(s) from a model class
• Learning Bias
– Feature selection
– Pruning algorithm
Predictive Modelling (Classification)
• Task: determine which of a fixed set of classes an example belongs to
• Input: training set of examples annotated with class values.
• Output:induced hypotheses (model/concept description/classifiers)
Learning : Induce classifiers from training data
Inductive
Training Learning Classifiers
Data: System (Derived Hypotheses)
Outlook
Tree_Generation (examples) =
IF termination_condition (examples)
THEN leaf ( majority_class (examples) )
ELSE
LET
Best_test = selection_function (examples)
IN
FOR EACH value v OF Best_test
Let subtree_v = Tree_Generation ({ e example| e.Best_test = v )
IN Node (Best_test, subtree_v )
Definition :
selection: used to partition training data
termination condition: determines when to stop partitioning
pruning algorithm: attempts to prevent overfitting
Selection Measure : the Critical Step
The basic approach to select a attribute is to examine each attribute and evaluate its
likelihood for improving the overall decision performance of the tree.
The most widely used node-splitting evaluation functions work by reducing the degree
of randomness or ‘impurity” in the current node:
c
Entropy function (C4.5): E (n) pi (c ci | n) log 2 pi (c ci | n)
Information gain : i 1
nv
G (n, A) E (n)
vValue( A ) n
E (nv )
• ID3 and C4.5 branch on every value and use an entropy minimisation heuristic to
select best attribute.
• CART branches on all values or one value only, uses entropy minimisation or gini
function.
Outlook