mirror of
https://git.freebsd.org/ports.git
synced 2025-05-01 02:56:39 -04:00
12 lines
260 B
Python
12 lines
260 B
Python
from annoy import AnnoyIndex
|
|
import random
|
|
|
|
f = 40 # Length of item vector that will be indexed
|
|
|
|
t = AnnoyIndex(f, 'angular')
|
|
for i in range(1000):
|
|
v = [random.gauss(0, 1) for z in range(f)]
|
|
t.add_item(i, v)
|
|
|
|
t.build(10) # 10 trees
|
|
t.save('test.ann')
|