Download - כריית מידע -- Clustering
![Page 1: כריית מידע -- Clustering](https://reader035.vdocuments.mx/reader035/viewer/2022062304/56812bce550346895d9029a0/html5/thumbnails/1.jpg)
מידע -- Clusteringכריית
רוזנפלד" אבי ר ד
![Page 2: כריית מידע -- Clustering](https://reader035.vdocuments.mx/reader035/viewer/2022062304/56812bce550346895d9029a0/html5/thumbnails/2.jpg)
: הם דומים דברים הכללי הרעיוןדומים
דומים • דברים נאסוף איך–Regression, Classification (Supervised), k-nn– Clustering (Unsupervised) k-meand–Partitioning Algorithms (k-mean), Hierarchical
Algorithms•" " : קירבה להגדיר איך פתוחות שאלות
Euclideanמרחק – Manhattan (Judea Pearl)מרחק –אחריות – אופציות הרבה
)||...|||(|),( 22
22
2
11 pp jx
ix
jx
ix
jx
ixjid
![Page 3: כריית מידע -- Clustering](https://reader035.vdocuments.mx/reader035/viewer/2022062304/56812bce550346895d9029a0/html5/thumbnails/3.jpg)
השאלה סימן את לסווג ?איך
![Page 4: כריית מידע -- Clustering](https://reader035.vdocuments.mx/reader035/viewer/2022062304/56812bce550346895d9029a0/html5/thumbnails/4.jpg)
K-Nearest Neighborאמת • בזמן הסיווג את model freeבודקיםהשכנים • מספר את לקבוע צריכיםמהנקודה • המרחק לפי שקלול יש כלל בדרךדומה Case Based Reasoningאו CBRגם •לפי ) • משקל איזשהו או הרוב לפי הולכים בסיווג
הקרבה(איזשהו ) • או הרוב לפי יהיה הערך ברגרסיה
) הקרבה לפי משקל
![Page 5: כריית מידע -- Clustering](https://reader035.vdocuments.mx/reader035/viewer/2022062304/56812bce550346895d9029a0/html5/thumbnails/5.jpg)
1-Nearest Neighbor
![Page 6: כריית מידע -- Clustering](https://reader035.vdocuments.mx/reader035/viewer/2022062304/56812bce550346895d9029a0/html5/thumbnails/6.jpg)
3-Nearest Neighbor
![Page 7: כריית מידע -- Clustering](https://reader035.vdocuments.mx/reader035/viewer/2022062304/56812bce550346895d9029a0/html5/thumbnails/7.jpg)
7
k NEAREST NEIGHBOR
• Choosing the value of k:– If k is too small, sensitive to noise points– If k is too large, neighborhood may include points from other
classes– Choose an odd value for k, to eliminate ties
k = 3: Belongs to triangle class
k = 7: Belongs to square class
ICDM: Top Ten Data Mining Algorithms k nearest neighbor classification December 2006
?
k = 1: Belongs to square class
8
![Page 8: כריית מידע -- Clustering](https://reader035.vdocuments.mx/reader035/viewer/2022062304/56812bce550346895d9029a0/html5/thumbnails/8.jpg)
Remarks+Highly effective inductive inference method for
noisy training data and complex target functions
+Target function for a whole space may be described as a combination of less complex local approximations
+Learning is very simple- Classification is time consuming
![Page 9: כריית מידע -- Clustering](https://reader035.vdocuments.mx/reader035/viewer/2022062304/56812bce550346895d9029a0/html5/thumbnails/9.jpg)
Clustering K-MEAN: האלגוריתם הבסיסי ל Kבחר ערך רצוי של אשכולות: 1. Kמתוך אוכלוסיית המדגם שנבחרה (להלן הנקודות), בחר2.
נקודות אקראיות. נקודות אלו הם המרכזים ההתחלתיים של )Seedsהאשכולות(
קבע את המרחק האוקלידי של כל הנקודות מהמרכזים שנבחרו3.
K כל נקודה משויכת למרכז הקרוב אליה ביותר. בצורה זו קיבלנו 4.אשכולות זרים זה לזה.
בכל אשכול: קבע נקודות מרכז חדשה על ידי חישוב הממוצע 5.של כל הנקודות באשכול
אם נקודת המרכז שווה לנקודה הקודמת התהליך הסתיים , 6.3אחרת חזור ל
![Page 10: כריית מידע -- Clustering](https://reader035.vdocuments.mx/reader035/viewer/2022062304/56812bce550346895d9029a0/html5/thumbnails/10.jpg)
![Page 11: כריית מידע -- Clustering](https://reader035.vdocuments.mx/reader035/viewer/2022062304/56812bce550346895d9029a0/html5/thumbnails/11.jpg)
![Page 12: כריית מידע -- Clustering](https://reader035.vdocuments.mx/reader035/viewer/2022062304/56812bce550346895d9029a0/html5/thumbnails/12.jpg)
![Page 13: כריית מידע -- Clustering](https://reader035.vdocuments.mx/reader035/viewer/2022062304/56812bce550346895d9029a0/html5/thumbnails/13.jpg)
![Page 14: כריית מידע -- Clustering](https://reader035.vdocuments.mx/reader035/viewer/2022062304/56812bce550346895d9029a0/html5/thumbnails/14.jpg)
נקודות6דוגמא עם
Instance X Y
1 1.0 1.5
2 1.0 4.5
3 2.0 1.5
4 2.0 3.5
5 3.0 2.5
6 5.0 6.0
![Page 15: כריית מידע -- Clustering](https://reader035.vdocuments.mx/reader035/viewer/2022062304/56812bce550346895d9029a0/html5/thumbnails/15.jpg)
נקודות6דוגמא עם
![Page 16: כריית מידע -- Clustering](https://reader035.vdocuments.mx/reader035/viewer/2022062304/56812bce550346895d9029a0/html5/thumbnails/16.jpg)
1איטרציה C1,C2 להלן 1,3באופן אקראי נבחרו הנקודות •3,4,5,6 נבחרו הנקודות C2. למרכז 1,2 נבחרות נקודות C1למרכז •Distance= √(x1-x2)² + ( y1-y2 ( ²נוסחת המרחק: •
C1המרחק מ C2המרחק מ
0.00 1.00
3.00 3.16
1.00 0.00
2.24 2.00
2.24 1.41
6.02 5.41
![Page 17: כריית מידע -- Clustering](https://reader035.vdocuments.mx/reader035/viewer/2022062304/56812bce550346895d9029a0/html5/thumbnails/17.jpg)
בחירת מרכזים חדשים
C1ל •–X=(1.0+1.0)/2=1.0–Y=(1.5+4.5)/2=3.0
C2ל •–X=(2.0+2.0+3.0+5.0)/4.0=3.0–Y=(1.5+3.5+2.5+6.0)/4.0=3.375
![Page 18: כריית מידע -- Clustering](https://reader035.vdocuments.mx/reader035/viewer/2022062304/56812bce550346895d9029a0/html5/thumbnails/18.jpg)
2איטרציה C1(1.0, 3.0) C2(3.0, 3.375)נקודות המרכז החדשות: •4,5,6 יצטרפו : C2 ל 1,2,3 יצטרפו הנקודות: C1ל •
C1המרחק מ C2המרחק מ
1.5 2.74
1.5 2.29
1.8 2.125
1.12 1.01
2.06 0.875
5.00 3.30
![Page 19: כריית מידע -- Clustering](https://reader035.vdocuments.mx/reader035/viewer/2022062304/56812bce550346895d9029a0/html5/thumbnails/19.jpg)
התוצאה הסופית
![Page 20: כריית מידע -- Clustering](https://reader035.vdocuments.mx/reader035/viewer/2022062304/56812bce550346895d9029a0/html5/thumbnails/20.jpg)
CS583, Bing Liu, UIC 20
עם k-meansבעיותמראש • להגדיר המשתמש Kעלהממוצע • את לחשב שניתן מניחל • רגיש outliersמאוד
–Outliers מהאחרים הרחוקות נקודות הם–... טעות סתם להיות יכול
![Page 21: כריית מידע -- Clustering](https://reader035.vdocuments.mx/reader035/viewer/2022062304/56812bce550346895d9029a0/html5/thumbnails/21.jpg)
CS583, Bing Liu, UIC 21
של OUTLIERדוגמא
![Page 22: כריית מידע -- Clustering](https://reader035.vdocuments.mx/reader035/viewer/2022062304/56812bce550346895d9029a0/html5/thumbnails/22.jpg)
22
Euclideanמרחק
• Euclidean distance:
• Properties of a metric d(i,j):–d(i,j) 0–d(i,i) = 0–d(i,j) = d(j,i)–d(i,j) d(i,k) + d(k,j)
)||...|||(|),( 22
22
2
11 pp jx
ix
jx
ix
jx
ixjid
![Page 23: כריית מידע -- Clustering](https://reader035.vdocuments.mx/reader035/viewer/2022062304/56812bce550346895d9029a0/html5/thumbnails/23.jpg)
CS583, Bing Liu, UIC 23
Hierarchical Clustering• Produce a nested sequence of clusters, a tree, also
called Dendrogram.
![Page 24: כריית מידע -- Clustering](https://reader035.vdocuments.mx/reader035/viewer/2022062304/56812bce550346895d9029a0/html5/thumbnails/24.jpg)
CS583, Bing Liu, UIC 24
Types of hierarchical clustering• Agglomerative (bottom up) clustering: It builds the
dendrogram (tree) from the bottom level, and – merges the most similar (or nearest) pair of clusters – stops when all the data points are merged into a single cluster
(i.e., the root cluster).
• Divisive (top down) clustering: It starts with all data points in one cluster, the root. – Splits the root into a set of child clusters. Each child cluster is
recursively divided further – stops when only singleton clusters of individual data points
remain, i.e., each cluster with only a single point
![Page 25: כריית מידע -- Clustering](https://reader035.vdocuments.mx/reader035/viewer/2022062304/56812bce550346895d9029a0/html5/thumbnails/25.jpg)
CS583, Bing Liu, UIC 25
Agglomerative clustering
It is more popular then divisive methods.• At the beginning, each data point forms a
cluster (also called a node). • Merge nodes/clusters that have the least
distance.• Go on merging• Eventually all nodes belong to one cluster
![Page 26: כריית מידע -- Clustering](https://reader035.vdocuments.mx/reader035/viewer/2022062304/56812bce550346895d9029a0/html5/thumbnails/26.jpg)
CS583, Bing Liu, UIC 26
Agglomerative clustering algorithm
![Page 27: כריית מידע -- Clustering](https://reader035.vdocuments.mx/reader035/viewer/2022062304/56812bce550346895d9029a0/html5/thumbnails/27.jpg)
CS583, Bing Liu, UIC 27
An example: working of the algorithm
![Page 28: כריית מידע -- Clustering](https://reader035.vdocuments.mx/reader035/viewer/2022062304/56812bce550346895d9029a0/html5/thumbnails/28.jpg)
CS583, Bing Liu, UIC 28
Measuring the distance of two clusters
• A few ways to measure distances of two clusters.
• Results in different variations of the algorithm.– Single link– Complete link– Average link– Centroids– …
![Page 29: כריית מידע -- Clustering](https://reader035.vdocuments.mx/reader035/viewer/2022062304/56812bce550346895d9029a0/html5/thumbnails/29.jpg)
CS583, Bing Liu, UIC 29
Single link method• The distance between two
clusters is the distance between two closest data points in the two clusters, one data point from each cluster.
• It can find arbitrarily shaped clusters, but– It may cause the
undesirable “chain effect” by noisy points
Two natural clusters are split into two
![Page 30: כריית מידע -- Clustering](https://reader035.vdocuments.mx/reader035/viewer/2022062304/56812bce550346895d9029a0/html5/thumbnails/30.jpg)
CS583, Bing Liu, UIC 30
Complete link method• The distance between two clusters is the distance of
two furthest data points in the two clusters. • It is sensitive to outliers because they are far away
![Page 31: כריית מידע -- Clustering](https://reader035.vdocuments.mx/reader035/viewer/2022062304/56812bce550346895d9029a0/html5/thumbnails/31.jpg)
EM Algorithm
• Initialize K cluster centers• Iterate between two steps
– Expectation step: assign points to clusters
–Maximation step: estimate model parameters
j
jijkikki cdwcdwcdP ) |Pr() |Pr() (
m
ik
ji
kiik cdP
cdPd
m 1 ) (
) (1
N
cdw i
ki
k
) Pr(