Skip to content

Commit 1afdce0

Browse files
committed
fixed sample code, data_labels => ids
1 parent 9ba16e2 commit 1afdce0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ num_elements = 10000
113113

114114
# Generating sample data
115115
data = np.float32(np.random.random((num_elements, dim)))
116-
data_labels = np.arange(num_elements)
116+
ids = np.arange(num_elements)
117117

118118
# Declaring index
119119
p = hnswlib.Index(space = 'l2', dim = dim) # possible options are l2, cosine or ip
@@ -122,7 +122,7 @@ p = hnswlib.Index(space = 'l2', dim = dim) # possible options are l2, cosine or
122122
p.init_index(max_elements = num_elements, ef_construction = 200, M = 16)
123123

124124
# Element insertion (can be called several times):
125-
p.add_items(data, data_labels)
125+
p.add_items(data, ids)
126126

127127
# Controlling the recall by setting ef:
128128
p.set_ef(50) # ef should always be > k

0 commit comments

Comments
 (0)