Git Product home page Git Product logo

mruby-annoy's Introduction

mruby-annoy Build Status

AnnoyIndex class for mruby.

Annoy is a C++ library to search for points in space that are close to a given query point. This mrbgem provides mruby bindings for the library.

Ruby code example

f = 40
t = AnnoyIndex.new(f)  # Length of item vector that will be indexed
1000.times do |i|
  v = f.times.map{rand}
  t.add_item(i, v)
end

t.build(10) # 10 trees
t.save('test.ann')

# ...

u = AnnoyIndex.new(f)
u.load('test.ann') # super fast, will just mmap the file
puts u.get_nns_by_item(0, 1000) # will find the 1000 nearest neighbors

API are compatible with Annoy Full Python API

install by mrbgems

  • add conf.gem line to build_config.rb
MRuby::Build.new do |conf|

    # Avoid build failures when C and C++ mrbgems exist.
    conf.disable_cxx_exception
    conf.linker do |linker|
        linker.libraries = %w(stdc++)
    end

    # ... (snip) ...

    conf.gem :github => 'monochromegane/mruby-annoy'
end

NOTE

  • conf.disable_cxx_exception must be written above conf.gem section.

License

MIT

Author

monochromegane

mruby-annoy's People

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

matsumotory

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.