title
stringlengths 12
112
| published
stringlengths 19
23
| url
stringlengths 28
28
| video_id
stringlengths 11
11
| channel_id
stringclasses 5
values | id
stringlengths 16
31
| text
stringlengths 0
596
| start
float64 0
37.8k
| end
float64 2.18
37.8k
|
---|---|---|---|---|---|---|---|---|
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t48.24
|
you have two approaches. You have exhaustive which is comparing all of the data points. I'm just
| 48.24 | 58.96 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t54.88
|
going to call them vectors from now on because that's what we'll be using. So comparing all
| 54.88 | 69.52 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t58.96
|
these vectors and obviously it's slow. Approximate search allows us to approximate those vectors,
| 58.96 | 76 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t69.52000000000001
|
restrict our scope to a more relevant range of vectors and so on. So it cause a lot of different
| 69.52 | 80.24 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t76.0
|
techniques. It's not just one technique here. The one we're going to be covering today is
| 76 | 90.72 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t80.24
|
low-pass sensitive hashing. So at its core LSH is a hashing algorithm which attempts to
| 80.24 | 100.88 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t91.28
|
maximize hash collisions. So what we see on screen right now is a dictionary, like a typical
| 91.28 | 106 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t100.88
|
Python dictionary in the way that it hashes different items. So we have our keys which are
| 100.88 | 114.72 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t106.0
|
items that we're hashing. We process them through a hashing function and that hashing function
| 106 | 124 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t114.72
|
attempts to minimize hashing collisions e.g. to not put keys in the same bucket. It wants every
| 114.72 | 129.2 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t124.0
|
key to go to a separate bucket and then these are connected. Then they don't contain the values but
| 124 | 136.8 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t129.2
|
they're connected to the values that we relate back to our keys. So that's a Python dictionary.
| 129.2 | 143.28 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t136.79999999999998
|
That's our Python dictionary. But we're not wanting to minimize collisions. We are wanting
| 136.8 | 150.48 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t143.28
|
to maximize the collisions. So what we see here is a hashing function that maximizes those
| 143.28 | 159.44 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t150.48
|
collisions. So this is essentially what LSH is doing. So we are attempting to for any similar keys,
| 150.48 | 166.32 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t159.44
|
so these here and these here, they're all similar enough for us to want to put them
| 159.44 | 171.6 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t166.32
|
into the same buckets. So we've put two of them into here and then the other three into this
| 166.32 | 178.08 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t171.6
|
bucket. Now there are quite a few different ways of doing this and there are a lot of different
| 171.6 | 186.16 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t178.08
|
LSH methods. In fact, LSH is a very generic term that applies to a lot of different algorithms.
| 178.08 | 192.16 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t186.16000000000003
|
And the one that we will be covering is what I see as the traditional version. So it is the
| 186.16 | 200.56 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t192.72000000000003
|
original version of LSH. And what we'll be covering in this video is shingling, min hashing,
| 192.72 | 211.76 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t200.56
|
and that LSH function. So we'll get to understand why very soon. So here is the overview of the
| 200.56 | 218.96 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t211.76
|
process that we're going to be walking through. So we have shingling. So we have at the very start,
| 211.76 | 228.72 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t218.96
|
we have this text. So flying fish flew by the space station. Now that's just a string. And
| 218.96 | 237.28 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t228.72
|
what we want to do is extract all of the unique pairs of texts. So when we say shingling, it's
| 228.72 | 244.08 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t237.28
|
k shingling. And in this case, our k value is two because we're taking two characters at once. If
| 237.28 | 252.64 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t244.07999999999998
|
we were to take k equals four, for example, then we would take like pace and then move on, we take
| 244.08 | 260.48 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t252.64
|
ace and a space and so on. So that's the shingling. And from that, we create a set. So
| 252.64 | 269.92 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t261.28
|
if we have duplicate shingles, we remove those. So we just end up with one. So in this, I don't
| 261.28 | 276.96 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t269.91999999999996
|
know if we do have any duplicates, but say maybe down here, we have i n again, because we also have
| 269.92 | 284.16 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t276.96
|
it up here. We would end up with just a single i n in the set. You wouldn't have two. And then we
| 276.96 | 291.36 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t284.15999999999997
|
want to encode those. So that means we take a vocabulary from all of our texts and not just
| 284.16 | 295.52 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t291.35999999999996
|
this one sentence, but we'll have more than one sentence, obviously, that we're comparing. And
| 291.36 | 303.36 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t295.52
|
we'll use that to build a one vector from the vocab and our shingle set. Then we process that
| 295.52 | 309.12 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t303.36
|
through something called a min hash function, which produces this dense vector or signature.
| 303.36 | 315.92 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t309.12
|
So this thing down here, OK, that is what's called a signature.
| 309.12 | 328.16 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t320.64
|
And then we band that into this final bit here. This is our actual LSH process.
| 320.64 | 338 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t328.16
|
So we band that vector into multiple sub vectors and then we hash them. So where we find that we
| 328.16 | 343.68 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t338.0
|
have any two sub vectors go to the same hash bucket, then that means that the full vector
| 338 | 350.56 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t343.68
|
that they both come from is considered, or the two full vectors that they both come from are
| 343.68 | 356.48 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t350.56
|
considered a candidate pair. And we take those and we then calculate some other, we calculate
| 350.56 | 363.84 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t356.48
|
the similarity between them. OK, so first step in our process, like we discussed, is the shingling
| 356.48 | 372.24 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t363.84000000000003
|
operation. So shingling is simply where we take a window of length K characters and we simply move
| 363.84 | 379.28 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t372.24
|
that down through our text, like you can see here. And from that, we create the shingle set.
| 372.24 | 388.88 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t379.28
|
So in Python, what we do to shingle these three sentences we have here is we'll create a
| 379.28 | 396.48 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t389.67999999999995
|
shingle function here. And this is going to take some text, which is a string. And we're going to
| 389.68 | 402.32 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t396.47999999999996
|
say we're going to define the K values of the number of characters we take within each window,
| 396.48 | 407.52 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t402.32
|
which is obviously an integer. Now we initialize the value of the string.
| 402.32 | 415.6 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t407.52
|
Now we initialize our shingle set here. We'll make a string initially. And then what we do is
| 407.52 | 425.2 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t415.59999999999997
|
for i in range. And then here we want to go from the, or we want to go to the length of our text
| 415.6 | 435.12 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t427.68
|
minus K. So minus that window length plus one, because we want to go right up to the end of that.
| 427.68 | 442.32 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t435.12
|
And then here, all we do is shingle set dot append. And then we write,
| 435.12 | 447.84 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t442.32
|
so we have the text and we want to go from i up until i plus K.
| 442.32 | 458.8 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t450.16
|
Okay. That's our shingle list, I suppose. And then we want to return a set. So this will remove
| 450.16 | 467.36 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t458.8
|
any duplicates that we have. So shingle set. Okay. So that's our shingle function. And we
| 458.8 | 475.84 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t467.36
|
just want to process each one of our sentences through that. So we'll go A equals shingle A.
| 467.36 | 482.88 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t477.2
|
Also, we need to define K, which can be two. I'll just define K here.
| 477.2 | 492.64 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t482.88
|
Okay. And then let's have a look at what we have. And we see that we have this, it's shuffle.
| 482.88 | 501.52 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t492.64
|
There's no order to our set here. And we see that we have all of the pairs of words in there.
| 492.64 | 509.52 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t502.15999999999997
|
So we have S for the sort of the space part here or station actually could be either.
| 502.16 | 514.72 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t509.52
|
And if we try and find, okay, so here we have the very sorts of fly or flying.
| 509.52 | 523.6 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t515.52
|
You have the L Y there as well. Iron. So that's our shingle set. And with this,
| 515.52 | 530 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t523.6
|
we have all of our shingles. So the next step is to create our vocabulary, which is just
| 523.6 | 538.56 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t530.0
|
all of our shingles, our shingle sets, a union together. So to create that, all we do is
| 530 | 553.36 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t538.56
|
we go A union B dot union like that. You can see again, we have just a lot more text in there now,
| 538.56 | 561.76 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t553.3599999999999
|
or a lot more, many more shingles. That is our vocab. So now we have our shingle set and we have
| 553.36 | 570.96 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t561.76
|
our vocab. So we can tick both of those off. Now what we need to do is create our one encoding
| 561.76 | 579.12 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t571.68
|
over here. And the only other thing we need is a zero vector. So there's two, well, I mean,
| 571.68 | 583.2 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t579.12
|
there's more than two ways to do this, but I think there's two ways of thinking about it.
| 579.12 | 589.6 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t583.2
|
Normally the more efficient way would be to create a NumPy array full of zeros and then just
| 583.2 | 595.44 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t589.6
|
add the ones in where we have matches between our vocab and shingle set. But I'm not going to do
| 589.6 | 602.4 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t595.44
|
that. I'm just going to keep things like incredibly simple in the code that we're writing.
| 595.44 | 609.92 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t602.4
|
So I'm going to do A, it's one hot. Or the one thing we should do is make this a list because
| 602.4 | 620.96 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t609.92
|
we want order in our vocab and not have it shuffled. So what we do here is we say one for
| 609.92 | 637.44 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t621.5999999999999
|
x in A, or sorry, no, one if x is in A else zero for x in vocab. So what we're doing here is
| 621.6 | 643.84 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t637.44
|
what we're doing here is looping through the vocab and every single shingle within there,
| 637.44 | 651.84 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t643.84
|
we're saying if that exists in our signature, make that point in our list a one, otherwise
| 643.84 | 662.32 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t651.84
|
make it a zero. So that's simply our one hot encoding. So if we do ABC and then we have a look
| 651.84 | 671.12 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t662.32
|
at our A one hot, we see that we have this one hot encoded or this sparse array. Now,
| 662.32 | 678.32 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t671.9200000000001
|
min hashing is the next step in our process and it allows us to convert our what are currently
| 671.92 | 685.28 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t678.32
|
sparse vectors into dense vectors, which we call signatures. Now, what you see here is a run through
| 678.32 | 690.16 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t685.2800000000001
|
of how we do this for maybe one signature. We want to do that for multiple signatures though.
| 685.28 | 695.28 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t690.16
|
So we would actually run through this process multiple times. So what we're doing here is we're
| 690.16 | 704.16 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t695.28
|
creating a randomly permuted array, which counts from one to the length of our vocab. And then
| 695.28 | 710.08 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t704.56
|
what we are essentially doing, I know so in this web, we're basically shuffling it and then we're
| 704.56 | 716.4 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t710.0799999999999
|
counting through until we find the first alignment to one within our vector. In reality, you just
| 710.08 | 725.04 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t716.4
|
take all of your values and you find a minimum one that aligns to one. So that's if you're using
| 716.4 | 730 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t725.04
|
NumPy, which we'll see later on. I'll just show you the code, I'm not going to actually write all
| 725.04 | 739.68 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t730.0
|
of it though. So in code, that would look something like this. So we would start with a list, which is
| 730 | 748.64 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t739.68
|
the range from one to the length of our vocab. And if we have a look at that, we just say account.
| 739.68 | 754.72 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t749.28
|
We're going to shuffle that. So from random import shuffle.
| 749.28 | 766.48 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t759.52
|
And we just do it like this. So it modifies it in place. So we don't need to do anything there. So
| 759.52 | 767.84 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t766.48
|
let's view that.
| 766.48 | 778.8 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t773.6
|
Okay, so now we've shuffled that, shuffled it twice now, but that's fine.
| 773.6 | 788.32 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t779.9200000000001
|
And let's just loop through five of those. So four, we can look for more. Four i in range
| 779.92 | 802.16 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t788.32
|
from one to ten. What we're going to say is, I just want to print i, which aligns to the hash
| 788.32 | 813.6 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t802.1600000000001
|
sample index for that value. Okay, if we print that, we see so one, the value one, where is it?
| 802.16 | 824.96 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t813.6
|
Here is at index 85. Two is at 53 and so on. And essentially what we're doing here is saying,
| 813.6 | 836.48 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t826.0
|
loop through these, identify this index and this index in our one-hot vector. Does it align to a one?
| 826 | 843.28 |
Locality Sensitive Hashing (LSH) for Search with Shingling + MinHashing (Python)
|
2021-08-20 16:00:16 UTC
|
https://youtu.be/e_SBq3s20M8
|
e_SBq3s20M8
|
UCv83tO5cePwHMt1952IVVHw
|
e_SBq3s20M8-t836.48
|
And see that here, we find the first one at eight. And that means our signature value for this
| 836.48 | 852.64 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.