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
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t291.92
up here, 128.
291.92
298.4
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t292.92
I'm also going to say how many, so how many results do we want to return?
292.92
301.4
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t298.4
I'm going to say 10.
298.4
303.12
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t301.4
Okay.
301.4
306.12
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t303.12
We also need to import FI's before we do anything.
303.12
308.74
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t306.12
And then we can initialize our index.
306.12
310.6
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t308.74
So I said we have two.
308.74
316.8
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t310.6
So we have FI's index flat 02 or IP.
310.6
319.8
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t316.8
I'm going to use IP because it's very slightly faster.
316.8
325.74
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t319.8
It seems from me testing it, it's very slightly faster, but there's hardly any difference
319.8
326.74
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t325.74
in reality.
325.74
329.88
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t326.74
So initializes our index and then we want to add our data to it.
326.74
334.16
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t329.88
So we add WB and then we perform a search.
329.88
344.48
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t334.16
So let me create a new cell and let me just run this quickly.
334.16
351.28
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t344.48
Okay.
344.48
355.4
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t351.28000000000003
And what I'm going to do is just time it so you can see how long this takes as well.
351.28
363.28
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t355.40000000000003
So I'm going to do time and we're going to do index or sorry, DI equals index search.
355.4
369.92
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t363.28
And in here we have our query vector and how many samples we'd like to return.
363.28
370.92
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t369.91999999999996
So I'm going to go with K.
369.92
377.36
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t370.91999999999996
Okay.
370.92
383
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t377.35999999999996
So that was reasonably quick and that's because we don't have a huge data set and we're just
377.36
384.12
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t383.0
searching for one query.
383
386.76
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t384.11999999999995
So it's not really too much of a problem there.
384.12
392.96
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t386.76
But what I do want to show you is, so if we print out I that returns all of the IDs or
386.76
398.16
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t392.96
the indexes of the 10 most similar vectors.
392.96
404.8
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t398.15999999999997
Now I'm going to use that as a baseline for each of our other indexes.
398.16
410.44
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t404.79999999999995
So this is, like I said, 100% quality and we can use this accuracy to test out other
404.8
411.86
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t410.44
indexes as well.
410.44
417.16
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t411.85999999999996
So what I'm going to do is take that and convert it into a list.
411.86
421
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t417.15999999999997
And if we just have a look at what we get, we see that we get a list like that.
417.16
427.84
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t421.0
And we're just going to use that, like I said, to see how our other indexes are performing.
421
429.6
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t427.84
So we'll move on to the other indexes.
427.84
434.24
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t429.6
And like I said before, we want to try and go from this, which is the flat indexes, which
429.6
438.04
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t434.24
is 100% search quality to something that's more 50-50.
434.24
439.74
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t438.04
But it depends on our use case as well.
438.04
443.2
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t439.74
Sometimes we might want more speed, sometimes higher quality.
439.74
448.84
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t443.2
So we will see a few of those through these indexes.
443.2
451.12
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t448.84
So we start with LSH.
448.84
453.56
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t451.11999999999995
So a very high level.
451.12
458.68
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t453.56
LSH works by grouping vectors in two different buckets.
453.56
464
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t458.67999999999995
Now what we can see on the screen now is a typical hashing function for like a Python
458.68
465.52
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t464.0
dictionary.
464
470.56
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t465.52
And what these hashing functions do is they try to minimize collisions.
465.52
478.16
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t470.55999999999995
So collision is where we would have the case of two items, maybe say these two, being hashed
470.56
479.64
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t478.16
into the same bucket.
478.16
484.72
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t479.64000000000004
And with a dictionary, you don't want that because you want every bucket to be an independent
479.64
485.72
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t484.72
value.
484.72
492.48
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t485.72
Otherwise, it increases the complexity of extracting your values from a single bucket
485.72
493.64
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t492.48
if they've collided.
492.48
498.12
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t493.64000000000004
Now LSH is slightly different because we actually do want to group things.
493.64
500.68
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t498.12
So we can see it as a dictionary.
498.12
506
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t500.68
But rather than where before we were avoiding those collisions, you can see here we're putting
500.68
509.36
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t506.0
them into completely different buckets every time.
506
512.44
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t509.36
Rather than doing that, we're trying to maximize collisions.
509.36
518.08
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t512.44
So you can see here that we've pushed all three of these keys into this single bucket
512.44
519.76
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t518.08
here.
518.08
523.06
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t519.76
And we've also pushed all of these keys into this single bucket.
519.76
525.32
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t523.06
So we get groupings of our values.
523.06
532.52
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t525.32
Now when it comes to performing our search, we process our query through the same hashing
525.32
536.12
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t532.52
function and that will push it to one of our buckets.
532.52
542.52
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t536.12
Now in the case of maybe appearing in this bucket here, we use Hamming Distance to find
536.12
552.48
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t542.52
the nearest bucket and then we can search or we restrict our scope to these values.
542.52
557.84
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t552.48
So we just restricted our scope there, which means that we do not need to search through
552.48
558.84
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t557.84
everything.
557.84
563.56
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t558.84
We are avoiding searching through those values down there.
558.84
566.66
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t563.5600000000001
Now let's have a look at how we implement that.
563.56
568
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t566.6600000000001
So it's pretty straightforward.
566.66
572.9
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t568.0
All we do is index, we do vise index LSH.
568
577.44
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t572.9
We have our dimensionality and then we also have this other variable which is called nbits.
572.9
582.12
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t577.44
So I will put that in a variable up here.
577.44
587.56
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t582.12
Do nbits and what I'm going to do is I'm going to make it d multiplied by 4.
582.12
593.44
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t587.56
So nbits we will have to scale with the dimensionality of our data which comes into another problem
587.56
597.96
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t593.4399999999999
which I'll mention later on which is the curse of dimensionality.
593.44
601.06
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t597.9599999999999
But I'll talk more about it in a moment.
597.96
607.72
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t601.06
So here we have nbits and then we add our data like we did before and then we can search
601.06
610.96
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t607.7199999999999
our data just like we did before.
607.72
623.24
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t610.96
So time and we do d pi equals index search and we are searching using our query, our
610.96
630.6
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t623.24
search query and we want to return 10 items.
623.24
637.12
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t630.6
So quicker speed, see here.
630.6
645.96
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t637.12
And what we can also do is compare the results to our 100% quality index or flat index and
637.12
654.72
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t645.96
we do that using numpy in 1D baseline i.
645.96
659.2
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t654.72
Okay so I'm just going to look at it visually here so we can see we have quite a lot of
654.72
660.2
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t659.2
matches here.
659.2
663.6
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t660.2
So plenty of trues, couple of falses, true, false, false, false.
660.2
672.04
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t663.6
So these are the top 10 that have been returned using our LSH algorithm and we're checking
663.6
679.08
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t672.0400000000001
if they exist in the baseline results that we got from our flat index earlier and we're
672.04
682.64
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t679.08
returning that most of them are present in that baseline.
679.08
686.68
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t682.64
So most of them do match so it's a reasonably good recall there.
682.64
688
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t686.6800000000001
So that's good and it was faster.
686.68
691.4
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t688.0
So we've got 17.6 milliseconds here.
688
693.08
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t691.4
How much did we get up here?
691.4
696.74
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t693.08
We got 157 milliseconds.
693.08
702.66
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t696.74
So slightly less accurate but what is that 10 times faster so it's pretty good.
696.74
704.96
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t702.6600000000001
And we can mess around with n bits.
702.66
710.36
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t704.96
We can increase it to increase the accuracy of our index or we decrease it to increase
704.96
711.72
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t710.36
the speed.
710.36
714.6
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t711.72
So again it's just trying to find that balance between them both.
711.72
721.58
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t714.6
Okay so this is a graph just showing you the recalls with different n bit values.
714.6
728.06
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t721.58
So as we sort of saw before we increase the n bits value for good recall but at the same
721.58
730
Choosing Indexes for Similarity Search (Faiss in Python)
2021-08-09 15:04:10 UTC
https://youtu.be/B7wmo_NImgM
B7wmo_NImgM
UCv83tO5cePwHMt1952IVVHw
B7wmo_NImgM-t728.0600000000001
time we have that curse of dimensionality.
728.06
738.32