lmcinnes / lmcinnes/pynndescent

NNDescent.update() fails even for compressed or uncompressed indexes

Open
#173 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
970
Forks
107
PR merge metrics
No merged PRs in 30d

Description

$ conda install -c conda-forge pynndescent
$ ipython --version
8.0.1
$ python --version
Python 3.9.7
>>> import pynndescent as pynn
>>> pynn.__version__
'0.5.6'

I'm unable to update the index to append new vectors to the existing NN graph, whether or not the initial graph is compressed.
vecs and vecs2 contain 300D GloVe Vectors:

>>> index = NNDescent(vecs, metric="cosine", compressed=False)
>>> index.update(vecs2)
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Input In [147], in <module>
----> 1 index.update(vecs2)

File ~/anaconda3/envs/nessvec/lib/python3.9/site-packages/pynndescent/pynndescent_.py:1614, in NNDescent.update(self, X)
   1609 rng_state = current_random_state.randint(INT32_MIN, INT32_MAX, 3).astype(
   1610     np.int64
   1611 )
   1612 X = check_array(X, dtype=np.float32, accept_sparse="csr", order="C")
-> 1614 original_order = np.argsort(self._vertex_order)
   1616 if self._is_sparse:
   1617     self._raw_data = sparse_vstack([self._raw_data, X])

AttributeError: 'NNDescent' object has no attribute '_vertex_order'

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in pynndescent/pynndescent_.py at NNDescent.update(), especially around line 1614 where _vertex_order is accessed. Reproduce the reported 300D GloVe vecs/vecs2 setup for compressed=False and compressed indexes, then verify that update appends vectors without raising AttributeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.