Skip to content

lshSizing

lshSizing(threshold, k, weights?): LshSizing

Defined in: packages/distillate/src/minhash/sizing.ts:91

Bands and rows for an LSH index over k-slot signatures, chosen as datasketch does: a pair at similarity s becomes a candidate with probability 1 - (1 - s^rows)^bands, and the pair minimising weights[0] * falsePositive + weights[1] * falseNegative around threshold wins. Balanced weights put the curve’s midpoint near the threshold, so pairs just above it are found most of the time, not always. The search tries every split of k, so its cost grows with k: about 10 ms at 128 and a few hundred ms at 4096.

number

Jaccard similarity that should make a pair a candidate.

number

Slots in each signature.

readonly [number, number] = ...

Cost of a false positive and of a false negative; sum to 1.

LshSizing