查找相似项目


Finding similar items (including LSH)

Given a large set of text documents, find pairs that are near duplicates.

Problems:

A. Many small pieces of one document can appear out og order in another.

B. Too many documents to compare all pairs.

C. Documents are so large or so many that they cannot fit in main theory.


Locality sensitive hashing

Three steps:

1.Shingling: convert documents to sets.

(used hashing to assign each shingle an ID)

2.convert large sets to short signatures, while preserving similarity

We used similarity preserving hashing to generate signature.

We used  hashing to get around generating random permutations.

3.locality-sensitive hashing: Focus on pairs of signatures likely to be from similar documents.

We used hashing to find candidate pairs of

     similarity >=s

 

1.Shingles example:

 

Hash the singles in order to reduce the space. 

In order to find similar items(such as docs, pic.)We usually compare all of the items . So the time is vast. This is the motivation for the minhash/LSH

 

2.with the problem of 1.we:

A. Encode the set of shingles using 0/1 vectors.

B. Build the boolean matrix 

The matrix is 

 

We can finding similar columns using the following formula

 

But comparing all paris may take too much time, so hash columns(signatures) is put forward. 

C.hash the columns. The result is also called signatures.

 

Minhashing example  

 

 

 So we achieve the goal. Compressed long bit vectors into short signatures.And the note is :

 

 

3.LSH

Goal: find documents with jaccard similarity at least s. 

LSH(general idea): use a function f(x,y) that tells wether x and y is a candidate pair: a pair of elements whose similarity must be evaluated.

Method:

Split signatures into bands and hash them. Documents with similar signatures get hashed into same buckets: candidate pairs.

Here we use bands:

A. Partition M into bands.

B. Hashing the bands.

Example:

 

 

 

Assumption :  

 

the pairs in the same bucket is called candidate pair.

The method can cause the false positive and false negatives.

1.false negative

 

 

2. False positive

 

 

So there is a tradeoff:


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值