pynndescent
pynndescent copied to clipboard
Updating a compressed index fails with `AttributeError: 'NNDescent' object has no attribute '_neighbor_graph'`
Minimal example that reproduces the problem:
import numpy as np
from pynndescent import NNDescent
X = np.random.randn(1024, 384).astype(dtype=np.float32)
ann_index = NNDescent(X, metric="cosine", compressed=True)
ann_index.prepare()
X_update = np.random.randn(1024, 384).astype(dtype=np.float32)
ann_index.update(X_update)
Results in an AttributeError: 'NNDescent' object has no attribute '_neighbor_graph'.
With compressed=False this issue doesn't occur.
Thank you for the great package 🙏!
compressed=True indexes are, unfortunately, not updateable; a bunch of the information needed for the update is dropped to compress the whole thing down to be smaller.
Thanks for the clarification! Would it make sense to for instance raise a more informative error when attempting to update a compressed index to help other users know about this limitation?