【E2LSH源碼分析】E2LSH函數介面

來源:互聯網
上載者:User

標籤:p穩定分布lsh   e2lsh   

上一小節,我們對E2LSH代碼主要的源碼架構和用到的資料結構作了簡單介紹(http://blog.csdn.net/jasonding1354/article/details/38331229),這一節我將簡單介紹一下E2LSH的主要函數介面。

1、構建R-NN資料結構(定義在NearNeighbors.h)

輸入為1-δ、R、d和資料集P,利用下面函數來構建:

PRNearNeighborStructTinitSelfTunedRNearNeighborWithDataSet(RealT thresholdR,                                      RealT successProbability,                                      Int32T nPoints,                                      IntT dimension,                                      PPointT *dataSet,                                      IntT nSampleQueries,                                      PPointT *sampleQueries)

該函數會估計最優參數k,m,L並根據上述參數來構建R-NN資料結構
參數說明:

■ sampleQueries——查詢樣本資料集

sampleQueries可以是查詢資料集中的資料,也可以是資料集P中的資料

■ nSampleQueries指明資料集sampleQueries的資料點個數

函數返回值為已構建的R-NN資料結構。

2、查詢操作(定義在NearNeighbors.h)

Int32T getRNearNeighbors(PRNearNeighborStructT nnStruct,                         PPointT queryPoint,                         PPointT *(&result),                         IntT &resultSize)
參數說明:

■ nnStruct——進行查詢操作的R-NN資料結構

■ queryPoint——待查詢資料點

■ result—— 最近鄰儲存的數組

■ resultSize——result數組的大小

該函數getRNearNeighbors返回查詢的最近鄰的個數。
3、估計最優參數(定義在SelfTuning.h)

RNNParametersT computeOptimalParameters(RealT R,                                        RealT successProbability,                                        IntT nPoints,                                        IntT dimension,                                        PPointT *dataSet,                                        IntT nSampleQueries,                                        PPointT *sampleQueries)

參數說明:

■ sampleQueries——查詢樣本資料集

sampleQueries可以是查詢資料集中的資料,也可以是資料集P中的資料

■ nSampleQueries指明資料集sampleQueries的資料點個數

4、針對最優參數構建R-NN資料結構(定義在LocalitySensitiveHashing.h)

PRNearNeighborStructT initLSH_WithDataSet(RNNParametersT algParameters,                                          Int32T nPoints,                                          PPointT *dataSet)
■ algParameters——指定R-NN結構的參數
該函數返回構建的資料結構。



轉載請註明作者及文章出處:http://blog.csdn.net/jasonding1354/article/details/38356573

參考資料:

1、M.Datar,N.Immorlica,P.Indyk,and V.Mirrokni,“Locality-SensitiveHashing Scheme Based on p-Stable Distributions,”Proc.Symp. ComputationalGeometry, 2004.

2、A.Andoni,P.Indyk.E2lsh:Exact Euclidean locality-sensitive hashing.http://web.mit.edu/andoni/www/LSH/.2004.


聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.