create_searcher
接口定义
def create_searcher(db: numpy.ndarray, scann_config: str, training_threads: int, docids: numpy.ndarray, kmopt_pq_iter: int, kmopt_pq_sample: int, kmopt_pq_init: int, kmopt_ivf_iter: int, kmopt_ivf_sample: int, kmopt_ivf_init: int, filter_thr: float, filter_type: int) -> scann.scann_ops.ScannSearcher
接口用途
基于入参构建索引并返回ScannSearcher(与开源算法相比增加filter_thr和filter_type参数)。
参数说明
参数名称 |
数据类型 |
描述 |
取值范围 |
|---|---|---|---|
db |
numpy.ndarray |
底库向量。 |
限制非空。 |
scann_config |
字符串 |
构建索引所需的配置文件,包含所有配置参数。 |
- |
training_threads |
int |
设置用于索引构建的线程数。 |
[0, MAXINT],默认为0。 |
docids |
numpy.ndarray |
文档ID。 |
默认None |
kmopt_pq_iter |
int |
PQ中Kmeans迭代次数。 |
[0, MAXINT],默认为0。 |
kmopt_pq_sample |
int |
PQ中KMeans聚类采样子集大小。 |
[0, MAXINT],默认为0。 |
kmopt_pq_init |
int |
PQ中KMeans初始化类型。 |
{0,1,2,3},默认为0。
|
kmopt_ivf_iter |
int |
IVF中Kmeans迭代次数。 |
[0, MAXINT],默认为0。 |
kmopt_ivf_sample |
int |
IVF中KMeans聚类采样子集大小。 |
[0, MAXINT],默认为0。 |
kmopt_ivf_init |
int |
IVF中KMeans初始化类型。 |
{0,1,2,3},默认为0。
|
filter_thr |
float |
过滤阈值。 |
[0, 1],默认为0。 |
filter_type |
int |
过滤类型。 |
0 或 1,默认为0。
|
返回值
数据类型 |
说明 |
|---|---|
scann.scann_ops.ScannSearcher |
开始构建并返回构建好的ScannSearcher。 |