January 2018
Intermediate to advanced
310 pages
7h 48m
English
Approximate nearest neighbour oh yeah (ANNOY) is a method for faster nearest neighbour search. ANNOY builds trees by random projections. The tree structure makes it easier to find the closest matches. You can create an ANNOYIndex for faster retrieval as shown here:
def create_annoy(target_features): t = AnnoyIndex(layer_dimension) for idx, target_feature in enumerate(target_features): t.add_item(idx, target_feature) t.build(10) t.save(os.path.join(work_dir, 'annoy.ann'))create_annoy(target_features)
The dimension of the features is required for creating the index. Then the items are added to the index and the tree is built. The bigger the number of trees, the more accurate the results will ...
Read now
Unlock full access