Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The best tutorial I have seen for LSH is in the book: Mining of Massive Datasets. Check Chapter 3 - Finding Similar Items <a href="http://infolab.stanford.edu/~ullman/mmds/ch3a.pdf" rel="noreferrer">http://infolab.stanford.edu/~ullman/mmds/ch3a.pdf</a></p> <p>Also I recommend the below slide: <a href="http://www.cs.jhu.edu/%7Evandurme/papers/VanDurmeLallACL10-slides.pdf" rel="noreferrer">http://www.cs.jhu.edu/%7Evandurme/papers/VanDurmeLallACL10-slides.pdf</a> . The example in the slide helps me a lot in understanding the hashing for cosine similarity.</p> <p>I borrow two slides from <a href="http://www.cs.jhu.edu/~vandurme/papers/VanDurmeLallACL10-slides.pdf" rel="noreferrer">Benjamin Van Durme &amp; Ashwin Lall, ACL2010</a> and try to explain the intuitions of LSH Families for Cosine Distance a bit. <img src="https://i.stack.imgur.com/xYCSJ.png" alt="enter image description here"></p> <ul> <li>In the figure, there are two circles w/ <strong>red</strong> and <strong>yellow</strong> colored, representing two two-dimensional data points. We are trying to find their <a href="http://en.wikipedia.org/wiki/Cosine_similarity" rel="noreferrer">cosine similarity</a> using LSH.</li> <li>The gray lines are some uniformly randomly picked planes.</li> <li>Depending on whether the data point locates above or below a gray line, we mark this relation as 0/1. </li> <li>On the upper-left corner, there are two rows of white/black squares, representing the signature of the two data points respectively. Each square is corresponding to a bit 0(white) or 1(black). </li> <li>So once you have a pool of planes, you can encode the data points with their location respective to the planes. Imagine that when we have more planes in the pool, the angular difference encoded in the signature is closer to the actual difference. Because only planes that resides between the two points will give the two data different bit value. </li> </ul> <p><img src="https://i.stack.imgur.com/27nSY.png" alt="enter image description here"></p> <ul> <li>Now we look at the signature of the two data points. As in the example, we use only 6 bits(squares) to represent each data. This is the LSH hash for the original data we have.</li> <li>The hamming distance between the two hashed value is 1, because their signatures only differ by 1 bit.</li> <li>Considering the length of the signature, we can calculate their angular similarity as shown in the graph.</li> </ul> <p>I have some sample code (just 50 lines) in python here which is using cosine similarity. <a href="https://gist.github.com/94a3d425009be0f94751" rel="noreferrer">https://gist.github.com/94a3d425009be0f94751</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload