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模具鋼多少錢(qián)一公斤,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)蘇州東锜公司自創(chuàng)立以來(lái)一直秉承“誠(chéng)信、務(wù)實(shí)、高效、創(chuàng)新”的企業(yè)精神,將這一精神融入到企業(yè)的經(jīng)營(yíng)管理和工作實(shí)踐當(dāng)中,并獲得了社會(huì)各界信任與尊重。我公司先后多次被評(píng)為“蘇州市鋼材營(yíng)銷(xiāo)企業(yè)五十強(qiáng)”,“全國(guó)百?gòu)?qiáng)鋼材營(yíng)銷(xiāo)企業(yè)”,被中國(guó)質(zhì)量檢驗(yàn)協(xié)會(huì)評(píng)為“全國(guó)質(zhì)量服務(wù)誠(chéng)信示范企業(yè)”及“全國(guó)行業(yè)質(zhì)量示范企業(yè)”。
本文部分內(nèi)容來(lái)源于網(wǎng)絡(luò),我們僅作為信息分享。本站僅提供信息存儲(chǔ)空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如發(fā)現(xiàn)本站有涉嫌抄襲侵權(quán)/違法違規(guī)的內(nèi)容,請(qǐng)發(fā)送郵件至tokaits@163.com舉報(bào),一經(jīng)查實(shí),本站將立刻刪除。
下一篇:模具鋼材2738hh多少錢(qián)_有國(guó)產(chǎn)嗎