Spatial and Temporal Data Mining
Spatial and Temporal Data Mining
Mining
Vasileios Megalooikonomou
Classifier
Testing
Data Unseen Data
(Jeff, Professor, 4)
NAM E RANK YEARS TENURED
Tom Assistant Prof 2 no Tenured?
M erlisa Associate Prof 7 no
G eorge Professor 5 yes
Joseph Assistant Prof 7 yes
Supervised vs. Unsupervised
Learning
• Supervised learning (classification)
– Supervision: The training data (observations,
measurements, etc.) are accompanied by labels indicating
the class of the observations
– New data is classified based on the training set
• Unsupervised learning (clustering)
– The class labels of training data is unknown
– Given a set of measurements, observations, etc. the aim is
to establish the existence of classes or clusters in the data
Agenda
• What is classification? What is prediction?
• Issues regarding classification and prediction
• Classification by decision tree induction
• Bayesian Classification
• Classification by backpropagation
• Classification based on concepts from association
rule mining
• Other Classification Methods
• Prediction
• Classification accuracy
• Summary
Issues regarding classification and
prediction: Data Preparation
• Data cleaning
– Preprocess data in order to reduce noise and handle missing
values
• Relevance analysis (feature selection)
– Remove the irrelevant or redundant attributes
• Data transformation
– Generalize and/or normalize data
Issues regarding classification and prediction:
Evaluating Classification Methods
• Predictive accuracy
• Speed and scalability
– time to construct the model
– time to use the model
– efficiency in disk-resident databases
• Robustness
– handling noise and missing values
• Interpretability:
– understanding and insight provided by the model
• Goodness of rules
– decision tree size
– compactness of classification rules
Agenda
• What is classification? What is prediction?
• Issues regarding classification and prediction
• Classification by decision tree induction
• Bayesian Classification
• Classification by backpropagation
• Classification based on concepts from association
rule mining
• Other Classification Methods
• Prediction
• Classification accuracy
• Summary
Classification by Decision Tree
Induction
• Decision trees basics (covered earlier)
• Attribute selection measure:
– Information gain (ID3/C4.5)
• All attributes are assumed to be categorical
• Can be modified for continuous-valued attributes
– Gini index (IBM IntelligentMiner)
• All attributes are assumed continuous-valued
• Assume there exist several possible split values for each attribute
• May need other tools, such as clustering, to get the possible split
values
• Can be modified for categorical attributes
• Avoid overfitting
• Extract classification rules from trees
Gini Index (IBM IntelligentMiner)
• If a data set T contains examples from n classes, gini
n 2
index, gini(T) is defined as gini(T ) =1− ∑ p j
j =1
where pj is the relative frequency of class j in T.
• If a data set T is split into two subsets T1 and T2 with
sizes N1 and N2 respectively, the gini index of the split
data contains examples from n classes, the gini index
gini(T) is defined as gini split (T ) = N 1 gini(T 1) + N 2 gini(T 2)
N N
O utlook P N H um idity P N
sunny 2/9 3/5 high 3/9 4/5
overcast 4/9 0 norm al 6/9 1/5
rain 3/9 2/5
Tem preature W indy
hot 2/9 2/5 true 3/9 3/5
m ild 4/9 2/5 false 6/9 2/5
cool 3/9 1/5
Bayesian classification
• The classification problem may be formalized
using a-posteriori probabilities:
• P(C|X) = prob. that the sample tuple
X=<x1,…,xk> is of class C.
• P(X|p)·P(p) =
P(rain|p)·P(hot|p)·P(high|p)·P(false|p)·P(p) =
3/9·2/9·3/9·6/9·9/14 = 0.010582
• P(X|n)·P(n) =
P(rain|n)·P(hot|n)·P(high|n)·P(false|n)·P(n) =
2/5·2/5·4/5·2/5·5/14 = 0.018286
Output vector
Err j = O j (1 − O j )∑ Errk w jk
Output nodes k
θ j = θ j + (l) Err j
wij = wij + (l ) Err j Oi
Hidden nodes Err j = O j (1 − O j )(T j − O j )
wij 1
Oj = −I j
1+ e
Input nodes
I j = ∑ wij Oi + θ j
i
Input vector: xi
Network Pruning and Rule Extraction
• Network pruning
– Fully connected network will be hard to articulate
– N input nodes, h hidden nodes and m output nodes lead to h(m+N)
weights
– Pruning: Remove some of the links without affecting classification
accuracy of the network
• Extracting rules from a trained network
– Discretize activation values; replace individual activation value by the
cluster average maintaining the network accuracy
– Enumerate the output from the discretized activation values to find rules
between activation value and output
– Find the relationship between the input and activation value
– Combine the above two to have rules relating the output to input
• Perform sensitivity analysis
–
Agenda
• What is classification? What is prediction?
• Issues regarding classification and prediction
• Classification by decision tree induction
• Bayesian Classification
• Classification by backpropagation
• Support Vector Machines
• Classification based on concepts from association
rule mining
• Other Classification Methods
• Prediction
• Classification accuracy
• Summary
SVM—Support Vector Machines
• A new classification method for both linear and nonlinear data
• It uses a nonlinear mapping to transform the original training
data into a higher dimension
• With the new dimension, it searches for the linear optimal
separating hyperplane (i.e., “decision boundary”)
• With an appropriate nonlinear mapping to a sufficiently high
dimension, data from two classes can always be separated by a
hyperplane
• SVM finds this hyperplane using support vectors (“essential”
training tuples) and margins (defined by the support vectors)
SVM—History and Applications
• Vapnik and colleagues (1992)—groundwork from Vapnik &
Chervonenkis’ statistical learning theory in 1960s
• Features: training can be slow but accuracy is high owing to
their ability to model complex nonlinear decision boundaries
(margin maximization)
• Used both for classification and prediction
• Applications:
– handwritten digit recognition, object recognition, speaker identification,
benchmarking time-series prediction tests
SVM—General Philosophy
Let data D be (X1, y1), …, (X|D|, y|D|), where Xi is the set of training
tuples associated with the class labels yi
There are infinite lines (hyperplanes) separating the two classes but
we want to find the best one (the one that minimizes classification
error on unseen data)
SVM searches for the hyperplane with the largest margin, i.e.,
maximum marginal hyperplane (MMH)
SVM—Linearly Separable
• A separating hyperplane can be written as
W●X+b=0
where W={w1, w2, …, wn} is a weight vector and b a scalar (bias)
• For 2-D it can be written as
w0 + w1 x1 + w2 x2 = 0
• The hyperplane defining the sides of the margin:
H1: w0 + w1 x1 + w2 x2 ≥ 1 for yi = +1, and
H2: w0 + w1 x1 + w2 x2 ≤ – 1 for yi = –1
SVM—Linearly Inseparable
• Transform the original input data into a higher A 1
dimensional space
• SVM can also be used for classifying multiple (> 2) classes and
for regression analysis (with additional user parameters)
Scaling SVM by Hierarchical MicroClustering
• SVM is not scalable to the number of data objects in
terms of training time and memory usage
• “Classifying Large Datasets Using SVMs with
Hierarchical Clusters Problem” by Hwanjo Yu, Jiong
Yang, Jiawei Han, KDD’03
• CB-SVM (Clustering-Based SVM)
– Given limited amount of system resources (e.g., memory),
maximize the SVM performance in terms of accuracy and the
training speed
– Use micro-clustering to effectively reduce the number of points to
be considered
– At deriving support vectors, de-cluster micro-clusters near
“candidate vector” to ensure high classification accuracy
CB-SVM: Clustering-Based SVM
• Training data sets may not even fit in memory
• Read the data set once (minimizing disk access)
– Construct a statistical summary of the data (i.e., hierarchical clusters)
given a limited amount of memory
– The statistical summary maximizes the benefit of learning SVM
• Representative implementations
– LIBSVM: an efficient implementation of SVM, multi-class
classifications, nu-SVM, one-class SVM, including also various
interfaces with java, python, etc.
∑
s
( xi − x )( yi − y )
β= i =1
s
, α = y−β x
∑ i
( x
i =1
− x ) 2
Regress Analysis and Log-Linear
Models in Prediction
•Multiple regression: Y = a + b1 X1 + b2 X2.
–More than one predictor variable
–Many nonlinear functions can be transformed into the
above.
•Nonlinear regression: Y = a + b1 X + b2 X2 + b3 X3.
•Log-linear models:
–They approximate discrete multidimensional probability
distributions (multi-way table of joint probabilities) by a
product of lower-order tables.
–Probability: p(a, b, c, d) = αab βacχad δbcd
Locally Weighted Regression
• Construct an explicit approximation to f over a local
region surrounding query instance xq.
• Locally weighted linear regression:
– The target function f is approximated near xq using the linear
function: f ( x) = w + w a ( x)++wnan ( x)
0 1 1
– minimize the squared error: distance-decreasing weight K
E ( xq ) ≡ 1 ∑ ( f ( x) − f ( x))2 K (d ( xq , x))
2 x∈k _nearest _neighbors_of _ x
q
– the gradient descent training rule:
∆w j ≡ η ∑ K (d ( xq , x))(( f ( x) − f ( x))a j ( x)
x ∈k _ nearest _ neighbors_ of _ xq
• In most cases, the target function is approximated by a
constant, linear, or quadratic function.
Prediction: Numerical Data
Prediction: Categorical Data
Agenda
• What is classification? What is prediction?
• Issues regarding classification and prediction
• Classification by decision tree induction
• Bayesian Classification
• Classification by backpropagation
• Classification based on concepts from association
rule mining
• Other Classification Methods
• Prediction
• Classification accuracy
• Summary
Classifier Accuracy C1 C2
C1 True positive False negative
Measures C2 False positive True negative
i =1
– Mean absolute error: d Mean squared error: d
d
d
∑| y
i =1
i −yi ' | ∑ ( yi − yi ' ) 2
i =1
d
• Ensemble methods
– Use a combination of models to increase accuracy
– Combine a series of k learned models, M1, M2, …, Mk, with
the aim of creating an improved model M*
• Popular ensemble methods
– Bagging: averaging the prediction over a collection of
classifiers
– Boosting: weighted vote with a collection of classifiers
– Ensemble: combining a set of heterogeneous classifiers
Bagging: Boostrap Aggregation
• Analogy: Diagnosis based on multiple doctors’ majority vote
• Training
– Given a set D of d tuples, at each iteration i, a training set Di of d tuples is
sampled with replacement from D (i.e., boostrap)
– A classifier model Mi is learned for each training set Di
• Classification: classify an unknown sample X
– Each classifier Mi returns its class prediction
– The bagged classifier M* counts the votes and assigns the class with the
most votes to X
• Prediction: can be applied to the prediction of continuous values
by taking the average value of each prediction for a given test
tuple
• Accuracy
– Often significant better than a single classifier derived from D
– For noise data: not considerably worse, more robust
Boosting
• Analogy: Consult several doctors, based on a combination of weighted
diagnoses—weight assigned based on the previous diagnosis accuracy
• How boosting works?
– Weights are assigned to each training tuple
– A series of k classifiers is iteratively learned
– After a classifier Mi is learned, the weights are updated to allow the subsequent
classifier, Mi+1, to pay more attention to the training tuples that were misclassified
by Mi
– The final M* combines the votes of each individual classifier, where the weight of
each classifier's vote is a function of its accuracy
• The boosting algorithm can be extended for the prediction of continuous
values
• Comparing with bagging: boosting tends to achieve greater accuracy, but it
also risks overfitting the model to misclassified data
Adaboost (Freund and Schapire, 1997)
• Given a set of d class-labeled tuples, (X1, y1), …, (Xd, yd)
• Initially, all the weights of tuples are set the same (1/d)
• Generate k classifiers in k rounds. At round i,
– Tuples from D are sampled (with replacement) to form a
training set Di of the same size
– Each tuple’s chance of being selected is based on its weight
– A classification model Mi is derived from Di
– Its error rate is calculated using Di as a test set
– If a tuple is misclassified, its weight is increased, o.w. it is
decreased
• Error rate: err(Xj) is the misclassification error of tuple
Xj. Classifier Mi error rate is the sum of the weights of
the misclassified tuples: d
error ( M i ) = ∑w j × err ( X j )
j
1 − error ( M i )
log
error ( M i )
• The weight of classifier M ’s vote is
Model Selection: ROC Curves
• ROC (Receiver Operating Characteristics)
curves: for visual comparison of
classification models
• Originated from signal detection theory
• Shows the trade-off between the true
positive rate and the false positive rate
• The area under the ROC curve is a
measure of the accuracy of the model
• Rank the test tuples in decreasing order: • Vertical axis: true positive rate
the one that is most likely to belong to the • Horizontal axis: false positive
positive class appears at the top of the list rate
• The closer to the diagonal line (i.e., the • Diagonal line?
closer the area is to 0.5), the less accurate • A model with perfect accuracy:
is the model area of 1.0
Agenda
• What is classification? What is prediction?
• Issues regarding classification and prediction
• Classification by decision tree induction
• Bayesian Classification
• Classification by backpropagation
• Classification based on concepts from association
rule mining
• Other Classification Methods
• Prediction
• Classification accuracy
• Summary
Summary (I)
• Classification and prediction are two forms of data analysis that can be used
to extract models describing important data classes or to predict future data
trends.
• Effective and scalable methods have been developed for decision trees
induction, Naive Bayesian classification, Bayesian belief network, rule-
based classifier, Backpropagation, Support Vector Machine (SVM),
associative classification, nearest neighbor classifiers, and case-based
reasoning, and other classification methods such as genetic algorithms,
rough set and fuzzy set approaches.
• Linear, nonlinear, and generalized linear models of regression can be used
for prediction. Many nonlinear problems can be converted to linear
problems by performing transformations on the predictor variables.
Regression trees and model trees are also used for prediction.
Summary (II)
• Stratified k-fold cross-validation is a recommended method for accuracy
estimation. Bagging and boosting can be used to increase overall accuracy by
learning and combining a series of individual models.
• Significance tests and ROC curves are useful for model selection
• There have been numerous comparisons of the different classification and
prediction methods, and the matter remains a research topic
• No single method has been found to be superior over all others for all data
sets
• Issues such as accuracy, training time, robustness, interpretability, and
scalability must be considered and can involve trade-offs, further
complicating the quest for an overall superior method
References (1)
• C. Apte and S. Weiss. Data mining with decision trees and decision rules. Future Generation Computer Systems, 13, 1997.
• C. M. Bishop, Neural Networks for Pattern Recognition. Oxford University Press, 1995.
• L. Breiman, J. Friedman, R. Olshen, and C. Stone. Classification and Regression Trees. Wadsworth International Group, 1984.
• C. J. C. Burges. A Tutorial on Support Vector Machines for Pattern Recognition. Data Mining and Knowledge Discovery, 2(2): 121-168,
1998.
• P. K. Chan and S. J. Stolfo. Learning arbiter and combiner trees from partitioned data for scaling machine learning. KDD'95.
• W. Cohen. Fast effective rule induction. ICML'95.
• G. Cong, K.-L. Tan, A. K. H. Tung, and X. Xu. Mining top-k covering rule groups for gene expression data. SIGMOD'05.
• A. J. Dobson. An Introduction to Generalized Linear Models. Chapman and Hall, 1990.
• G. Dong and J. Li. Efficient mining of emerging patterns: Discovering trends and differences. KDD'99.
• R. O. Duda, P. E. Hart, and D. G. Stork. Pattern Classification, 2ed. John Wiley and Sons, 2001
• U. M. Fayyad. Branching on attribute values in decision tree generation. AAAI’94.
• Y. Freund and R. E. Schapire. A decision-theoretic generalization of on-line learning and an application to boosting. J. Computer and
System Sciences, 1997.
• J. Gehrke, R. Ramakrishnan, and V. Ganti. Rainforest: A framework for fast decision tree construction of large datasets. VLDB’98.
• J. Gehrke, V. Gant, R. Ramakrishnan, and W.-Y. Loh, BOAT -- Optimistic Decision Tree Construction. SIGMOD'99.
• T. Hastie, R. Tibshirani, and J. Friedman. The Elements of Statistical Learning: Data Mining, Inference, and Prediction. Springer-Verlag,
2001.
• D. Heckerman, D. Geiger, and D. M. Chickering. Learning Bayesian networks: The combination of knowledge and statistical data.
Machine Learning, 1995.
• M. Kamber, L. Winstone, W. Gong, S. Cheng, and J. Han. Generalization and decision tree induction: Efficient classification in data
mining. RIDE'97.
• B. Liu, W. Hsu, and Y. Ma. Integrating Classification and Association Rule. KDD'98.
• W. Li, J. Han, and J. Pei, CMAR: Accurate and Efficient Classification Based on Multiple Class-Association Rules, ICDM'01.
References (2)
• T.-S. Lim, W.-Y. Loh, and Y.-S. Shih. A comparison of prediction accuracy, complexity, and training time of thirty-three old and new
classification algorithms. Machine Learning, 2000.
• J. Magidson. The Chaid approach to segmentation modeling: Chi-squared automatic interaction detection. In R. P. Bagozzi, editor,
Advanced Methods of Marketing Research, Blackwell Business, 1994.
• M. Mehta, R. Agrawal, and J. Rissanen. SLIQ : A fast scalable classifier for data mining. EDBT'96.
• T. M. Mitchell. Machine Learning. McGraw Hill, 1997.
• S. K. Murthy, Automatic Construction of Decision Trees from Data: A Multi-Disciplinary Survey, Data Mining and Knowledge
Discovery 2(4): 345-389, 1998
• J. R. Quinlan. Induction of decision trees. Machine Learning, 1:81-106, 1986.
• J. R. Quinlan and R. M. Cameron-Jones. FOIL: A midterm report. ECML’93.
• J. R. Quinlan. C4.5: Programs for Machine Learning. Morgan Kaufmann, 1993.
• J. R. Quinlan. Bagging, boosting, and c4.5. AAAI'96.
• R. Rastogi and K. Shim. Public: A decision tree classifier that integrates building and pruning. VLDB’98.
• J. Shafer, R. Agrawal, and M. Mehta. SPRINT : A scalable parallel classifier for data mining. VLDB’96.
• J. W. Shavlik and T. G. Dietterich. Readings in Machine Learning. Morgan Kaufmann, 1990.
• P. Tan, M. Steinbach, and V. Kumar. Introduction to Data Mining. Addison Wesley, 2005.
• S. M. Weiss and C. A. Kulikowski. Computer Systems that Learn: Classification and Prediction Methods from Statistics, Neural Nets,
Machine Learning, and Expert Systems. Morgan Kaufman, 1991.
• S. M. Weiss and N. Indurkhya. Predictive Data Mining. Morgan Kaufmann, 1997.
• I. H. Witten and E. Frank. Data Mining: Practical Machine Learning Tools and Techniques, 2ed. Morgan Kaufmann, 2005.
• X. Yin and J. Han. CPAR: Classification based on predictive association rules. SDM'03
• H. Yu, J. Yang, and J. Han. Classifying large data sets using SVM with hierarchical clusters. KDD'03.