diff options
author | Yuri Victorovich <yuri@FreeBSD.org> | 2023-01-11 21:24:48 -0800 |
---|---|---|
committer | Yuri Victorovich <yuri@FreeBSD.org> | 2023-01-11 21:25:23 -0800 |
commit | c5c128b186be0150e2d4885d9dde759fc93b25c9 (patch) | |
tree | cf59959ddf6923cd98a71fde122f60eef9b033eb /math/py-annoy/files/test-save.py | |
parent | math/annoy: New port: Approximate Nearest Neighbors in C++ (diff) |
math/py-annoy: New port: Approximate Nearest Neighbors in C++
Diffstat (limited to 'math/py-annoy/files/test-save.py')
-rw-r--r-- | math/py-annoy/files/test-save.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/math/py-annoy/files/test-save.py b/math/py-annoy/files/test-save.py new file mode 100644 index 000000000000..21a8f50df0c0 --- /dev/null +++ b/math/py-annoy/files/test-save.py @@ -0,0 +1,12 @@ +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') |