




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)
文檔簡介
1、 K-Means Clustering ExampleK-Means Clustering ExampleWe recall from the previous lecture, that clustering allows for unsupervised learning. That is, the machine / software will learn on its own, using the data (learning set), and will classify the objects into a particular class for example, if our
2、class (decision) attribute is tumorType and its values are: malignant, benign, etc. - these will be the classes. They will be represented by cluster1, cluster2, etc. However, the class information is never provided to the algorithm. The class information can be used later on, to evaluate how accurat
3、ely the algorithm classified the objects.CurvatureTextureBloodConsumpTumorTypex10.81.2ABenignx20.751.4BBenignx30.230.4DMalignantx4.0.230.5DMalignantCurvatureTextureBloodConsumpTumorTypex10.81.2ABenignx20.751.4BBenignx30.230.4DMalignantx4.0.230.5DMalignant(learning set)CurvatureTextureBloodConsump0.8
4、0.231.20.4ABD.x1The way we do that, is by plotting the objects from the database into space. Each attribute is one dimension:CurvatureTextureBloodConsump0.80.231.20.4ABD.Cluster 1benignCluster 2malignant.After all the objects are plotted, we will calculate the distance between them, and the ones tha
5、t are close to each other we will group them together, i.e. place them in the same cluster.With the K-Means algorithm, we recall it works as follows:ExampleProblem: Cluster the following eight points (with (x, y) representing locations) into three clusters A1(2, 10) A2(2, 5) A3(8, 4) A4(5, 8) A5(7,
6、5) A6(6, 4) A7(1, 2) A8(4, 9). Initial cluster centers are: A1(2, 10), A4(5, 8) and A7(1, 2). The distance function between two points a=(x1, y1) and b=(x2, y2) is defined as: (a, b) = |x2 x1| + |y2 y1| . Use k-means algorithm to find the three cluster centers after the second iteration. Solution:It
7、eration 1 (2, 10) (5, 8) (1, 2)PointDist Mean 1Dist Mean 2Dist Mean 3ClusterA1(2, 10)A2(2, 5)A3(8, 4)A4(5, 8)A5(7, 5)A6(6, 4)A7(1, 2)A8(4, 9)First we list all points in the first column of the table above. The initial cluster centers means, are (2, 10), (5, 8) and (1, 2) - chosen randomly. Next, we
8、will calculate the distance from the first point (2, 10) to each of the three means, by using the distance function:pointmean1x1, y1x2, y2(2, 10) (2, 10) (a, b) = |x2 x1| + |y2 y1|(point, mean1) = |x2 x1| + |y2 y1| = |2 2| + |10 10| = 0 + 0 = 0pointmean2x1, y1x2, y2(2, 10) (5, 8) (a, b) = |x2 x1| +
9、|y2 y1|(point, mean2) = |x2 x1| + |y2 y1| = |5 2| + |8 10| = 3 + 2 = 5pointmean3x1, y1x2, y2(2, 10) (1, 2) (a, b) = |x2 x1| + |y2 y1|(point, mean2) = |x2 x1| + |y2 y1| = |1 2| + |2 10| = 1 + 8 = 9So, we fill in these values in the table: (2, 10) (5, 8) (1, 2)PointDist Mean 1Dist Mean 2Dist Mean 3Clu
10、sterA1(2, 10)0591A2(2, 5)A3(8, 4)A4(5, 8)A5(7, 5)A6(6, 4)A7(1, 2)A8(4, 9)So, which cluster should the point (2, 10) be placed in? The one, where the point has the shortest distance to the mean that is mean 1 (cluster 1), since the distance is 0.Cluster 1Cluster 2Cluster 3(2, 10)So, we go to the seco
11、nd point (2, 5) and we will calculate the distance to each of the three means, by using the distance function:pointmean1x1, y1x2, y2(2, 5) (2, 10) (a, b) = |x2 x1| + |y2 y1|(point, mean1) = |x2 x1| + |y2 y1| = |2 2| + |10 5| = 0 + 5 = 5pointmean2x1, y1x2, y2(2, 5) (5, 8) (a, b) = |x2 x1| + |y2 y1|(p
12、oint, mean2) = |x2 x1| + |y2 y1| = |5 2| + |8 5| = 3 + 3 = 6pointmean3x1, y1x2, y2(2, 5) (1, 2) (a, b) = |x2 x1| + |y2 y1|(point, mean2) = |x2 x1| + |y2 y1| = |1 2| + |2 5| = 1 + 3 = 4So, we fill in these values in the table:Iteration 1 (2, 10) (5, 8) (1, 2)PointDist Mean 1Dist Mean 2Dist Mean 3Clus
13、terA1(2, 10)0591A2(2, 5)5643A3(8, 4)A4(5, 8)A5(7, 5)A6(6, 4)A7(1, 2)A8(4, 9)So, which cluster should the point (2, 5) be placed in? The one, where the point has the shortest distance to the mean that is mean 3 (cluster 3), since the distance is 0.Cluster 1Cluster 2Cluster 3(2, 10)(2, 5)Analogically,
14、 we fill in the rest of the table, and place each point in one of the clusters:Iteration 1 (2, 10) (5, 8) (1, 2)PointDist Mean 1Dist Mean 2Dist Mean 3ClusterA1(2, 10)0591A2(2, 5)5643A3(8, 4)12792A4(5, 8)50102A5(7, 5)10592A6(6, 4)10572A7(1, 2)91003A8(4, 9)32102Cluster 1Cluster 2Cluster 3(2, 10)(8, 4)
15、(2, 5)(5, 8)(1, 2)(7, 5)(6, 4)(4, 9)Next, we need to re-compute the new cluster centers (means). We do so, by taking the mean of all points in each cluster.For Cluster 1, we only have one point A1(2, 10), which was the old mean, so the cluster center remains the same.For Cluster 2, we have ( (8+5+7+6+4)/5, (4+8+5+4+9)/5 ) = (6, 6)For Cluster 3, we have ( (2+1)/2, (5+2)/2 ) = (1.5, 3.5)The initial cluster centers are shown in red dot. The new cluster centers are sho
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年度租賃合同解除函及房屋租賃市場調(diào)研報告
- 高考語文復(fù)習(xí)-文言文閱讀-巧刷易混易錯
- 農(nóng)業(yè)科技創(chuàng)新研發(fā)投資合同
- 國畫藝術(shù)的智慧故解讀事讀后感
- 高考語文精講精練復(fù)習(xí)教案
- 玻璃幕墻安裝施工合同
- 2025年新教育環(huán)境下《小馬過河》課件的實踐探索
- 中學(xué)生清明節(jié)國旗下緬懷先烈講話稿(22篇)
- 土建生產(chǎn)經(jīng)理年終工作總結(jié)范文(33篇)
- 1.3動量守恒定律+學(xué)案-2022-2023學(xué)年高二上學(xué)期物理人教版(2019)選擇性必修第一冊
- 《跨境直播運營》課件-跨境直播的概念和發(fā)展歷程
- 施工現(xiàn)場安全隱患檢查表
- DL∕T 478-2013 繼電保護和安全自動裝置通 用技術(shù)條件 正式版
- DL∕T 516-2017 電力調(diào)度自動化運行管理規(guī)程
- 《原來數(shù)學(xué)這么有趣》小學(xué)數(shù)學(xué)啟蒙課程
- 中醫(yī)內(nèi)科臨床診療指南-塵肺病
- DZ∕T 0399-2022 礦山資源儲量管理規(guī)范(正式版)
- 2024年鄂爾多斯市國資產(chǎn)投資控股集團限公司招聘公開引進高層次人才和急需緊缺人才筆試參考題庫(共500題)答案詳解版
- 競賽試卷(試題)-2023-2024學(xué)年六年級下冊數(shù)學(xué)人教版
- 《研學(xué)旅行課程設(shè)計》課件-辨識與研學(xué)旅行場混淆的概念
- 部編版道德與法治三年級下冊教案全冊
評論
0/150
提交評論