![Page 1: Clustering. The Problem of Clustering Given a set of points, with a notion of distance between points, group the points into some number of clusters,](https://reader038.vdocuments.site/reader038/viewer/2022103123/56649d2b5503460f94a00b39/html5/thumbnails/1.jpg)
Clustering
![Page 2: Clustering. The Problem of Clustering Given a set of points, with a notion of distance between points, group the points into some number of clusters,](https://reader038.vdocuments.site/reader038/viewer/2022103123/56649d2b5503460f94a00b39/html5/thumbnails/2.jpg)
The Problem of Clustering• Given a set of points, with a notion of distance between points,
group the points into some number of clusters, so that members of a cluster are in some sense as close to each other as possible.
Inter-cluster distances are maximized
Intra-cluster distances are
minimized
![Page 3: Clustering. The Problem of Clustering Given a set of points, with a notion of distance between points, group the points into some number of clusters,](https://reader038.vdocuments.site/reader038/viewer/2022103123/56649d2b5503460f94a00b39/html5/thumbnails/3.jpg)
A bit of history
![Page 4: Clustering. The Problem of Clustering Given a set of points, with a notion of distance between points, group the points into some number of clusters,](https://reader038.vdocuments.site/reader038/viewer/2022103123/56649d2b5503460f94a00b39/html5/thumbnails/4.jpg)
Applications of Cluster Analysis• Clustering for Understanding
– Group related documents for browsing
– Group genes and proteins that have similar functionality
– Group stocks with similar price fluctuations
– Segment customers into a small number of groups for additional analysis and marketing activities.
• Clustering for Summarization– Reduce the size of large
data sets
Discovered Clusters Industry Group
1 Applied-Matl-DOWN,Bay-Network-Down,3-COM-DOWN,
Cabletron-Sys-DOWN,CISCO-DOWN,HP-DOWN, DSC-Comm-DOWN,INTEL-DOWN,LSI-Logic-DOWN,
Micron-Tech-DOWN,Texas-Inst-Down,Tellabs-Inc-Down, Natl-Semiconduct-DOWN,Oracl-DOWN,SGI-DOWN,
Sun-DOWN
Technology1-DOWN
2 Apple-Comp-DOWN,Autodesk-DOWN,DEC-DOWN,
ADV-Micro-Device-DOWN,Andrew-Corp-DOWN, Computer-Assoc-DOWN,Circuit-City-DOWN,
Compaq-DOWN, EMC-Corp-DOWN, Gen-Inst-DOWN, Motorola-DOWN,Microsoft-DOWN,Scientific-Atl-DOWN
Technology2-DOWN
3 Fannie-Mae-DOWN,Fed-Home-Loan-DOWN, MBNA-Corp-DOWN,Morgan-Stanley-DOWN
Financial-DOWN
4 Baker-Hughes-UP,Dresser-Inds-UP,Halliburton-HLD-UP,
Louisiana-Land-UP,Phillips-Petro-UP,Unocal-UP, Schlumberger-UP
Oil-UP
Clustering precipitation in Australia
![Page 5: Clustering. The Problem of Clustering Given a set of points, with a notion of distance between points, group the points into some number of clusters,](https://reader038.vdocuments.site/reader038/viewer/2022103123/56649d2b5503460f94a00b39/html5/thumbnails/5.jpg)
ExamplesDocuments
• Represent a document by a vector (x1, x2,…, xk), where xi = 1 iff the i th word of a vocabulary appears in the document.
• Documents with similar sets of words may be about the same topic.
DNAs
• Objects are sequences of {C,A,T,G}.
• Distance between sequences is edit distance, the minimum number of inserts and deletes needed to turn one into the other.
• Note there is a “distance,” but no convenient space in which points “live.”
![Page 6: Clustering. The Problem of Clustering Given a set of points, with a notion of distance between points, group the points into some number of clusters,](https://reader038.vdocuments.site/reader038/viewer/2022103123/56649d2b5503460f94a00b39/html5/thumbnails/6.jpg)
Distance Measures• Each clustering problem is based on some kind of
“distance” between points.• Two major classes of distance measure:
1. Euclidean
2. Non-Euclidean
• A Euclidean space has some number of real-valued dimensions.– There is a notion of “average” of two points.
– A Euclidean distance is based on the locations of points in such a space.
• A Non-Euclidean distance is based on properties of points, but not their “location” in a space.
![Page 7: Clustering. The Problem of Clustering Given a set of points, with a notion of distance between points, group the points into some number of clusters,](https://reader038.vdocuments.site/reader038/viewer/2022103123/56649d2b5503460f94a00b39/html5/thumbnails/7.jpg)
Axioms of a Distance Measure• d is a distance measure if it is a function from pairs of
points to real numbers such that:1. d(x,y) > 0.
2. d(x,y) = 0 iff x = y.
3. d(x,y) = d(y,x).
4. d(x,y) < d(x,z) + d(z,y) (triangle inequality ).
![Page 8: Clustering. The Problem of Clustering Given a set of points, with a notion of distance between points, group the points into some number of clusters,](https://reader038.vdocuments.site/reader038/viewer/2022103123/56649d2b5503460f94a00b39/html5/thumbnails/8.jpg)
Some Euclidean Distances• L2 norm : d(x,y) = square root of the sum of the squares of
the differences between x and y in each dimension.– The most common notion of “distance.”
• L1 norm : sum of the differences in each dimension.
– Manhattan distance = distance if you had to travel along coordinates only.
x = (5,5)
y = (9,8)L2-norm:dist(x,y) =(42+32)= 5
L1-norm:dist(x,y) =4+3 = 7
4
35
![Page 9: Clustering. The Problem of Clustering Given a set of points, with a notion of distance between points, group the points into some number of clusters,](https://reader038.vdocuments.site/reader038/viewer/2022103123/56649d2b5503460f94a00b39/html5/thumbnails/9.jpg)
Non-Euclidean Distances• Jaccard distance for sets = 1 minus ratio of sizes of
intersection and union.
• Cosine distance = angle between vectors from the origin to the points in question.
• Edit distance = number of inserts and deletes to change one string into another.
![Page 10: Clustering. The Problem of Clustering Given a set of points, with a notion of distance between points, group the points into some number of clusters,](https://reader038.vdocuments.site/reader038/viewer/2022103123/56649d2b5503460f94a00b39/html5/thumbnails/10.jpg)
Jaccard Distance for Sets (Bit-Vectors)• Example: p1 = 10111; p2 = 10011.
– Size of intersection = 3; size of union = 4, Jaccard similarity (not distance) = 3/4.
– d(x,y) = 1 – (Jaccard similarity) = 1/4.
![Page 11: Clustering. The Problem of Clustering Given a set of points, with a notion of distance between points, group the points into some number of clusters,](https://reader038.vdocuments.site/reader038/viewer/2022103123/56649d2b5503460f94a00b39/html5/thumbnails/11.jpg)
Why J.D. Is a Distance Measure• d(x,x) = 0 because xx = xx.• d(x,y) = d(y,x) because union and intersection are symmetric.• d(x,y) > 0 because |xy| < |xy|.• d(x,y) < d(x,z) + d(z,y) trickier...
(1 - |x z|/|x z|) + (1 - |y z|/|y z|) 1 - |x y|/|x y|
– Remember: • |a b|/|a b| = probability that minhash(a) = minhash(b)• Thus, 1 - |a b|/|a b| = probability that minhash(a) minhash(b).
– Claim: prob[mh(x)mh(y)] prob[mh(x)mh(z)] + prob[mh(z)mh(y)]
– Proof: whenever mh(x)mh(y), at least one of mh(x)mh(z) and mh(z)mh(y) must be true.
![Page 12: Clustering. The Problem of Clustering Given a set of points, with a notion of distance between points, group the points into some number of clusters,](https://reader038.vdocuments.site/reader038/viewer/2022103123/56649d2b5503460f94a00b39/html5/thumbnails/12.jpg)
Clustering with JD
{a,b,c}{b,c,e,f}
{d,e,f}{a,b,d,e}
Similarity threshold = 1/3;distance < 2/3
![Page 13: Clustering. The Problem of Clustering Given a set of points, with a notion of distance between points, group the points into some number of clusters,](https://reader038.vdocuments.site/reader038/viewer/2022103123/56649d2b5503460f94a00b39/html5/thumbnails/13.jpg)
Cosine Distance• Think of a point as a vector from the origin (0,0,…,0) to its
location.• Two points’ vectors make an angle, whose cosine is the
normalized dot-product of the vectors: p1.p2/|p2||p1|.
– Example: p1 = 00111; p2 = 10011.
– p1.p2 = 2; |p1| = |p2| = 3.
– cos() = 2/3; is about 48 degrees.
p1
p2p1.p2
|p2|
d (p1, p2) = = arccos(p1.p2/|p2||p1|)
![Page 14: Clustering. The Problem of Clustering Given a set of points, with a notion of distance between points, group the points into some number of clusters,](https://reader038.vdocuments.site/reader038/viewer/2022103123/56649d2b5503460f94a00b39/html5/thumbnails/14.jpg)
Why C.D. Is a Distance Measure• d(x,x) = 0 because arccos(1) = 0.• d(x,y) = d(y,x) by symmetry.• d(x,y) > 0 because angles are chosen to be in the range 0
to 180 degrees.• Triangle inequality: physical reasoning. If I rotate an angle
from x to z and then from z to y, I can’t rotate less than from x to y.
![Page 15: Clustering. The Problem of Clustering Given a set of points, with a notion of distance between points, group the points into some number of clusters,](https://reader038.vdocuments.site/reader038/viewer/2022103123/56649d2b5503460f94a00b39/html5/thumbnails/15.jpg)
Edit Distance• The edit distance of two strings is the number of inserts
and deletes of characters needed to turn one into the other. Equivalently:
• d(x,y) = |x| + |y| - 2|LCS(x,y)|– LCS = longest common subsequence = any longest string
obtained both by deleting from x and deleting from y.
Example• x = abcde ; y = bcduve.• Turn x into y by deleting a, then inserting u and v after d.
– Edit distance = 3.
• Or, LCS(x,y) = bcde.• Note: |x| + |y| - 2|LCS(x,y)| = 5 + 6 –2*4 = 3 = edit dist.
![Page 16: Clustering. The Problem of Clustering Given a set of points, with a notion of distance between points, group the points into some number of clusters,](https://reader038.vdocuments.site/reader038/viewer/2022103123/56649d2b5503460f94a00b39/html5/thumbnails/16.jpg)
Why Edit Distance Is a Distance Measure
• d(x,x) = 0 because 0 edits suffice.• d(x,y) = d(y,x) because insert/delete are inverses of each
other.• d(x,y) > 0: no notion of negative edits.• Triangle inequality: changing x to z and then to y is one
way to change x to y.
![Page 17: Clustering. The Problem of Clustering Given a set of points, with a notion of distance between points, group the points into some number of clusters,](https://reader038.vdocuments.site/reader038/viewer/2022103123/56649d2b5503460f94a00b39/html5/thumbnails/17.jpg)
Hierarchical Clustering • Produces a set of nested clusters organized as a
hierarchical tree• Can be visualized as a dendrogram
– A tree like diagram that records the sequences of merges or splits
1 3 2 5 4 60
0.05
0.1
0.15
0.2
1
2
3
4
5
6
1
23 4
5
![Page 18: Clustering. The Problem of Clustering Given a set of points, with a notion of distance between points, group the points into some number of clusters,](https://reader038.vdocuments.site/reader038/viewer/2022103123/56649d2b5503460f94a00b39/html5/thumbnails/18.jpg)
Agglomerative Clustering AlgorithmCompute the proximity matrix
Let each data point be a cluster
Repeat
Merge the two closest clusters
Update the proximity matrix
Until only a single cluster remains
• Key operation is the computation of the proximity of two clusters– Different approaches to defining the distance between
clusters distinguish the different algorithms
![Page 19: Clustering. The Problem of Clustering Given a set of points, with a notion of distance between points, group the points into some number of clusters,](https://reader038.vdocuments.site/reader038/viewer/2022103123/56649d2b5503460f94a00b39/html5/thumbnails/19.jpg)
Starting Situation • Start with clusters of individual points and a proximity
matrix
p1
p3
p5
p4
p2
p1 p2 p3 p4 p5 . . .
.
.
. Proximity Matrix
...p1 p2 p3 p4 p9 p10 p11 p12
![Page 20: Clustering. The Problem of Clustering Given a set of points, with a notion of distance between points, group the points into some number of clusters,](https://reader038.vdocuments.site/reader038/viewer/2022103123/56649d2b5503460f94a00b39/html5/thumbnails/20.jpg)
Intermediate Situation• After some merging steps, we have some clusters
C1
C4
C2 C5
C3
C2C1
C1
C3
C5
C4
C2
C3 C4 C5
Proximity Matrix
...p1 p2 p3 p4 p9 p10 p11 p12
![Page 21: Clustering. The Problem of Clustering Given a set of points, with a notion of distance between points, group the points into some number of clusters,](https://reader038.vdocuments.site/reader038/viewer/2022103123/56649d2b5503460f94a00b39/html5/thumbnails/21.jpg)
Intermediate Situation• We want to merge the two closest clusters (C2 and C5) and update
the proximity matrix.
C1
C4
C2 C5
C3
C2C1
C1
C3
C5
C4
C2
C3 C4 C5
Proximity Matrix
...p1 p2 p3 p4 p9 p10 p11 p12
![Page 22: Clustering. The Problem of Clustering Given a set of points, with a notion of distance between points, group the points into some number of clusters,](https://reader038.vdocuments.site/reader038/viewer/2022103123/56649d2b5503460f94a00b39/html5/thumbnails/22.jpg)
After Merging• The question is “How do we update the proximity matrix?”
C1
C4
C2 U C5
C3? ? ? ?
?
?
?
C2 U C5C1
C1
C3
C4
C2 U C5
C3 C4
Proximity Matrix
...p1 p2 p3 p4 p9 p10 p11 p12
![Page 23: Clustering. The Problem of Clustering Given a set of points, with a notion of distance between points, group the points into some number of clusters,](https://reader038.vdocuments.site/reader038/viewer/2022103123/56649d2b5503460f94a00b39/html5/thumbnails/23.jpg)
How to Define Inter-Cluster Similarity
p1
p3
p5
p4
p2
p1 p2 p3 p4 p5 . . .
.
.
.
Similarity?
• MIN• MAX• Group Average
Proximity Matrix
![Page 24: Clustering. The Problem of Clustering Given a set of points, with a notion of distance between points, group the points into some number of clusters,](https://reader038.vdocuments.site/reader038/viewer/2022103123/56649d2b5503460f94a00b39/html5/thumbnails/24.jpg)
How to Define Inter-Cluster Similarity
p1
p3
p5
p4
p2
p1 p2 p3 p4 p5 . . .
.
.
.Proximity Matrix
• MIN• MAX• Group Average
![Page 25: Clustering. The Problem of Clustering Given a set of points, with a notion of distance between points, group the points into some number of clusters,](https://reader038.vdocuments.site/reader038/viewer/2022103123/56649d2b5503460f94a00b39/html5/thumbnails/25.jpg)
How to Define Inter-Cluster Similarity
p1
p3
p5
p4
p2
p1 p2 p3 p4 p5 . . .
.
.
.Proximity Matrix
• MIN• MAX• Group Average
![Page 26: Clustering. The Problem of Clustering Given a set of points, with a notion of distance between points, group the points into some number of clusters,](https://reader038.vdocuments.site/reader038/viewer/2022103123/56649d2b5503460f94a00b39/html5/thumbnails/26.jpg)
How to Define Inter-Cluster Similarity
p1
p3
p5
p4
p2
p1 p2 p3 p4 p5 . . .
.
.
.Proximity Matrix
• MIN• MAX• Centroid distance
![Page 27: Clustering. The Problem of Clustering Given a set of points, with a notion of distance between points, group the points into some number of clusters,](https://reader038.vdocuments.site/reader038/viewer/2022103123/56649d2b5503460f94a00b39/html5/thumbnails/27.jpg)
Cluster Similarity: MIN• Similarity of two clusters is based on the two most similar
(closest) points in the different clusters
![Page 28: Clustering. The Problem of Clustering Given a set of points, with a notion of distance between points, group the points into some number of clusters,](https://reader038.vdocuments.site/reader038/viewer/2022103123/56649d2b5503460f94a00b39/html5/thumbnails/28.jpg)
Hierarchical Clustering: MIN
Nested Clusters Dendrogram
1
2
3
4
5
6
1
2
3
4
5
3 6 2 5 4 10
0.05
0.1
0.15
0.2
![Page 29: Clustering. The Problem of Clustering Given a set of points, with a notion of distance between points, group the points into some number of clusters,](https://reader038.vdocuments.site/reader038/viewer/2022103123/56649d2b5503460f94a00b39/html5/thumbnails/29.jpg)
Strength of MIN
Original Points Two Clusters
Can handle non-globular shapes
![Page 30: Clustering. The Problem of Clustering Given a set of points, with a notion of distance between points, group the points into some number of clusters,](https://reader038.vdocuments.site/reader038/viewer/2022103123/56649d2b5503460f94a00b39/html5/thumbnails/30.jpg)
Limitations of MIN
Sensitive to noise and outliers
Original Points Four clusters Three clusters:
The yellow points got wrongly merged with the red ones, as opposed to the green one.
![Page 31: Clustering. The Problem of Clustering Given a set of points, with a notion of distance between points, group the points into some number of clusters,](https://reader038.vdocuments.site/reader038/viewer/2022103123/56649d2b5503460f94a00b39/html5/thumbnails/31.jpg)
Cluster Similarity: MAX• Similarity of two clusters is based on the two least similar
(most distant) points in the different clusters
![Page 32: Clustering. The Problem of Clustering Given a set of points, with a notion of distance between points, group the points into some number of clusters,](https://reader038.vdocuments.site/reader038/viewer/2022103123/56649d2b5503460f94a00b39/html5/thumbnails/32.jpg)
Hierarchical Clustering: MAX
Nested Clusters Dendrogram
3 6 4 1 2 50
0.05
0.1
0.15
0.2
0.25
0.3
0.35
0.4
1
2
3
4
5
6
1
2 5
3
4
![Page 33: Clustering. The Problem of Clustering Given a set of points, with a notion of distance between points, group the points into some number of clusters,](https://reader038.vdocuments.site/reader038/viewer/2022103123/56649d2b5503460f94a00b39/html5/thumbnails/33.jpg)
Strengths of MAX
Less susceptible respect to noise and outliers
Original Points Four clusters Three clusters:
The yellow points get now merged with the green one.
![Page 34: Clustering. The Problem of Clustering Given a set of points, with a notion of distance between points, group the points into some number of clusters,](https://reader038.vdocuments.site/reader038/viewer/2022103123/56649d2b5503460f94a00b39/html5/thumbnails/34.jpg)
Limitations of MAX
Original Points Two Clusters
Tends to break large clusters
![Page 35: Clustering. The Problem of Clustering Given a set of points, with a notion of distance between points, group the points into some number of clusters,](https://reader038.vdocuments.site/reader038/viewer/2022103123/56649d2b5503460f94a00b39/html5/thumbnails/35.jpg)
Cluster Similarity: Centroid distance• Consider the distance between cluster centroids.
![Page 36: Clustering. The Problem of Clustering Given a set of points, with a notion of distance between points, group the points into some number of clusters,](https://reader038.vdocuments.site/reader038/viewer/2022103123/56649d2b5503460f94a00b39/html5/thumbnails/36.jpg)
And in the Non-Euclidean Case?• The only “locations” we can talk about are the points
themselves.– i.e., there is no “average” of two points.
• Approach 1: clustroid = point “closest” to other points.– Treat clustroid as if it were centroid, when computing
intercluster distances.
• “Closest” Point?– Possible meanings:
1.Smallest maximum distance to the other points.
2.Smallest average distance to other points.
![Page 37: Clustering. The Problem of Clustering Given a set of points, with a notion of distance between points, group the points into some number of clusters,](https://reader038.vdocuments.site/reader038/viewer/2022103123/56649d2b5503460f94a00b39/html5/thumbnails/37.jpg)
Example
1 2
34
5
6
interclusterdistance
clustroid
clustroid
![Page 38: Clustering. The Problem of Clustering Given a set of points, with a notion of distance between points, group the points into some number of clusters,](https://reader038.vdocuments.site/reader038/viewer/2022103123/56649d2b5503460f94a00b39/html5/thumbnails/38.jpg)
k – Means Algorithm(s)• Start by picking k, the number of clusters.
• Initialize clusters by picking one point per
cluster. – Pick one point at random,
– Then k -1 other points, each as far away
as possible from the previous points • each with the maximum possible minimum
distance to the previously selected points.
• Example– Suppose we pick A first.
– E is the furthest from A, so we pick it next. – For the third point, the minimum distances
to A or E are as followsB: 3.00, C: 2.83, D: 3.16, F: 2.00
The winner is D. Thus, D becomes the third seed.
![Page 39: Clustering. The Problem of Clustering Given a set of points, with a notion of distance between points, group the points into some number of clusters,](https://reader038.vdocuments.site/reader038/viewer/2022103123/56649d2b5503460f94a00b39/html5/thumbnails/39.jpg)
Populating Clusters1. For each point, place it in the cluster whose current
centroid it is nearest.2. After all points are assigned, fix the centroids of the k
clusters.3. Optional: reassign all points to their closest centroid.
– Sometimes moves points between clusters.
Repeat for a couple of rounds.
![Page 40: Clustering. The Problem of Clustering Given a set of points, with a notion of distance between points, group the points into some number of clusters,](https://reader038.vdocuments.site/reader038/viewer/2022103123/56649d2b5503460f94a00b39/html5/thumbnails/40.jpg)
Example: Assigning Clusters
1
2
3
4
5
6
7 8x
x
Clusters after first round
Reassignedpoints
![Page 41: Clustering. The Problem of Clustering Given a set of points, with a notion of distance between points, group the points into some number of clusters,](https://reader038.vdocuments.site/reader038/viewer/2022103123/56649d2b5503460f94a00b39/html5/thumbnails/41.jpg)
Getting k Right• Try different k, looking at the change in the average
distance to centroid, as k increases.• Average falls rapidly until right k, then changes little.
k
Averagedistance tocentroid
Best valueof k
![Page 42: Clustering. The Problem of Clustering Given a set of points, with a notion of distance between points, group the points into some number of clusters,](https://reader038.vdocuments.site/reader038/viewer/2022103123/56649d2b5503460f94a00b39/html5/thumbnails/42.jpg)
Example: Picking k
x xx x x xx x x x
x x xx x
xxx x
x x x x x
xx x x
x
x xx x x x x x x
x
x
x
Too few;many longdistancesto centroid.
![Page 43: Clustering. The Problem of Clustering Given a set of points, with a notion of distance between points, group the points into some number of clusters,](https://reader038.vdocuments.site/reader038/viewer/2022103123/56649d2b5503460f94a00b39/html5/thumbnails/43.jpg)
Example: Picking k
x xx x x xx x x x
x x xx x
xxx x
x x x x x
xx x x
x
x xx x x x x x x
x
x
x
Just right;distancesrather short.
![Page 44: Clustering. The Problem of Clustering Given a set of points, with a notion of distance between points, group the points into some number of clusters,](https://reader038.vdocuments.site/reader038/viewer/2022103123/56649d2b5503460f94a00b39/html5/thumbnails/44.jpg)
Example: Picking k
x xx x x xx x x x
x x xx x
xxx x
x x x x x
xx x x
x
x xx x x x x x x
x
x
x
Too many;little improvementin averagedistance.
![Page 45: Clustering. The Problem of Clustering Given a set of points, with a notion of distance between points, group the points into some number of clusters,](https://reader038.vdocuments.site/reader038/viewer/2022103123/56649d2b5503460f94a00b39/html5/thumbnails/45.jpg)
BFR Algorithm• BFR (Bradley-Fayyad-Reina) is a variant of k -means
designed to handle very large (disk-resident) data sets.
• The goal is not to assign every point to a cluster, but to determine where the centroids of the clusters are. – We can assign the points to clusters by another pass
through the data, assigning each point to its nearest centroid and writing out the cluster number with the point.
• Points are read one main-memory-full at a time.– Most points from previous memory loads are summarized by
simple statistics.
• To begin, from the initial load we select the initial k centroids by some sensible approach.
![Page 46: Clustering. The Problem of Clustering Given a set of points, with a notion of distance between points, group the points into some number of clusters,](https://reader038.vdocuments.site/reader038/viewer/2022103123/56649d2b5503460f94a00b39/html5/thumbnails/46.jpg)
Initialization: k -MeansPossibilities include:
1. Take a small random sample and cluster optimally.
2. Take a sample; pick a random point, and then k – 1 more points, each as far from the previously selected points as possible.
![Page 47: Clustering. The Problem of Clustering Given a set of points, with a notion of distance between points, group the points into some number of clusters,](https://reader038.vdocuments.site/reader038/viewer/2022103123/56649d2b5503460f94a00b39/html5/thumbnails/47.jpg)
Three Classes of Points1. The discard set : points close enough to a centroid to
be summarized.
2. The compression set : groups of points that are close together but not close to any centroid. They are summarized, but not assigned to a cluster.
3. The retained set : isolated points.
![Page 48: Clustering. The Problem of Clustering Given a set of points, with a notion of distance between points, group the points into some number of clusters,](https://reader038.vdocuments.site/reader038/viewer/2022103123/56649d2b5503460f94a00b39/html5/thumbnails/48.jpg)
Summarizing Sets of PointsFor each cluster, the discard set is summarized by:
1. The number of points, N.
2. The vector SUM, whose i th component is the sum of the coordinates of the points in the i th dimension.
3. The vector SUMSQ: i th component = sum of squares of coordinates in i th dimension.
• 2d + 1 values represent any number of points. (d = number of dimensions).• Averages in each dimension (centroid coordinates) can be calculated easily
as SUMi /N.
– SUMi = i th component of SUM.
• Variance of a cluster’s discard set in dimension i can be computed by: – (SUMSQi /N ) – (SUMi /N )2
– And the standard deviation is the square root of that.
• The same statistics can represent any compression set.
![Page 49: Clustering. The Problem of Clustering Given a set of points, with a notion of distance between points, group the points into some number of clusters,](https://reader038.vdocuments.site/reader038/viewer/2022103123/56649d2b5503460f94a00b39/html5/thumbnails/49.jpg)
“Galaxies” Picture
A cluster. Its pointsare in the DS.
The centroid
Compressed sets.Their points are inthe CS.
Points inthe RS
![Page 50: Clustering. The Problem of Clustering Given a set of points, with a notion of distance between points, group the points into some number of clusters,](https://reader038.vdocuments.site/reader038/viewer/2022103123/56649d2b5503460f94a00b39/html5/thumbnails/50.jpg)
Processing a “Memory-Load” of Points1. Find those points that are “sufficiently close” to a cluster
centroid; add those points to that cluster and the DS. Adjust statistics of the clusters to account for the new
points.
2. Use any main-memory clustering algorithm to cluster the remaining points and the old RS.
Clusters go to the CS; outlying points to the RS.
3. Consider merging compressed sets in the CS.
4. If this is the last round, merge all compressed sets in the CS and all RS points into their nearest cluster.
![Page 51: Clustering. The Problem of Clustering Given a set of points, with a notion of distance between points, group the points into some number of clusters,](https://reader038.vdocuments.site/reader038/viewer/2022103123/56649d2b5503460f94a00b39/html5/thumbnails/51.jpg)
A Few Details . . .• How do we decide if a point is “close enough” to a cluster
that we will add the point to that cluster?
• How do we decide whether two compressed sets deserve to be combined into one?
![Page 52: Clustering. The Problem of Clustering Given a set of points, with a notion of distance between points, group the points into some number of clusters,](https://reader038.vdocuments.site/reader038/viewer/2022103123/56649d2b5503460f94a00b39/html5/thumbnails/52.jpg)
How Close is Close Enough?• We need a way to decide whether to put a new point into
a cluster.– The Mahalanobis distance is less than a threshold.
Mahalanobis distance:• Normalized Euclidean distance.
• For point (x1,…,xk) and centroid (c1,…,ck):
1. Normalize in each dimension: yi = (xi -ci)/i
2. Take sum of the squares of the yi ’s.
3. Take the square root.
![Page 53: Clustering. The Problem of Clustering Given a set of points, with a notion of distance between points, group the points into some number of clusters,](https://reader038.vdocuments.site/reader038/viewer/2022103123/56649d2b5503460f94a00b39/html5/thumbnails/53.jpg)
Mahalanobis Distance – (2)• If clusters are normally distributed in d dimensions,
then after transformation, one standard deviation = d.– i.e., 70% of the points of the cluster will have a
Mahalanobis distance < d.
• Accept a point for a cluster if its M.D. is < some threshold, e.g. 3 standard deviations.– If values are normally distributed, then very few of
these values will be more than 3 standard deviations from the mean
• approximately one in a million will be that far from the mean). Thus, we would only reject one in a million points that belong in the cluster.
![Page 54: Clustering. The Problem of Clustering Given a set of points, with a notion of distance between points, group the points into some number of clusters,](https://reader038.vdocuments.site/reader038/viewer/2022103123/56649d2b5503460f94a00b39/html5/thumbnails/54.jpg)
Picture: Equal M.D. Regions
2
![Page 55: Clustering. The Problem of Clustering Given a set of points, with a notion of distance between points, group the points into some number of clusters,](https://reader038.vdocuments.site/reader038/viewer/2022103123/56649d2b5503460f94a00b39/html5/thumbnails/55.jpg)
Should Two CS Subclusters Be Combined?
• Compute the variance of the combined subcluster.– N, SUM, and SUMSQ allow us to make that calculation
quickly.
• Combine if the variance is below some threshold.