DataMining S
DataMining S
Reference Book:
Jiawei Han and Micheline Kamber
Data Mining: Concepts and Techniques
Why Data Mining?
The Evolution of Database System Technology
Evolution of Database Technology
• 1960s:
• Data collection, database creation, IMS and network DBMS
• 1970s:
• Relational data model, relational DBMS implementation
• 1980s:
• RDBMS, advanced data models (extended-relational, OO, deductive, etc.)
• Application-oriented DBMS (spatial, scientific, engineering, etc.)
• 1990s:
• Data mining, data warehousing, multimedia databases, and Web databases
• 2000s
• Stream data management and mining
• Data mining and its applications
• Web technology (XML, data integration) and global information systems
We are data rich but information
poor
What is Data Mining?
What Is Data Mining?
• Alternative names
• Knowledge discovery (mining) in databases (KDD), knowledge
extraction, data/pattern analysis, data archeology, data dredging,
information harvesting, business intelligence, etc.
• Watch out: Is everything “data mining”?
• Simple search and query processing
• (Deductive) expert systems
Data mining-Searching for knowledge
(interesting patterns) in your data
Data mining as a step in the process of
knowledge discovery
Architecture of a typical data mining
system
Data Mining and Business Intelligence
Increasing potential
to support
business decisions End User
Decision
Making
Data Exploration
Statistical Summary, Querying, and Reporting
Database
Technology Statistics
Machine Visualization
Data Mining
Learning
Pattern
Recognition Other
Algorithm Disciplines
Why Not Traditional Data Analysis?
• Tremendous amount of data
• Algorithms must be highly scalable to handle such as tera-bytes of
data
• High-dimensionality of data
• Micro-array may have tens of thousands of dimensions
• High complexity of data
• Data streams and sensor data
• Time-series data, temporal data, sequence data
• Structure data, graphs, social networks and multi-linked data
• Heterogeneous databases and legacy databases
• Spatial, spatiotemporal, multimedia, text and Web data
• Software programs, scientific simulations
• New and sophisticated applications
16
• General functionality
• Descriptive data mining
• Object-relational databases
• Multimedia database
• Text databases
• BIRCH
• Hierarchical
• k-means
• Expectation-maximization (EM)
• DBSCAN OPTICS
• Mean-shift
Dimensionality reduction
• Factor analysis
• CCA
• ICA
• LDA
• NMF
• PCA
• t-SNE
• Structured prediction
• Graphical models (Bayes Net, CRF, HMM)
• Anomaly detection
• k-NN
• Local outlier factor
• Neural nets
• Autoencoder
• Deep learning
• Multilayer perceptron
• RNN
• Restricted Boltzmann machine
• SOM
• Theory
• Bias-variance dilemma
• Computational learning theory
• Empirical risk minimization
• PAC learning
• Statistical learning
• VC theory
Thank you very much for your attention
Data Preprocessing
• Data cleaning
• Data reduction
• Summary
Why Data Preprocessing?
• Data in the real world is dirty
• incomplete: lacking attribute values, lacking certain attributes of
interest, or containing only aggregate data
• e.g., occupation=“ ”
• noisy: containing errors or outliers
• e.g., Salary=“-10”
• inconsistent: containing discrepancies in codes or names
• e.g., Age=“42” Birthday=“03/07/1997”
• e.g., Was rating “1,2,3”, now rating “A, B, C”
• e.g., discrepancy between duplicate records
Why Is Data Dirty?
• Incomplete data may come from
• “Not applicable” data value when collected
• Different considerations between the time when the data was
collected and when it is analyzed.
• Human/hardware/software problems
• Noisy data (incorrect values) may come from
• Faulty data collection instruments
• Human or computer error at data entry
• Errors in data transmission
• Inconsistent data may come from
• Different data sources
• Functional dependency violation (e.g., modify some linked data)
• Duplicate records also need data cleaning
Why Is Data Preprocessing Important?
• 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
Forms of Data Preprocessing
Chapter 2: Data Preprocessing
• Data cleaning
• Data reduction
• Summary
October 15, 2023 Data Mining: Concepts and Techniques 36
• Motivation
• To better understand the data: central tendency, variation and
spread
• Data dispersion characteristics
• median, max, min, quantiles, outliers, variance, etc.
• Numerical dimensions correspond to sorted intervals
• Data dispersion: analyzed with multiple granularities of precision
• Boxplot or quantile analysis on sorted intervals
• Dispersion analysis on computed measures
• Folding measures into numerical dimensions
• Boxplot or quantile analysis on the transformed cube
Measuring the Central Tendency
1 n x
• Mean (algebraic measure) (sample vs. population): x xi
n i 1 N
n
• Weighted arithmetic mean: w x i i
x i 1
• Trimmed mean: chopping extreme values n
w
i 1
i
n n n
1 1 1
2
s2 ( xi x ) 2
[ xi ( xi ]
) 2
n 1 i 1 n 1 i 1 n i 1
Histogram Analysis
Quantile Plot
• Displays all of the data (allowing the user to assess both
the overall behavior and unusual occurrences)
• Plots quantile information
• For a data xi data sorted in increasing order, fi indicates
that approximately 100 fi% of the data are below or equal
to the value xi
October 15, 2023 Data Mining: Concepts and Techniques 45
Scatter plot
• Provides a first look at bivariate data to see clusters of
points, outliers, etc
• Each pair of values is treated as a pair of coordinates and
plotted as points in the plane
October 15, 2023 Data Mining: Concepts and Techniques 47
Loess Curve
• Adds a smooth curve to a scatter plot in order to provide
better perception of the pattern of dependence
• Loess curve is fitted by setting two parameters: a
smoothing parameter, and the degree of the polynomials
that are fitted by the regression
Positively and Negatively Correlated Data
• Data cleaning
• Data reduction
• Summary
October 15, 2023 Data Mining: Concepts and Techniques 52
Data Cleaning
• Importance
• “Data cleaning is one of the three biggest problems in
data warehousing”—Ralph Kimball
• “Data cleaning is the number one problem in data
warehousing”—DCI survey
• Data cleaning tasks
Missing Data
• 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
October 15, 2023 Data Mining: Concepts and Techniques 55
Noisy Data
• Noise: random error or variance in a measured variable
• Incorrect attribute values may due to
• faulty data collection instruments
• data entry problems
• data transmission problems
• technology limitation
• inconsistency in naming convention
• Other data problems which requires data cleaning
• duplicate records
• incomplete data
• inconsistent data
October 15, 2023 Data Mining: Concepts and Techniques 56
• if A and B are the lowest and highest values of the attribute, the width
Regression
y
Y1
Y1’ y=x+1
X1 x
October 15, 2023 Data Mining: Concepts and Techniques 60
Cluster Analysis
October 15, 2023 Data Mining: Concepts and Techniques 61
• Data cleaning
• Data reduction
• Summary
October 15, 2023 Data Mining: Concepts and Techniques 63
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
October 15, 2023 Data Mining: Concepts and Techniques 64
rA, B
( A A)( B B) ( AB) n AB
(n 1)AB (n 1)AB
• Χ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
• 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
Data Transformation
73,600 54,000
• Ex. Let μ = 54,000, σ = 16,000. Then 1.225
16,000
• Normalization by decimal scaling
v
v' j Where j is the smallest integer such that Max(|ν’|) < 1
10
October 15, 2023 Data Mining: Concepts and Techniques 69
October 15, 2023 Data Mining: Concepts and Techniques 70
• Data cleaning
• Data reduction
• Summary
October 15, 2023 Data Mining: Concepts and Techniques 71
A4 ?
A1? A6?
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
October 15, 2023 Data Mining: Concepts and Techniques 77
Data Compression
lossless
sy
los
Original Data
Approximated
October 15, 2023 Data Mining: Concepts and Techniques 78
Dimensionality Reduction:
Wavelet Transformation
Haar2 Daubechie4
• Discrete wavelet transform (DWT): linear signal processing,
multi-resolutional analysis
• Compressed approximation: store only a small fraction of
the strongest of the wavelet coefficients
• Similar to discrete Fourier transform (DFT), but better lossy
compression, localized in space
• Method:
• Length, L, must be an integer power of 2 (padding with 0’s, when
necessary)
• Each transform has 2 functions: smoothing, difference
• Applies to pairs of data, resulting in two set of data of length L/2
• Applies two functions recursively, until reaches the desired length
DWT for Image Compression
• Image
X2
Y1
Y2
X1
October 15, 2023 Data Mining: Concepts and Techniques 82
Numerosity Reduction
• Reduce data volume by choosing alternative, smaller
forms of data representation
• Parametric methods
• Assume the data fits some model, estimate model
parameters, store only the parameters, and discard the
data (except possible outliers)
• Example: 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
October 15, 2023 Data Mining: Concepts and Techniques 83
Data Reduction Method (1):
Regression and Log-Linear Models
probability distributions
Regress Analysis and Log-Linear
Models
• Linear regression: Y = w X + b
• Two regression coefficients, w and b, 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
October 15, 2023 Data Mining: Concepts and Techniques 85
• Partition data set into clusters based on similarity, and store cluster
algorithms
• Cluster analysis will be studied in depth in Chapter 7
October 15, 2023 Data Mining: Concepts and Techniques 87
R S WOR ndom
S le ra hout
i m p
(s
p l e wit
sam ment)
e p l a ce
r
SRSW
R
Raw Data
October 15, 2023 Data Mining: Concepts and Techniques 89
• Data cleaning
• Data reduction
• Summary
October 15, 2023 Data Mining: Concepts and Techniques 91
Discretization
• Three types of attributes:
rank
• Continuous — real numbers, e.g., integer or real numbers
• Discretization:
Entropy-Based Discretization
• Given a set of samples S, if S is partitioned into two intervals S 1 and S2
using boundary T, the information gain after partitioning is
| S1 | |S |
I (S , T ) Entropy ( S 1) 2 Entropy ( S 2)
|S| |S|
• Entropy is calculated based on class distribution of the samples in the
set. Given m classes, the entropy of Sm1 is
Entropy ( S1 ) pi log 2 ( pi )
i 1
• Merge: Find the best neighboring intervals and merge them to form larger
intervals recursively
• ChiMerge [Kerber AAAI 1992, See also Liu et al. DMKD 2002]
• Adjacent intervals with the least 2 values are merged together, since
low 2 values for a pair indicate similar class distributions
• This merge process proceeds recursively until a predefined stopping
criterion is met (such as significance level, max-interval, max
inconsistency, etc.)
October 15, 2023 Data Mining: Concepts and Techniques 96
(-$1,000 - $2,000)
Step 3:
(-$400 -$5,000)
Step 4:
• Data cleaning
• Data reduction
• Summary
Summary
• Data preparation or preprocessing is a big issue for both
data warehousing and data mining
• Discriptive data summarization is need for quality data
preprocessing
• Data preparation includes
• Data cleaning and data integration
• Data reduction and feature selection
• Discretization
• A lot a methods have been developed but data
preprocessing still an active area of research
References
• D. P. Ballou and G. K. Tayi. Enhancing data quality in data warehouse environments.
Communications of ACM, 42:73-78, 1999
• T. Dasu and T. Johnson. Exploratory Data Mining and Data Cleaning. John Wiley & Sons, 2003
• T. Dasu, T. Johnson, S. Muthukrishnan, V. Shkapenyuk.
Mining Database Structure; Or, How to Build a Data Quality Browser. SIGMOD’02.
• H.V. Jagadish et al., Special Issue on Data Reduction Techniques. Bulletin of the Technical
Committee on Data Engineering, 20(4), December 1997
• D. Pyle. Data Preparation for Data Mining. Morgan Kaufmann, 1999
• 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
• V. Raman and J. Hellerstein. Potters Wheel: An Interactive Framework for Data Cleaning and
Transformation, VLDB’2001
• T. Redman. Data Quality: Management and Technology. Bantam Books, 1992
• Y. Wand and R. Wang. Anchoring data quality dimensions ontological foundations. Communications
of ACM, 39:86-95, 1996
• 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
October 15, 2023 Data Mining: Concepts and Techniques 103