CIVIL-557
Decision Aid Methodologies In Transportation
Transport and Mobility Laboratory TRANSP-OR École Polytechnique Fédérale de Lausanne EPFL
Decision Aid Methodologies In Transportation Lecture 10: Data - - PowerPoint PPT Presentation
CIVIL-557 Decision Aid Methodologies In Transportation Lecture 10: Data Mining in Transport Introduction & Clustering Nikola Obrenovic Transport and Mobility Laboratory TRANSP-OR cole Polytechnique Fdrale de Lausanne EPFL
Transport and Mobility Laboratory TRANSP-OR École Polytechnique Fédérale de Lausanne EPFL
slides accompanying the book: P.-N. Tan, M. Steinbach, A. Karpatne,
Introduction to Data Mining (2nd Edition)
§ There has been enormous data growth in both commercial and scientific databases due to advances in data generation and collection technologies § Frequent strategy
§ Gather whatever data you can whenever and wherever possible.
§ Expectations
§ Gathered data will have value either for the purpose collected or for a purpose not envisioned.
Computational Simulations
Social Networking: Twitter
Sensor Networks Traffic Patterns Cyber Security E-Commerce
Tid Refund Marital Status Taxable Income Cheat 1 Yes Single 125K No 2 No Married 100K No 3 No Single 70K No 4 Yes Married 120K No 5 No Divorced 95K Yes 6 No Married 60K No 7 Yes Divorced 220K No 8 No Single 85K Yes 9 No Married 75K No 10 No Single 90K Yes 11 No Married 60K No 12 Yes Divorced 220K No 13 No Single 85K Yes 14 No Married 75K No 15 No Single 90K Yes
10P r e d i c t i v e M
e l i n g Clustering Association Rules A n
a l y D e t e c t i
Milk
Inter-cluster distances are maximized Intra-cluster distances are minimized
How many clusters? Four Clusters Two Clusters Six Clusters
Original Points A Partitional Clustering
p4 p1 p3 p2 p4 p1 p3 p2
p4 p1 p2 p3 p4 p1 p2 p3 Standard Hierarchical Clustering Binary Hierarchical Clustering Binary Dendrogram Standard Dendrogram
between 0 and 1
3 well-separated clusters
4 center-based clusters
8 contiguous clusters
6 density-based clusters
0.5 1 1.5 2 0.5 1 1.5 2 2.5 3
x y
0.5 1 1.5 2 0.5 1 1.5 2 2.5 3
x y
0.5 1 1.5 2 0.5 1 1.5 2 2.5 3
x y
0.5 1 1.5 2 0.5 1 1.5 2 2.5 3
x y
0.5 1 1.5 2 0.5 1 1.5 2 2.5 3
x y
0.5 1 1.5 2 0.5 1 1.5 2 2.5 3
x y
0.5 1 1.5 2 0.5 1 1.5 2 2.5 3
x y
Iteration 1
0.5 1 1.5 2 0.5 1 1.5 2 2.5 3
x y
Iteration 2
0.5 1 1.5 2 0.5 1 1.5 2 2.5 3
x y
Iteration 3
0.5 1 1.5 2 0.5 1 1.5 2 2.5 3
x y
Iteration 4
0.5 1 1.5 2 0.5 1 1.5 2 2.5 3
x y
Iteration 5
0.5 1 1.5 2 0.5 1 1.5 2 2.5 3
x y
Iteration 6
change clusters’
I = number of iterations, d = number of attributes
with higher K
= Î
K i C x i
i
1 2
0.5 1 1.5 2 0.5 1 1.5 2 2.5 3
x y
0.5 1 1.5 2 0.5 1 1.5 2 2.5 3
x y
Sub-optimal Clustering
0.5 1 1.5 2 0.5 1 1.5 2 2.5 3
x y
Optimal Clustering Original Points
Original Points K-means (3 Clusters)
Original Points K-means (3 Clusters)
Original Points K-means (2 Clusters)
Original Points K-means Clusters
One solution is to use many clusters. Find parts of clusters, but need to put together.
Original Points K-means Clusters
Original Points K-means Clusters
0.5 1 1.5 2 0.5 1 1.5 2 2.5 3
x y
Iteration 1
0.5 1 1.5 2 0.5 1 1.5 2 2.5 3
x y
Iteration 2
0.5 1 1.5 2 0.5 1 1.5 2 2.5 3
x y
Iteration 3
0.5 1 1.5 2 0.5 1 1.5 2 2.5 3
x y
Iteration 4
0.5 1 1.5 2 0.5 1 1.5 2 2.5 3
x y
Iteration 5
0.5 1 1.5 2 0.5 1 1.5 2 2.5 3
x y
Iteration 6
0.5 1 1.5 2 0.5 1 1.5 2 2.5 3
x y
Iteration 1
0.5 1 1.5 2 0.5 1 1.5 2 2.5 3
x y
Iteration 2
0.5 1 1.5 2 0.5 1 1.5 2 2.5 3
x y
Iteration 3
0.5 1 1.5 2 0.5 1 1.5 2 2.5 3
x y
Iteration 4
0.5 1 1.5 2 0.5 1 1.5 2 2.5 3
x y
Iteration 5
1. Select an initial point at random to be the first centroid 2. For k – 1 steps 3. For each of the N points, xi, 1 ≤ i ≤ N, find the minimum squared distance to the currently selected centroids, C1, …, Cj, 1 ≤ j < k, i.e.,min
$
d2( Cj, xi ) 4. Randomly select a new centroid by choosing a point with probability proportional to
%&'
( d2( Cj, xi )
∑* %&'
( d2( Cj, xi )
5. End For
6.5 9 10 15 16 18.5
7.75 12.5 17.25 6.5 9 10 15 16 18.5
6.8 13 18
Empty Cluster
1 3 2 5 4 6 0.05 0.1 0.15 0.2
1 2 3 4 5 6 1 2 3 4 5
(or k clusters) left
point (or there are k clusters)
p1 p3 p5 p4 p2 p1 p2 p3 p4 p5
. . .
. . .
Proximity Matrix
p1 p2 p3 p4 p9 p10 p11 p12
C1 C4 C2 C5 C3 C2 C1 C1 C3 C5 C4 C2 C3 C4 C5
Proximity Matrix
p1 p2 p3 p4 p9 p10 p11 p12
C1 C4 C2 C5 C3 C2 C1 C1 C3 C5 C4 C2 C3 C4 C5
Proximity Matrix
p1 p2 p3 p4 p9 p10 p11 p12
C1 C4 C2 U C5 C3 ? ? ? ? ? ? ? C2 U C5 C1 C1 C3 C4 C2 U C5 C3 C4
Proximity Matrix
p1 p2 p3 p4 p9 p10 p11 p12
p1 p3 p5 p4 p2 p1 p2 p3 p4 p5
. . . . . . Similarity?
Proximity Matrix
Nested Clusters
Original Points Six Clusters
Original Points Two Clusters
Three Clusters
Nested Clusters
1 2 3 4 5 6 1 2 5 3 4
Original Points Two Clusters
Original Points Two Clusters
| |Cluster | |Cluster ) p , p proximity( ) Cluster , Cluster proximity(
j i Cluster p Cluster p j i j i
j j i i
´ =
Î Î
| |Cluster | |Cluster ) p , p proximity( ) Cluster , Cluster proximity(
j i Cluster p Cluster p j i j i
j j i i
´ =
Î Î
Nested Clusters
1 2 3 4 5 6 1 2 5 3 4
Group Average Ward’s Method 1 2 3 4 5 6 1 2 5 3 4 MIN MAX 1 2 3 4 5 6 1 2 5 3 4 1 2 3 4 5 6 1 2 5 3 4 1 2 3 4 5 6 1 2 3 4 5
Original Points Point types: core, border and noise Eps = 10, MinPts = 4
Original Points Clusters
Original Points
(MinPts=4, Eps=9.75). (MinPts=4, Eps=9.92)
0.2 0.4 0.6 0.8 1 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
x y
Random Points
0.2 0.4 0.6 0.8 1 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
x y
K-means
0.2 0.4 0.6 0.8 1 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
x y
DBSCAN
0.2 0.4 0.6 0.8 1 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
x y
Complete Link
externally supplied class labels.
without respect to external information.
entropy
numerical measure that implements the criterion.
n(n-1) / 2 entries needs to be calculated.
0.2 0.4 0.6 0.8 1 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
x y
0.2 0.4 0.6 0.8 1 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
x y
Corr = 0.9235 Corr = 0.5810
0.2 0.4 0.6 0.8 1 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
x y Points Points
20 40 60 80 100 10 20 30 40 50 60 70 80 90 100 Similarity 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Points Points
20 40 60 80 100 10 20 30 40 50 60 70 80 90 100 Similarity 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
0.2 0.4 0.6 0.8 1 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
x y
Points Points
20 40 60 80 100 10 20 30 40 50 60 70 80 90 100 Similarity 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
0.2 0.4 0.6 0.8 1 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
x y
0.2 0.4 0.6 0.8 1 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
x y Points Points
20 40 60 80 100 10 20 30 40 50 60 70 80 90 100 Similarity 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
1 2 3 5 6 4 7
0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 500 1000 1500 2000 2500 3000 500 1000 1500 2000 2500 3000
2 5 10 15 20 25 30 1 2 3 4 5 6 7 8 9 10
K SSE
5 10 15
2 4 6
1 2 3 5 6 4 7
SSE of clusters found using K-means
Î
i C x i
i
2
i i i
2
1 2 3 4 5
m1 m2 m
10 9 1 9 ) 3 5 . 4 ( 2 ) 5 . 1 3 ( 2 1 ) 5 . 4 5 ( ) 5 . 4 4 ( ) 5 . 1 2 ( ) 5 . 1 1 (
2 2 2 2 2 2
= + = =
+
= =
= Total BSS WSS SSE
K=2 clusters:
10 10 ) 3 3 ( 4 10 ) 3 5 ( ) 3 4 ( ) 3 2 ( ) 3 1 (
2 2 2 2 2
= + = =
= =
= Total BSS WSS SSE
K=1 cluster:
and nodes outside the cluster. cohesion separation
s = (b – a) / max(a,b)
Distances used to calculate a
i
Distances used to calculate b
A Case Study on Singapore Public Train Commuter Travel Patterns, http://dx.doi.org/10.7763/ijet.2014.v6.737
DTW
engineers to design more appropriate public transport networks
industrial, commercial or retail) and commuter patterns
0.5 1 1.5 2 1 3 5 7 9 11 13 15 17 19 21 23 P/Pavg t[h]
0.5 1 1.5 2 1 3 5 7 9 11131517192123252729313335373941434547495153555759616365676971
0.5 1 1.5 2 1 3 5 7 9 11 13 15 17 19 21 23
Create DLP per each (consumer, season, day type) Clean and normalize DLPs Concatenate all DLPs of a single consumer into a single vector. 1
Dimensionality reduction - PCA Clustering - k-Means++ Best clustering configuration selection 1
4 5
/0 /
∑345
6
[ /38 ̅ / 039:8 $ 0 ] ∑345
6
(/38 ̅ /)> ∑345
6
(039:8 $ 0)>
!"# $, & = 1 − (+ ∑-./
(1234(5-)71234(8-))9 3(397:)
)
!;" $, & = !< $, & + >
4?: 37:
| $4A: − $4 − (&4A: − &4)|/∆D
Validity assessment includes two measurement criteria:
CR1 CR2 CR3 Euclidean (L2) 1.52 1.59 1.25 Cosine 2.70 2.33 2.63 Cross Correlation 1.85 1.92 1.89 Spearman 4.35 4.76 4.76 Curve Shape Dis. 1.79 1.67 1.79 CR1 CR2 CR3 Euclidean (L2) 0.70 0.72 0.70 Cosine 1.00 1.02 0.80 Cross Correlation 1.00 1.18 0.96 Spearman 1.06 1.23 1.23 Curve Shape Dis. 0.84 0.70 0.63
V
ALUES OF DB VALIDITY INDEX
V
ALUES OF SD VALIDITY INDEX
CR1 CR2 CR3 Euclidean (L2) 0.79 0.72 0.69 Cosine 0.68 0.62 0.65 Cross Correlation 1.32 1.39 1.16 Spearman 1.25 1.25 1.19 Curve Shape Dis. 0.35 0.47 0.42 CR1 CR2 CR3 Euclidean (L2) 1.56 1.33 1.43 Cosine 1.59 1.61 1.59 Cross Correlation 2.22 2.17 2.17 Spearman 2.38 2.44 2.56 Curve Shape Dis. 1.28 1.47 1
V
ALUES OF DB VALIDITY INDEX
V
ALUES OF SD VALIDITY INDEX