Giter VIP home page Giter VIP logo

vp-tree's Introduction

vp-tree

A vantage point tree implementation in OCaml.

Cf. http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.41.4193&rep=rep1&type=pdf for details.

A vantage point tree allows to do fast but exact nearest neighbor searches in any space provided that you have a distance function to measure the distance between any two points in that space.

This implementation might need some tweaks in case it is used to index a very large number of points (especially the select_vp function in the code).

vp-tree's People

Contributors

copy avatar igarnier avatar unixjunkie avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

vp-tree's Issues

Switch to dune

Looks like this is the last package I'm using that still uses jbuilder:

% opam uninstall jbuilder 
The following actions will be performed:
  ⊘ remove vpt      4.0.1        [uses jbuilder]
  ⊘ remove jbuilder 1.0+beta20.2

Note on Complexity

Very nice work !

However, VP trees are really useful for mining huge collection of data.
From a quick look at your implementation, I found two issues. One is minor, the second one is more complex.

The minor one is about to_list : it has at least quadratic complexity, since each right sub-tree is traversed twice, on during to_list and once during List.rev_append ; you must use a right-to-left traversal with an accumulator instead, and add each individual vp node with a O(1) cons on it.
Although, since VP tree are expected to be huge, a to-list function is not really useful.

The second issue is that you assume all the data is initially available into one single list, hence it must entirely fit into the memory. Of course, having initially a small list of representative points is useful for building good vantage points using their statistical distribution. But we might want to make that database huge later on.

A more interesting implementation would be to have an abstract layer to access and build the VP tree lazily, hence making us able to back it on disk and only caching some nodes into memory. If you look carefully at the algorithms provided in the reference paper, only a very thin slice of the VP tree is actually required to be loaded into memory when looking for some specific points. That's where VP tree are really amazing.

Although, you shall add a function to insert a new point in the VP tree.

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.