You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: annoy-rb does not require the installation of another external library.
In addition, annoy-rb does not give any optimization options when building native extensions.
If necessary, add optimization options yourself during installation, as follows;
require'annoy'f=40# length of item vector that will be indexed.t=Annoy::AnnoyIndex.new(n_features: f,metric: 'angular')1000.timesdo |i|
v=Array.new(f){rand}t.add_item(i,v)endt.build(10)# 10 trees.t.save('test.ann')u=Annoy::AnnoyIndex.new(n_features: f,metric: 'angular')u.load('test.ann')pu.get_nns_by_item(0,100)# will find the 100 nearest neighbors.
With the default argument, annoy-rb uses double precision floating point type for the data type of vector element.
On the other hand, the Python bindings of Annoy use single precision floating point type.
If you want to load a search index created with the Python bindings, specify 'float32' to the dtype argument.
The gem is available as open source under the terms of the Apache-2.0 License.
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/yoshoku/annoy-rb.
This project is intended to be a safe, welcoming space for collaboration,
and contributors are expected to adhere to the Contributor Covenant code of conduct.
About
annoy-rb provides Ruby bindings for the Annoy (Approximate Nearest Neighbors Oh Yeah).