Skip to main content

build_tree

Function build_tree 

Source
pub fn build_tree(args: &BuildTreeArgs<'_>) -> Result<()>
Expand description

Builds the tree one level at a time from the top, appending each input vector to its nearest node on that level. Level l reads the first ns^(l+1) representatives, where ns is the number of root entries; the leaf level reads dataset.

Example, root_embeddings.nrows() = ns = 100, total_levels = 3, representatives.shape().0 = R = 1_000_000:

target_level=1: reads first ns^2 = 10_000 of `representatives`
target_level=2: reads first ns^3 = 1_000_000 of `representatives` (all of R)
target_level=3 (== total_levels): reads all of `dataset`