MCPcopy Create free account
hub / github.com/dblalock/bolt / transform

Method transform

python/bolt/bolt_api.py:515–524  ·  view source on GitHub ↗
(self, q, unquantize=False)

Source from the content-addressed store, hash-verified

513 self._n = len(X)
514
515 def transform(self, q, unquantize=False):
516 if self.reduction == Reductions.DOT_PRODUCT:
517 func = self._encoder_.dot_prods
518 elif self.reduction == Reductions.SQUARED_EUCLIDEAN:
519 func = self._encoder_.dists_sq
520 else:
521 self._bad_reduction()
522
523 ret = func(self._preproc(q))[:self._n]
524 return (ret - self._total_offset_) / self.scale if unquantize else ret
525
526 def knn(self, q, k):
527 if self.reduction == Reductions.DOT_PRODUCT:

Callers 4

test_time_space_savingsFunction · 0.95
test_basicFunction · 0.95
test_smoketestFunction · 0.80
test_unquantizeFunction · 0.80

Calls 2

_bad_reductionMethod · 0.95
_preprocMethod · 0.95

Tested by 4

test_time_space_savingsFunction · 0.76
test_basicFunction · 0.76
test_smoketestFunction · 0.64
test_unquantizeFunction · 0.64