距離檢測文章_第1頁
距離檢測文章_第2頁
距離檢測文章_第3頁
距離檢測文章_第4頁
距離檢測文章_第5頁
已閱讀5頁,還剩13頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領

文檔簡介

18/18附錄1對聚類點集近似最鄰近搜索的分析SongritManeewongvatana和DavidM.Mount摘要最鄰近搜索是最基本的計算問題.給定D維空間中的一個點集,它包含n個數據點,最鄰近搜索要解決的問題是用一個數據結構對這些點進行處理,以便給出一個查詢點時,我們可以高效地在數據集中找到與該點距離最近的點。因為數據集可能很大,所以我們更關注數據結構所占的存儲空間,希望將其控制在O(dn)。一種較為流行的用于最鄰近搜索的數據結構是kd樹及其變體,這項技術的基本思想是將分級的分解空間放進一個盒子中。在建立這種數據結構時的一個重要的問題是分割算法的選擇,分割算法決定了分割維和用于空間分割的超平面.分割算法的選擇在很大程度上決定了數據結構的效率,當數據點和查詢點都聚集在低維子空間時,這點體現的尤為明顯。這是因為較高的聚集性會讓子劃分生成長寬比極高的盒子。我們將兩種可選的分割策略與眾所周知的優(yōu)化kd樹策略進行了對比。第一種叫做滑動中點分割策略。它試圖尋求一種平衡,以使得子劃分產生的盒子有一個長寬比的上限,且每個盒子中都含有數據點。第二種被稱為最小不確定性分割策略,它是一種基于詢問的搜索方式。這種策略中,我們除了要給出數據點集外,還要給出一個訓練查詢集,用于預處理。策略中使用了一種簡單的貪心算法,以期選擇的分割平面能在對訓練集查找最鄰近點時使得平均不確定性的總和最小。在產生的一系列點集和查詢集上,我們進行了實驗,將這兩種策略與優(yōu)化kd樹策略進行了比較,并給對實驗結果進行了分析。我們論證了:對于聚類數據和查詢集的近似最鄰近查詢,這兩種算法的效率較標準的kd樹有顯著提高。1。介紹最鄰近查詢需要解決的是這樣一個問題:我們給定集合S,它含有度量空間X中的n個點。我們要對這n個點進行處理,以便對給定的任意點q(q∈X)我們都能很快的找到S中距離它最近的點。最鄰近查詢在很多領域中都有應用,比如知識發(fā)現、數據挖掘、模式識別和分類、機器學習、數據壓縮、多媒體數據庫、文件恢復、統(tǒng)計等等。對于度量空間,我們有許多種選擇。我們始終假定空間為Rd,即d維空間,空間中的距離采用閔可夫斯基Lm距離進行度量。對于任意整數m≥1,Rd中任意兩點p=(p1,p2…,pd)、q=(q1,q2,…,qd)的距離被定義為∑1≤i≤d|pi—qi|m的m次方根。L1,L2和L∞分別被稱為:曼哈頓距離,歐氏距離和最大距離。我們將主要的焦點集中在數據結構上。因為數據集可能很大,我們將其做一下限制,只考慮數據空間程線性增長的情況.在眾多方法之中,最流行的是基于分等級分解空間的方法。在這個領域中,最根本的工作是由Friedman,Bentley和Finkel完成的。他們指出通過使用kd樹,可以將固定維數空間中可預計其分布的數據的空間復雜度控制在O(n),查詢的時間復雜度控制在O(logn).對于這一問題,可選擇的方法有許多種。但是,所有已知的方法都存在這樣一個缺陷:當空間維數增加的時候,運行時間或空間復雜度將隨之以指數倍增長。我們試圖找到一種高效的算法,即使在最糟的情況下,它也會有較低的空間復雜度和較短的查詢時間,但事實證明,想要獲得這樣的算法是很困難的,但這同時也告訴我們尋找近似的最近臨是解決問題的一條出路。設S為Rd中的點集,查詢點q為Rd中任意一點,假定ε>0,如果dist(p,q)≤(1+ε)dist(p*,q)成立,我們就說點p是點q的近似最近臨。換句話說,p是在相對誤差ε內的真實最近臨。最近,人們已經對近似最近臨問題進行了深入的研究。較有代表性的算法包括:Bern[Ber93],Arya和Mount[AM93b],Arya等人[AMN+98],Kleinberg[Kle97],Clarkson[Cla94],Chan[Cha97],Indyk和Motwani[IM98]以及Kushilevitz,Ostrovsky和Rabani[KOR98].本文中,我們以分級空間分解特別是kd樹為基礎,將數據結構的大小限定在O(dn)。這是因為在種數據結構較為簡單而且應用廣泛。kd樹是一種二元樹,它依靠垂直于坐標軸的分割超平面將多維空間劃分為多級子空間。我們將在下一節(jié)對這個問題進行深入的探討.設計kd樹的一個關鍵問題是分割超平面的選擇。Friedman,Bentley和Finkel提出了一種分割策略:假設點集在第k維上有最大的延展度,則將過第k維中點且垂直于第k維坐標軸的平面作為分割超平面。他們將用這種方法得到的樹稱為優(yōu)化kd樹,我們把用這種方法叫作標準分割策略.另一種較為普遍的方法是利用包含點集的盒子形狀(而非點集的分布)對點集劃分。這種策略將垂直于盒子最長邊且過最長邊中點的平面作為分割超平面。我們將其稱為中點分割策略。以分級空間分解為基礎,人們把出了許多用于最近臨查詢的數據結構。Yianilos引入了vp樹。它不像kd樹那樣用一個平面去分割點集,而是利用一個稱為優(yōu)勢點的數據點作為超球面的中心,將空間分為兩部分。有一些基于R樹及其變體的數據結構被應用于數據庫領域.比如X樹,它通過避免高度堆疊提高了R*樹的性能。類似的例子還有SR樹.TV樹在處理高維高間時使用了較為獨特的方法。它通過維護一系列活躍維達到了降維的目的。當一個節(jié)點中的數據點共享了一個活動維上的相同的坐標時,該維將被列為無效,活躍維集合也將隨之改變.在這篇文章中我們研究了另外兩種分割策略的的性能,并且將其與以往的kd樹分割策略進行了比較。第一種策略叫做“滑動中點",它是由Mount和Arya針對近似最近臨搜索提出的,并應用于ANN函數庫中。將這種方法引入函數庫是為了更好的處理高聚性數據集。這種策略采用一種較為簡單的方法來更正標準kd樹分割策略中的一個嚴重缺陷。這個缺陷在于,當高聚性的數據點存在于低維子空間時,采用標準kd樹分割策略對點集進行劃分將會產生許多長寬比極高的盒子,這些盒子會使查詢時間大大延長.“滑動中點"策略起初也是沿盒子的最長邊進行簡單的中點分割,但是,如果分割產生的任何子盒中不含數據點,該策略將使分割面沿點集沿伸方向滑動,直到遇到第一個數據點為止.在3.1節(jié)中我們將對這種分割策略進行詳細描述并對其特性做出分析.第二種策略叫做“最小不確定性”分割策略,它是一項基于詢問的技術。建樹時不僅要給出數據點集,還要選出一些示例性的查詢點,這些點被稱為訓練點。建樹時,算法應用了一種啟發(fā)式的貪心算法,它試圖使對訓練集的查詢時間最小。給定一個查詢點集,我們將最鄰近查詢算法的每一步看作一張雙向連通的圖,稱之為候選圖,它的頂點代表了所有的數據點和查詢點,圖中與查詢點緊挨著的數據子集可能就是該查詢點的最鄰近點?!白钚〔淮_定”策略在執(zhí)行的每一步選出一個分割平面,盡可能多地刪除候選圖中剩余的邊。在3.2節(jié)中,我們對這種策略進行了更為詳細的描述。我們在執(zhí)行這兩種策略的同時也執(zhí)行了標準kd樹分割策略。在產生的一系列有著各種分布的低維聚類數據上,我們對這些算法進行了比較.我們相信這種類型的聚類數據在實際應用中的較為普遍的。我們使用手工合成的數據作為與基準數據的一個對比,以便于對我們聚類數據的密度和維數進行調整。我們的結果表明,對于低維聚類數據集,這兩種算法的效率較標準的kd樹有顯著提高。以下的篇章是這樣組織的,在下一章中我們展示了kd樹的背景信息以及它是怎樣執(zhí)行最鄰近查詢的。在第3節(jié)中,我們對兩個新的分割策略進行了描述.第四章,主要是對實驗及結果的展示。2。背景在這節(jié)里我們描述了kd樹是如何執(zhí)行精確或近似的最鄰近查詢的。Bentley將kd樹作為一種在高維空間中通用的二元搜索樹[Ben75]。Kd樹的每一個的節(jié)點可以看作是一個多維矩形,我們將基稱為盒子.根節(jié)點是一個包含了所有數據點的矩形。其余的節(jié)點代表了包含數據點子集的矩形。(在兩個矩形邊界上的點可以認為是包含在其中任何一個矩形中).如果節(jié)點中的數據點個數小于一個被稱為bucketsize的閾值,這個點就被稱為葉節(jié)點,這些數據點就存儲在葉節(jié)點中.否則,建立算法就選擇一個分割超平面,它垂直于其中一個坐標軸,并且貫穿整個盒子。有許多分割策略可以用于超平面的選擇。我們將在下面對此進行更詳細的討論。超平面將盒子劃分為兩個子矩形,相當于是當前節(jié)點的兩個孩子節(jié)點,盒子中的數據點屬于哪個孩子節(jié)點,取決于數據點在超平面的哪一側。樹中的每個內部節(jié)點都與它的分割超平面相關。Fridman,Bentley和Finkel[FBF77]給出了一種用kd樹尋找最鄰近數據點的算法。他們所介紹了下面的分割策略,我們將面稱為“標準分割策略”。對每個內部節(jié)點,我們將沿著點集的最大延展度方向選擇分割平面,并使其垂直于某個坐標軸。分割點被選在中點,這樣分割后形成的兩個子集中含有的數據點數基本相同。最終得到的樹的大小為O(n),高度為O(logn)。White和Jain[WJ96]提出了另一種方法,稱為VAM分割,兩種方法采用的基本思想是一致的,但后者是將具有最大差異度的維定為分割維。我們用一種簡單的遞歸算法對查詢進行回答。在最基本的情況下,當算法執(zhí)行到葉節(jié)點時,它會對葉中的每個數據點與查詢點間的距離進行計算。最小的距離值將被保存。當我們到達內部節(jié)點時,算法首先決定查詢點位于超平面的哪一側。查詢點必須離即將被訪問的孩子較近。算法遞歸地訪問這個孩子。當返回時,算法判斷盒子中另一個孩子與查詢點的距離是否比當前最小距離要近,如果是,些也對這個孩子進行遞歸訪問.當搜索返回到根時,我們就能得到最鄰近點了。一個重要的觀察結論是:對于任何查詢點,算法將訪問每一個與查詢點距離小與最鄰近點的葉節(jié)點。要對這種近似最鄰近查詢進行概括是較為簡單的。設ε為允許的誤差邊界。在處理內部節(jié)點時,當且僅當先前距離較遠的孩子節(jié)點與查詢點的距離是當前最小距離的1/(1+ε)時,我們才對這個孩子節(jié)點進行訪問.Aray等人證明了這個過程的正確性。他們也展示了這種通用的算法是如何計算出k個精確或者近似鄰近點的。Arya和Mount[AM93a]提出了一些對這種算法的改進。第一種叫作“增量距離計算”。這是一種可以用于任何Minkowski距離計算的方法.除了分割超平面,樹的每一個內部節(jié)點還存儲了相關的盒子的信息。算法并不計算真正的距離,而是使用距離的平方。當算法執(zhí)行到內部節(jié)點時,它計算查詢點與相關盒子的平方距。他們指出在固定的時間內(不依賴維數),用這個信息計算出與每了孩子節(jié)點對應的盒子的平方距是完全可能的。他們還展示了一種叫作“優(yōu)先搜索”的方法,這種方法使用堆,按照距離增加的順序訪問每個葉節(jié)點,而非按照樹結構遞歸地訪問。另外一種眾所周知的用于最近鄰查詢的算法叫作部分距離計算[BG85,Spr91]。當計算查詢點與數據點距離時,如果各平方量的和超過了當前最近點與查詢點距離的平方,那么停止對該距離的計算.對近似最鄰近查詢,Arya等人發(fā)現,對于任何一種基于分解空間的近似最鄰近查詢,都有兩條重要的性質。(1)平衡:樹的高度應該為O(logn),其中n是數據點的個數.(2)長寬比界限:樹的葉節(jié)點的長寬比應該有一個限界,這意味著每個葉節(jié)點的最長邊與最短邊的比值應該有一個固定的上限值.在這兩條規(guī)則的基礎上,他們又指出,最臨近查詢可以將數據節(jié)構的大小控制在O(dn),將執(zhí)行時間控制在O(logn)。不幸的是,對于kd樹而言,這兩條性質不總是同時成立,特別是當數據點的分布特別集中時.Arya等人提出了一種更復雜一些的數據結構,叫做“balancedbox-decomposition”樹,它可以同時滿足這兩條性質。這了證時他們的理論,這種額外的復雜性看來是有必要的,并且他們的實驗也證明了當數據集是低維子空間上的高聚性數據時這種復雜性是很重要的。一個有趣但又實際的問題是,是否存在一種算法,它有著kd樹的簡單,又能對實際中的高聚分布的數據提供高效的搜索. 固定長寬比的上限,對高效搜索來說是充分非必要條件。一種更準確的應于他們的實驗結果的條件被稱為“packingconstraint”。定義一個半徑為r的球為點集的中心?!皃ackingconstraint”表明與球相交的盒子的個數是有限的。PackingConstraint:大小至少為s的與半徑為r的球相交的葉節(jié)點的個數是有上限的,它受限于的r/s,但不依賴于n。如果樹的盒子有長寬比限制,那么它一定滿足“packingconstraint”.Arya等人指出,如果滿足“packingconstraint",那么這個盒子數只取決于維數和ε。標準分割策略的不足在于它不能控制盒子的長寬比,因此不能完全滿足“packingconstraint".附錄2AnalysisofApproximat(yī)eNearestNeighborSearchingwithClusteredPointSetsSongritManeewongvatanaandDavidM.MountAbstractNearestneighborsearchingisafundamentalcomputationalproblem.Asetofndat(yī)apointsisgiveninreald-dimensionalspace,andtheproblemistopreprocessthesepointsintoadat(yī)astructure,sothat(yī)givenaquerypoint,thenearestdatapointtothequerypointcanbereportedefficiently。Becausedatasetscanbequitelarge,weareprimarilyinterestedindatastructuresthatuseonlyO(dn)storage.Apopularclassofdatastructuresfornearestneighborsearchingisthekd-treeandvariantsbasedonhierarchicallydecomposingspaceintorectangularcells.Animportantquestionintheconstructionofsuchdatastructuresisthechoiceofasplittingmethod,whichdeterminesthedimensionandsplittingplanetobeusedateachstageofthedecomposition。Thischoiceofsplittingmethodcanhaveasigni_cantinfluenceonthee_ciencyofthedatastructure.Thisisespeciallytruewhendataandquerypointsareclusteredinlowdimensionalsubspaces。Thisisbecauseclusteringcanleadtosubdivisionsinwhichcellshaveveryhighaspectratios.Wecomparethewell-knownoptimizedkd-treesplittingmethodagainsttwoalternativesplittingmethods.Thefirst,calledthesliding-midpointmethod,whichat(yī)temptstobalancethegoalsofproducingsubdivisioncellsofboundedaspectratio,whilenotproducinganyemptycells。Thesecond,calledtheminimum—ambiguitymethodisaquery-basedapproach。Inadditiontothedatapoints,itisalsogivenatrainingsetofquerypointsforpreprocessing.Itemploysasimplegreedyalgorithmtoselectthesplittingplanethatminimizestheaverageamountofambiguityinthechoiceofthenearestneighborforthetrainingpoints。Weprovideanempiricalanalysiscomparingthesetwomethodsagainsttheoptimizedkd-treeconstructionforanumberofsyntheticallygenerateddataandquerysets。Wedemonstratethat(yī)forclustereddataandquerysets,thesealgorithmscanprovidesigni_cantimprovementsoverthestandardkd-treeconstructionforapproximatenearestneighborsearching.1.IntroductionNearestneighborsearchingisthefollowingproblem:wearegivenasetSofndatapointsinametricspace,X,andareaskedtopreprocessthesepointssothat(yī),givenanyquerypointq∈X,thedatapointnearesttoqcanbereportedquickly.Nearestneighborsearchinghasapplicat(yī)ionsinmanyareas,includingknowledgediscoveryanddatamining[FPSSU96],patternrecognitionandclas-sificat(yī)ion[CH67,DH73],machinelearning[CS93],datacompression[GG92],multimediadatabases[FSN+95],documentretrieval[DDF+90],andstatistics[DW82].Therearemanypossiblechoicesofthemetricspace。ThroughoutwewillassumethatthespaceisRd,reald—dimensionalspace,wheredistancesaremeasuredusinganyMinkowskiLmdistancemetric.Foranyintegerm≥1,theLm—distancebetweenpointsp=(p1,p2…,pd)andq=(q1,q2,…,qd)inRdisdefinedtobethem-throotof∑1≤i≤d|pi-qi|m。TheL1,L2,andL∞metricsarethewell-knownManhat(yī)tan,Euclideanandmaxmetrics,respectively.Ourprimaryfocusisondatastructuresthatarestoredinmainmemory。Sincedatasetscanbelarge,welimitourselvestoconsiderationofdat(yī)astructureswhosetotalspacegrowslinearlywithdandn。Amongthemostpopularmethodsarethosebasedonhierarchicaldecompositionsofspace.TheseminalworkinthisareawasbyFriedman,Bentley,andFinkel[FBF77]whoshowedthatO(n)spaceandO(logn)querytimeareachievableforfixeddimensionalspacesintheexpectedcasefordatadistributionsofboundeddensitythroughtheuseofkd—trees。Therehavebeennumerousvariationsonthistheme。However,allknownmethodssufferfromthefactthatasdimensionincreases,eitherrunningtimeorspaceincreaseexponentiallywithdimension。Thedifficultyofobtainingalgorithmsthataree_cientintheworstcasewithrespecttobothspaceandquerytimesuggeststhealternativeproblemoffindingapproximat(yī)enearestneighbors.ConsiderasetSofdat(yī)apointsinRdandaquerypointq∈Rd.Givenε>0,wesaythatapointp∈Sisa(1+ε)-approximatenearestneighborofqifdist(p,q)≤(1+ε)dist(p*,q)wherep*isthetruenearestneighbortoq。Inotherwords,piswithinrelativeerrorεofthetruenearestneighbor.Theapproximatenearestneighborproblemhasbeenheavilystudiedrecently.ExamplesincludealgorithmsbyBern[Ber93],AryaandMount[AM93b],Arya,etal.[AMN+98],Clarkson[Cla94],Chan[Cha97],Kleinberg[Kle97],IndykandMotwani[IM98],andKushilevitz,OstrovskyandRabani[KOR98].InthisstudywerestrictattentiontodatastructuresofsizeO(dn)basedonhierarchicalspatialdecompositions,andthekd-treeinparticular.Inlargepartthisisbecauseofthesimplicityandwidespreadpopularityofthisdatastructure.Akd—treeisbinarytreebasedonahierarchicalsubdivisionofspacebysplittinghyperplanesthatareorthogonaltothecoordinateaxes[FBF77]。Itisdescribedfurtherinthenextsection.Akeyissueinthedesignofthekd-treeisthechoiceofthesplittinghyperplane.Friedman,Bentley,andFinkelproposedasplittingmethodbasedonselectingtheplaneorthogonaltothemediancoordinatealongwhichthepointshavethegreatestspread。Theycalledtheresultingtreeanopti—mizedkd-tree,andhenceforthwecalltheresultingsplittingmethodthestandardsplittingmethod。Anothercommonalternativeusestheshapeofthecell,ratherthanthedistributionofthedatapoints.Itsplitseachcellthroughitsmidpointbyahyperplaneorthogonaltoitslongestside。Wecallthisthemidpointsplitmethod.Anumberofotherdatastructuresfornearestneighborsearchingbasedonhierarchicalspatialdecompositionshavebeenproposed。Yianilosintroducedthevp-tree[Yia93]。Ratherthanusinganaxis—alignedplanetosplitanodeasinkd-tree,itusesadatapoint,calledthevantagepoint,asthecenterofahyperspherethatpartitionsthespaceintotworegions.Therehasalsobeenquiteabitofinterestfromthe_eldofdatabases.Thereareseveraldat(yī)astructuresfordatabaseapplicationsbasedonR-treesandtheirvariants[BKSS90,SRF87]。Forexample,theX—tree[BKK96]improvestheperformanceoftheR*—treebyavoidinghighoverlap.AnotherexampleistheSR—tree[KS97]。TheTV—tree[LJF94]usesadifferentmetherdtodealwithhighdimensionalspaces.Itreducesdimensionalitybymaintaininganumberofactivedimensions。Whenalldatapointsinanodesharethesamecoordinat(yī)eofanactivedimension,thatdimensionwillbedeactivat(yī)edandthesetofactivedimensionsshifts.Inthispaperwestudytheperformanceoftwoothersplittingmethods,andcomparethemagainstthekd—treesplittingmethod。Thefirst,calledsliding-midpoint,isasplittingmethodthat(yī)wasintroducedbyMountandAryaintheANNlibraryforapproximatenearestneighborsearching[MA97].Thismethodwasintroducedintothelibraryinordertobetterhandlehighlyclustereddatasets.Weknowofnoanalysis(empiricalortheoretical)ofthismethod.Thismethodwasdesignedasasimpletechniqueforaddressingoneofthemostseriousflawsinthestandardkd-treesplittingmethod。Theflawisthatwhenthedatapointsarehighlyclusteredinlowdimensionalsubspaces,thenthestandardkd-treesplittingmethodmayproducehighlyelongat(yī)edcells,andthesecanleadtoslowquerytimes.Thissplittingmethodstartswithasimplemidpointsplitofthelongestsideofthecell,butifthissplitresultsineithersubcellcontainingnodatapoints,ittranslates(or“slides”)thesplittingplaneinthedirectionofthepointsuntilhittingthefirrstdat(yī)apoint。InSection3。1wedescribethissplittingmethodandanalyzesomeofitsproperties.Thesecondsplittingmethod,calledminimum—ambiguity,isaquery-basedtechnique.Thetreeisgivennotonlythedatapoints,butalsoacollectionofsamplequerypoints,calledthetrainingpoints。Thealgorithmappliesagreedyheuristictobuildthetreeinanat(yī)tempttominimizetheexpectedquerytimeonthetrainingpoints.Wemodelqueryprocessingastheproblemofeliminat(yī)ingdatapointsfromconsiderationasthepossiblecandidatesforthenearestneighbor。Givenacollectionofquerypoints,wecanmodelanystageofthenearestneigh-bouralgorithmasabipartitegraph,calledthecandidategraph,whoseverticescorrespondtotheunionofthedatapointsandthequerypoints,andinwhicheachquerypointisadjacenttothesubsetofdatapointsthatmightbeitsnearestneighbor.Theminimum-ambiguityselectsthesplittingplaneateachstagethat(yī)eliminatesthemaximumnumberofremainingedgesinthecandidategraph。InSection3.2wedescribethissplittingmethodingreaterdetail。Weimplementedthesetwosplittingmethods,alongwiththestandardkd-treesplittingmethod.Wecomparedthemonanumberofsyntheticallygenerat(yī)edpointdistributions,whichweredesignedtomodellow-dimensionalclustering。Webelievethistypeofclusteringisnotuncommoninmanyapplicationdatasets[JD88]。Weusedsyntheticdatasets,asopposedtostandardbenchmarks,sothatwecouldadjustthestrengthanddimensionalityoftheclustering。Ourresultssh-owthatthesenewsplittingmethodscanprovidesigni_cantimprovementsoverthestandardkd-treesplittingmethodfordatasetswithlow-dimensionalcluster-ing.Therestofthepaperisorganizedasfollows。Inthenextsectionwepresentbackgroundinformationonthekd-treeandhowtoperformnearestneighborsea-rchesinthistree.InSection3wepresentthetwonewsplittingmethods.InSection4wedescribeourimplementationandpresentourempiricalresults.2。BackgroundInthissectionwedescribehowkd-treesareusedforperformingexactandapproximatenearestneighborsearching.Bentleyintroducedthekd—treeasagen-eralizat(yī)ionofthebinarysearchtreeinhigherdimensions[Ben75]。Eachnodeofthetreeisimplicitlyassociatedwithad—dimensionalrectangle,calleditscell.Therootnodeisassociat(yī)edwiththeboundingrectangle,whichenclosesallofthedat(yī)apoints。Eachnodeisalsoimplicitlyassociatedwiththesubsetofdatapointsthat(yī)liewithinthisrectangle。(Datapointslyingontheboundarybetweentworectangles,maybeassociat(yī)edwitheither。)Ifthenumberofpointsassociatedwithanodefallsbelowagiventhreshold,calledthebucketsize,thenthisnodeisaleaf,andthesepointsarestoredwiththeleaf。(Inourexperimentsweusedabucketsizeofone.)Otherwise,theconstructionalgorithmselectsasplittinghyp—erplane,whichisorthogonaltooneofthecoordinateaxesandpassesthroughthecell.Thereareanumberofsplittingmethodsthatmaybeusedforchoosingthishyperplane。Wewilldiscusstheseingreaterdetailbelow.Thehyperplanesubdi-videstheassociat(yī)edcellintotwosubrectangles,whicharethenassociatedwiththechildrenofthisnode,andthepointsaresubdividedamongthesechildrenaccordingtowhichsideofthehyperplanetheylie.Eachinternalnodeofthetreeisassociatedwithitssplittinghyperplane(whichmaybegivenastheindexoftheorthogonalaxisandacuttingvaluealongthisaxis).Friedman,BentleyandFinkel[FBF77]presentanalgorithmto_ndthenear-estneighborusingthekd-trees。Theyintroducethefollowingsplittingmethod,whichwecallthestandardsplittingmethod.Foreachinternalnode,thesplittinghyperplaneischosentobeorthogonaltotheaxisalongwhichthepointshavethegreatestspread(di_erenceofmaximumandminimum).Thesplittingpointisch—osenatthemediancoordinate,sothatthetwosubsetsofdat(yī)apointshavenearly—qualsizes.TheresultingtreehasO(n)sizeandO(logn)height.WhiteandJain[WJ96]proposedanalternative,calledtheVAM—split,withthesamebasicidea,butthesplittingdimensionischosentobetheonewiththemaximumvariance.Queriesareansweredbyasimplerecursivealgorithm。Inthebasiscase,whenthealgorithmarrivesataleafofthetree,itcomputesthedistancefromthequerypointtoeachofthedatapointsassociatedwiththisnode。Thesmallestsuchdist-tanceissaved.Whenarrivingataninternalnode,it_rstdeterminesthesideoftheassociatedhyperplaneonwhichthequerypointlies.Thequerypointisnece—ssarilyclosertothischild’scell.Thesearchrecursivelyvisitsthischild.Onretu-rningfromthesearch,itdetermineswhetherthecellassociatedwiththeotherchildisclosertothequerypointthantheclosestpointseensofar。Ifso,thenthischildisalsovisitedrecursively.Whenthesearchreturnsfromtheroot,theclos-estpointseenisreturned.Animportantobservationisthatforeachquerypoint,everyleafwhosedistancefromthequerypointislessthanthenearestneighborwillbevisitedbythealgorithm。Itisaneasymattertogeneralizethissearchalgorithmforansweringapprox—imatenearestneighborqueries。Letεdenotetheallowederrorbound。Intheprocessingofaninternalnode,thefurtherchildisvisitedonlyifitsdistancefromthequerypointislessthanthedistancetotheclosestpointsofar,dividedby(1+ε)。Aryaetal.[AMN+98]showthecorrectnessofthisprocedure。Theyalsoshowhowtogeneralizethesearchalgorithmforcomputingthek—closestneighbors,eitherexactlyorapproximately.AryaandMount[AM93a]proposedanumberofimprovementstothisbasicalgorithm.Thefirstiscalledincrementaldistancecalculation.ThistechniquecanbeappliedforanyMinkowskimetric.Inadditiontostoringthesplittinghyperplane,eachinternalnodeofthetreealsostorestheextentsofassociatedcellprojectedorthogonallyontoitssplittingaxis.Thealgorithmdoesnotmain-taintruedistances,butinstead(fortheEuclideanmetric)maintainssquareddistances.Whenthealgorithmarrivesataninternalnode,itmaintainsthesquareddistancefromthequerypointtotheassociatedcell。Theyshowthatinconstanttime(independentofdimension)itispossibletousethisinformationtocomputethesquareddistancetoeachofthechildren’scell。Theyalsopresentedamethodcalledprioritysearch,whichusesaheaptovisittheleavesofthetreeinincreas—ingorderofdistancefromthequerypoint,ratherthanintherecursiveorderdica—tatedbythestructureofthetree.Yetanotherimprovementisawell-knowntech-niquefromnearestneighborsearching,calledpartialdistancecalculation[BG85,Spr91]。Whencomputingthedistancebetweenthequerypointandadatapoint,iftheaccumulatedsumofsquaredcomponentseverexceedsthesquareddistancetothenearestpointsofar,thenthedistancecomputationisterminated.Oneoftheimportantelementsofapproximatenearestneighborsearching,whichwasobservedbyAryaetal。[AMN+98],isthattherearetwoimportantpropertiesofanydatastructureforapproximat(yī)enearestneighborsearchingbas-edonspatialdecomposition.Balanc

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯系上傳者。文件的所有權益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
  • 6. 下載文件中如有侵權或不適當內容,請與我們聯系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論