Coder Social home page Coder Social logo

Access to stored vector about hnswlib HOT 5 CLOSED

nmslib avatar nmslib commented on August 15, 2024
Access to stored vector

from hnswlib.

Comments (5)

yurymalkov avatar yurymalkov commented on August 15, 2024 1

Hi @rafael-aero,

You can access the data by using the method char *getDataByInternalId(tableint internal_id) which returns the pointer to the first element in the vector. To get an internal ID of an element you should store the result of HNSW's addPoint(void *data_point, labeltype label, int level).

Right now the element's internal IDs never change. But this probably might be changed in the future.

from hnswlib.

theolivenbaum avatar theolivenbaum commented on August 15, 2024

awesome, thanks for the super quick reply 👍
I'll keep in mind for future versions to check if this is still the case.

from hnswlib.

glennkroegel avatar glennkroegel commented on August 15, 2024

Is there a way of doing this with the python bindings?

The method nmslib.getDataPoint(index, i) doesn't seem to work if you are loading a previously saved index. Executing nmslib.getDataPointQty(index) returns 0 even if the data is loaded (as index.knnQuery does return results).

from hnswlib.

yurymalkov avatar yurymalkov commented on August 15, 2024

@glennkroegel Shouldn't be so. I'll look into it.

from hnswlib.

yurymalkov avatar yurymalkov commented on August 15, 2024

@glennkroegel It seems that you are referencing nmslib, not hnswlib. hnswlib has a different function with similar functionality (get_items). It also should work after saving/loading the index without any problems.

In nmslib's hnsw you need to reload all elements separately from loading the index itself in order to access them (hope @searchivarius will correct me if I am wrong). This is because hnsw in nmslib is using its own data structures.

from hnswlib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.