Documentation>
Functions>
Generalappliedmath,
Statistics
Performsk-meansclusteringviatheHartiganandWongAS-136algorithm.
Availableinversion6.3.0andlater.
functionkmeans_as136(
x:numeric,;floatordouble
k[1]:integer,
opt[1]:logical
return_val:floatordouble
Thereturnarray(say),clcnter,willcontainthecluster
centers.Itwillbedimensioned(k,N),whereN
collectivelyrepresentsthe'variable'dimension(s).
clcnterwillhavethefollowingattributesassociatedwithit:
id-aone-dimensionalintegerarrayof
sizeMindicatingtheclustertowhicheachobservationis
assigned.
npts-aone-dimensionalintegerarrayof
sizekcontainingthenumberofpointsineachcluster.
ss2-aone-dimensionaldoublearrayof
sizekcontainingthewithin-clustersumofsquares.
K-meansisacentroid-basedclustermethod.
Theobservationsareallocatedtokclustersinsuchawaythatthe
within-clustersumofsquaresisminimized.K-meansclusteringrequiresthat
thenumberofclusterstobeextractedbespecifiedinadvance.
Asnotedby
"Thenumberofclustersshouldmatchthedata.Anincorrectchoiceofthenumberofclusterswillinvalidatethewholeprocess.AnempiricalwaytofindthebestnumberofclustersistotryK-meansclusteringwithdifferentnumberofclustersandmeasuretheresultingsumofsquares."
Thek-meansalgorithmworksreasonablywellwhenthedatafitstheclustermodel:
Thenumberofclustersis'consistent'withthedata.
Thedatapointswithinaclusterarecenteredaroundthatcluster
Thespread/varianceoftheclustersissimilar,ieeachdatapointbelongstotheclosestcluster
Limitations:K-meansmayhaveproblemswhenclustersareofverydifferingsizes;
outliersarepresent;oremptyclustersexist.
TheoriginalcodeiscreatedforCartesiangrids.Iftheapplicationrequiresusinggridpoints
orstationslocatedathighlatitudes,itissuggestedthat
css2cbeused
tointerpolatetoCartesiancoordinates.Thesebetterreflectthetruedistancesandshouldbeinputtothefunction.
Themodifiedcodeusedbythisfunctionwasdownloadedfrom
JohnBurkardt'swebsite.
TheoriginalHartigan&WongFortrancodewasfrom:
JohnHartigan,ManchekWong,
AlgorithmAS136:
AK-MeansClusteringAlgorithm,
AppliedStatistics,
Volume28,Number1,1979,pages100-108.
Example1:Thesourceofthisexampleis
Defaultoptionsareused.
v0(/1.0,1.5,3.0,5.0,3.5,4.5,3.5/);1stvariable
v1(/1.0,2.0,4.0,7.0AS136模具钢多少钱一公斤,5.0,5.0,4.5/);2ndvariable
mdimsizes(v1);#observations
n2;#variables
k2;#clusters(userspecified)
xnew((/n,m/),typeof(v1),"No_FillValue")
x(0,:)v0
x(1,:)v1
clcntrkmeans_as136(x,k,False);usedefaultoptions
print(clcntr);(1.25,1.5)and(3.9,5.1)
Aneditedversionoftheoutputfollows:
Variable:clcntr
Type:float
TotalSize:16bytes
4values
NumberofDimensions:2
Dimensionsandsizes:[2]x[2](kcX(:,{-30:30},:);x(time,lat,lon)
;reorderviaNCL'snameddimensionreordering
xrx(lat|:,lon|:,time|:);make'time'(observations;M)therightmostdimension
;thelat,lonarethe'variables'(N)
k3;#clusters(userspecified)
optTrue
opt@iseed1
clcntrkmeans_as136(xr,k,opt);inputthereorderedarray
:;clcntr(3,nlat,mlon)
delete(xr);deleteifnolongerneeded(notnecessary)苏州东锜公司自创立以来一直秉承“诚信、务实、高效、创新”的企业精神,将这一精神融入到企业的经营管理和工作实践当中,并获得了社会各界信任与尊重。我公司先后多次被评为“苏州市钢材营销企业五十强”,“全国百强钢材营销企业”,被中国质量检验协会评为“全国质量服务诚信示范企业”及“全国行业质量示范企业”。
本文部分内容来源于网络,我们仅作为信息分享。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,请发送邮件至tokaits@163.com举报,一经查实,本站将立刻删除。
下一篇:模具钢材2738hh多少钱_有国产吗