Skip to content

Commit

Permalink
Added more faiss metrics to cast
Browse files Browse the repository at this point in the history
This commit adds l1, jaccard and cannebera to the existing metrics.
Signed-off-by: sarveshwar-s <59520591+sarveshwar-s@users.noreply.github.com>
  • Loading branch information
sarveshwar-s committed Aug 23, 2024
1 parent 936e9a9 commit c6bdaf2
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions autofaiss/utils/cast.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ def to_faiss_metric_type(metric_type: Union[str, int]) -> int:
return faiss.METRIC_INNER_PRODUCT
elif metric_type in ["l2", "L2", faiss.METRIC_L2]:
return faiss.METRIC_L2
elif metric_type in ["l1", "L1", faiss.METRIC_L1]:
return faiss.METRIC_L1
elif metric_type in ["jaccard", "JACCARD", faiss.METRIC_Jaccard]:
return faiss.METRIC_Jaccard
elif metric_type in ["canberra", "CANBERRA", faiss.METRIC_Canberra]:
return faiss.METRIC_Canberra
else:
raise ValueError("Metric currently not supported")

Expand Down

0 comments on commit c6bdaf2

Please sign in to comment.