Coder Social home page Coder Social logo

What will be affected by adjusting MAX_BLOCK_NUM in H2_ALSH? The default value of MAX_BLOCK_NUM in the code is 4000, if I change it to 1000. about h2_alsh HOT 1 OPEN

eggchai avatar eggchai commented on June 14, 2024
What will be affected by adjusting MAX_BLOCK_NUM in H2_ALSH? The default value of MAX_BLOCK_NUM in the code is 4000, if I change it to 1000.

from h2_alsh.

Comments (1)

HuangQiang avatar HuangQiang commented on June 14, 2024

Hi, thank you for your interest!

For your issue, MAX_BLOCK_NUM is used to control the maximum number of data points in a block. Please refer to lines 44-47 of h2_alsh.cc. By default. I set it to 5,000, considering that the commonly used datasets comprise millions of points.

If you tune it down to 1,000, the number of blocks will increase, and hence the indexing time and index size might increase as we have to build more index (i.e., qalsh) for more blocks. However, the query time might also decrease as you might check fewer points in the first few blocks and stop early if some suitable answers can be found.

Nevertheless, you might not want to keep decreasing MAX_BLOCK_NUM because the index can only offer a little acceleration (as the number of points in a block is small) if the algorithm does not stop early. In the worst case, it will be reduced to an exhaustive linear scan of the data points from the largest to the smallest norm.

My suggestion is that you can (1) extract a small fraction of the data points (e.g., 100 or 200) with the largest norms and (2) directly scan all of them for every query to increase the chance of early termination (and achieve a good candidate with a large inner product value for pruning). Then, tune MAX_BLOCK_NUM (via grid search) to make a trade-off between indexing overhead and query efficiency. For example, some experienced values of MAX_BLOCK_NUM are n/200~n/50.

from h2_alsh.

Related Issues (1)

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.