k-means算法的简单示例备课讲稿

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

k-means算法的简单示例AlgorithmProcedure1.RandomlyselectKpointsfromcompletesamplesastheinitialcenter.(That'swhatkmeansinK-means)2.Eachpointinthedatasetisassignedtotheclosedcluster,basedupontheEuclideandistancebetweeneachpointandeachclustercenter.3.Eachcluster'scenterisrecomputedastheaverageofthepointsinthatcluster.4.Iteratestep2ormoreuntilthenewcenterofclusterequalstotheoriginalcenterofclusterorlessthanaspecifiedthreshold,thenclusteringfinished.3ABCDEFIGJHExampleHowtoclusterA,B...H,Jintotwoclusters?4A(1,4)B(2,4)CDEFIGJHRandomlychooseA,BasthecentreandK=2.ExampleAAdABdACdADdAFdAGdAHdAIdAJdAEdBAdBBdBCdBDdBFdBGdBHdBIdBJdBEd0111.412.243.614.475.394.245101.41122.833.614.473.614.24So,weclassifyA,CasaclusterandB,E,D,F,G,H,IandJasanothercluster.Step1and2.ABCDEFGHIJABdmeansdistanceA→B5ACdBCdA(1,4)B(2,4)CDEFIGJHRandomlychooseA,BasthecentreandK=2.ExampleStep3.),(jyixcenterji)5.4,1()254,211(,CA)875.2,75.3(,,,,,,,JIHGFEDBThenewcentersofthetwoclustersare(1,4.5)and(3.75,2.875)6cluster1cluster2newcenterABCDEFIGJHα(1,4.5)β(3.75,2.875)ExampleAdBdCdDdFdGdHdIdJdEdAdBdCdDdFdGdHdIdJdEd0.51.120.51.121.83.914.725.594.615.322.972.083.482.753.580.911.532.411.892.25Step2again.α,βasthecentreandK=2.So,weclassifyA,B,C,D,EasaclusterandF,G,H,I,Jasanothercluster.ABCDEFGHIJ7ABCDEFIGJHα(1,4.5)β(3.75,2.875)ExampleStep3again.α,βasthecentreandK=2.),(jyixcenterji)8.4,6.1(,,,,EDCBAP)6.1,8.4(,,,,JIHGFQThenewcentersofthetwoclustersareP(1.6,4.8)andQ(4.8,1.6)8cluster2cluster1newcenterABCDEFIGJHP(1.6,4.8)Q(4.8,1.6)ExamplePAdPBdPCdPDdPFdPGdPHdPIdPJdPEdQAdQBdQCdQDdQFdQGdQHdQIdQJdQEd10.890.630.451.263.694.405.224.495.104.493.695.104.45.220.890.451.2610.63Step2again.So,weclassifyA,B,C,D,EasaclusterandF,G,H,I,Jasanothercluster.ABCDEFGHIJ9ABCDEFIGJHP(1.6,4.8)Q(4.8,1.6)ExampleStep3again.),(jyixcenterji)8.4,6.1(,,,,EDCBAM)6.1,8.4(,,,,JIHGFNThenewcentersofthetwoclustersareequaltotheoriginalP(1.6,4.8)andQ(4.8,1.6)P,QasthecentreandK=2.10newcentercluster2cluster1FinalABCDEFIGJHcluster1cluster211Clusteringfinished!Disadvantagesoneofthemaindisadvantagestok-meansisthefactthatyoumustspecifythenumberofclusters(K)asaninputtothealgorithm.Asdesigned,thealgorithmisnotcapableofdeterminingtheappropriatenumberofclustersanddependsupontheusertoidentifythisinadvance.K=2K=312Thankyou此课件下载可自行编辑修改,仅供参考!感谢您的支持,我们努力做得更好!谢谢

1 / 13
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功