iheartradio / all2vec Goto Github PK
View Code? Open in Web Editor NEWLibrary to store and process sets of high dimensional vectors
License: Apache License 2.0
Library to store and process sets of high dimensional vectors
License: Apache License 2.0
In Python 3.6 this throws an error "TypeError: can't pickle AnnoyIndex objects":
from all2vec import EntitySet
t = EntitySet(2)
t.create_entity_type(entity_type_id=0, entity_type='test', ntrees=1)
t.add_item(0, 0, [0,0])
t.build()
t.save('test_all2vec_model')
The error is thrown at line 254:
252 pickle_filepath = os.path.join(folder, 'object.pickle') 253 with open(pickle_filepath, 'wb') as handle: 254 dill.dump(self, handle) 255 files.append(pickle_filepath) 256
I have these versions installed:
all2vec==0.6.0
annoy==1.8.3
Any reason why get_similar_vector sorts by score prior to returning the list while get_scores_vector doesn't?
get_similar('user', user, 'product', 100000000)
returns
all2vec/__init__.py in get_similar(self, entity_type, entity_id, match_type, num_similar, oversample, normalize)
168 match_vector = self.get_vector(entity_type, entity_id)
169 return self.get_similar_vector(
--> 170 match_vector, match_type, num_similar, oversample, normalize)
171
172 def get_scores_vector(self, vector, match_type, match_id_array, normalize):
all2vec/__init__.py in get_similar_vector(self, match_vector, match_type, num_similar, oversample, normalize)
156
157 similar_items = self._annoy_objects[match_type].get_nns_by_vector(
--> 158 match_vector, num_similar, search_k)
159 # compute inner products, and sort
160 scores = self.get_scores_vector(
all2vec/__init__.py in get_nns_by_vector(self, vec, n, search_k)
67 """Get nearest neighbors from an input vector."""
68 nns = self._ann_obj.get_nns_by_vector(vec, n, search_k)
---> 69 return [self._ann_map_inv[x] for x in nns]
70
71 def get_item_vector(self, entity_id):
TypeError: 'NoneType' object is not iterable
Digging deeper, it looks like all2vec is not properly capturing this ANNOY error
> u.get_nns_by_vector([1] * num_dimensions, 100000000, search_k = 100000000 * 100)
---------------------------------------------------------------------------
OverflowError Traceback (most recent call last)
OverflowError: signed integer is greater than maximum
This error will come up whenever n or search_k is larger than the maximum integer.
We never updated the change log for the 0.2 release: https://github.com/iheartradio/all2vec/blob/master/CHANGES.rst
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.