-
Notifications
You must be signed in to change notification settings - Fork 748
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add algo descartes(01AI) * Remove the link to Descartes and add it back after the product is released in the future. * add link to descartes * Using the GitHub:https://github.com/xiaoming-01ai/descartes.git
- Loading branch information
1 parent
708c67f
commit 0f6ad75
Showing
5 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,7 @@ jobs: | |
- balltree | ||
- bruteforce | ||
- ckdtree | ||
- descartes | ||
- diskann | ||
- dolphinnpy | ||
- elasticsearch | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
FROM ann-benchmarks | ||
|
||
RUN apt update | ||
RUN apt install -y git cmake g++ python3 python3-setuptools python3-pip libblas-dev liblapack-dev | ||
RUN pip3 install wheel pybind11==2.5.0 | ||
|
||
WORKDIR /home/app | ||
RUN git clone https://github.com/xiaoming-01ai/descartes.git | ||
RUN pip3 install descartes/descartes-*-linux_x86_64.whl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
float: | ||
any: | ||
- base_args: ['@metric'] | ||
constructor: fng | ||
disabled: false | ||
docker_tag: ann-benchmarks-descartes | ||
module: ann_benchmarks.algorithms.descartes | ||
name: descartes(01AI) | ||
run_groups: | ||
FNG: | ||
args: | ||
M: [32, 64, 96, 128] | ||
L: [128, 256, 320, 384, 448] | ||
S: [1, 2, 3] | ||
query_args: | ||
[ | ||
[0, 1, 2, 3], | ||
[10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 150, 200, 250, 300, 350, 400, 500, 600] | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import py01ai | ||
import numpy as np | ||
from ..base.module import BaseANN | ||
import logging | ||
|
||
class fng(BaseANN): | ||
def __init__(self, metric, method_param): | ||
self.metric = {"angular": "angular", "euclidean": "square_l2"}[metric] | ||
self.method_param = method_param | ||
self.name = "01ai (%s)" % (self.method_param) | ||
|
||
def fit(self, X): | ||
self.index = py01ai.FNGIndex(metric=self.metric, dimension=len(X[0])) | ||
self.index.init(count=len(X), | ||
m=self.method_param["M"], | ||
s=self.method_param["S"], | ||
l=self.method_param["L"]) | ||
try: | ||
self.index.add_vector(input=np.asarray(X)) | ||
except Exception as e: | ||
print(str(e)) | ||
|
||
def set_query_arguments(self, ex, ef): | ||
self.search_ef = ef | ||
self.search_ex = ex | ||
self.index.set_query_param(ef=ef, ex=ex) | ||
|
||
def query(self, v, n): | ||
return self.index.search(query=v, topk=n) | ||
|
||
def freeIndex(self): | ||
del self.index | ||
|
||
def __str__(self): | ||
m = self.method_param['M'] | ||
s = self.method_param['S'] | ||
l = self.method_param['L'] | ||
ef = self.search_ef | ||
ex = self.search_ex | ||
return "01ai(M=%s S=%s L=%s EF=%s EX=%s)" % (m, s, l, ef, ex) |