Faiss: Creating an exact inner product index with the index_factory method in python

Created on 26 Apr 2018  路  2Comments  路  Source: facebookresearch/faiss

Summary

Using the index_factory in python, I'm not sure how you would create an exact index using the inner product metric. According to this page in the wiki, the index string for both is the same. I already added some vectors to an exact index (it also uses PCA pretransform) using the L2 metric, then tried changing the metric type on the index itself - the distance results were the same before and after. Do I need to create and train the index, then change the metric type before adding any vectors?

Platform

OS: Linux

Faiss version: v1.2.1

Faiss compilation options: installed with Conda

Running on :

  • [x] CPU
  • [ ] GPU

Reproduction instructions

N/A

question

Most helpful comment

index_factory takes a second optional argument for the metric type. I believe the Python bindings would pass the parameter through with something like this:

index = faiss.index_factory(16, "Flat", faiss.METRIC_INNER_PRODUCT)

All 2 comments

index_factory takes a second optional argument for the metric type. I believe the Python bindings would pass the parameter through with something like this:

index = faiss.index_factory(16, "Flat", faiss.METRIC_INNER_PRODUCT)

Closing this, as @Enet4 solved it. Feel free to keep commenting if you have related questions.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

daniellevy picture daniellevy  路  3Comments

xxllp picture xxllp  路  3Comments

hipitt picture hipitt  路  3Comments

lukedeo picture lukedeo  路  3Comments

wwmmqq picture wwmmqq  路  3Comments