summaryrefslogtreecommitdiff
path: root/math/py-annoy/files/test-save.py
diff options
context:
space:
mode:
Diffstat (limited to 'math/py-annoy/files/test-save.py')
-rw-r--r--math/py-annoy/files/test-save.py12
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')