Rate This Document
Findability
Accuracy
Completeness
Readability

tree

API Definition

def tree(num_leaves: int, num_leaves_to_search: int, training_sample_size: int, min_partition_size: int, training_iterations: int, spherical: bool, quantize_centroids: bool, random_init: bool, soar_lambda: float, overretrieve_factor: float, distance_measure: string) -> scann.scann_ops.py.scann_builder.ScannBuilder

Function

IVF partitioning configuration (consistent with the open source algorithm).

Parameters

Parameter

Description

Data Type

Value Range

num_leaves

Total subspace number in the IVF partition.

int

≥ 1

num_leaves_to_search

Default number of subspaces to be searched.

int

[1, num_leaves], where num_leaves indicates the total number of subspaces in the IVF index partition.

training_sample_size

Number of samples in the base library during partitioned training.

int

[0, number_of_base_libraries]

min_partition_size

Number of base library vectors contained in the smallest partition.

int

[0, number_of_base_libraries]

training_iterations

Number of training iterations.

int

≥ 1

spherical

Indicates whether the partition type is spherical.

Boolean

-

quantize_centroids

Indicates whether to quantize the bucket center.

Boolean

-

random_init

Indicates whether to start training randomly.

Boolean

-

soar_lambda

Controls orthogonality. This parameter takes effect only for the IP (dot_product) dataset.

float

> 0. Set the value to −1 to disable the function.

overretrieve_factor

Used together with soar_lambda to specify the over-retrieval factor. This parameter takes effect only for the IP (dot_product) dataset.

float

[1, 2]. Set the value to −1 to disable the function.

distance_measure

Distance type of the vector.

Character string

dot_product or squared_l2.

Return Value

Data Type

Description

scann.scann_ops.py.scann_builder.ScannBuilder

ScannBuilder is used to receive build parameters.