Giter VIP home page Giter VIP logo

Comments (11)

erikbern avatar erikbern commented on May 22, 2024

Yes seems like this
https://github.com/spotify/annoy/blob/master/src/annoylib.h#L368
is not respected here:
https://github.com/spotify/annoy/blob/master/src/annoymodule.cc#L108

from annoy.

zhdeath avatar zhdeath commented on May 22, 2024

Thanks for your reply.
My own computer which is also ubuntu 14.04 works fun.
Any idea what I should do with Amazon EC2?

i.get_item_vector(..) always returns [0,0..]

from annoy.

erikbern avatar erikbern commented on May 22, 2024

hm get_item_vector shouldn't return 0... that's weird

from annoy.

zhdeath avatar zhdeath commented on May 22, 2024

it indeed is!
i.get_item_vector(18)
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

even i.get_nns_by_item(18, 10) works
But I need those vectors in my app

from annoy.

erikbern avatar erikbern commented on May 22, 2024

That's strange. Let me add a unit test and try to repro

from annoy.

erikbern avatar erikbern commented on May 22, 2024

I won't have time today unfortunately

from annoy.

a1k0n avatar a1k0n commented on May 22, 2024

@zhdeath can you post a snippet of code of how you're generating your annoy index, and how you're loading and using it?

the return value of load() isn't really of much consequence is it? I think it got changed to return 0 instead of true inadvertently to be more similar to POSIX return values, but it should still work.

from annoy.

erikbern avatar erikbern commented on May 22, 2024

Not able to reproduce...see #72

from annoy.

zhdeath avatar zhdeath commented on May 22, 2024

@a1k0n Worked on these trivial code with 1.2.2 or 1.3.1

from annoy import AnnoyIndex
import random

f = 30
a = AnnoyIndex(f) # length of item vector

n = 1000  # number of vector
for i in xrange(n):
    v = []
    for z in xrange(f):
        v.append(random.gauss(0, 1))
    a.add_item(i, v)

a.build(-1)
a.save('test.tree')

b = AnnoyIndex(f)
b.load('test.tree')
print(i.get_item_vector(10))
print(b.get_nns_by_item(10, 10))

load() returns false, get_item_vector returns [0,0...]; but get_nss_by_item(10,10) works fun. Python is 2.7.6

I think it's version related.
With 1.0.5, load() returns true and get_item_vector() also works

from annoy.

erikbern avatar erikbern commented on May 22, 2024

Hm it seems like the issue is some kind of integer casting.

The item vector looks like this for me:
[1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, -1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, -1, 0, 0, -1, 0]

from annoy.

erikbern avatar erikbern commented on May 22, 2024

I pushed a breaking test to #72

Will now fix it

from annoy.

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.