You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+7-7Lines changed: 7 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -41,18 +41,18 @@ For other spaces use the nmslib library https://github.com/nmslib/nmslib.
41
41
*`hnswlib.Index(space, dim)` creates a non-initialized index an HNSW in space `space` with integer dimension `dim`.
42
42
43
43
`hnswlib.Index` methods:
44
-
*`init_index(max_elements, ef_construction = 200, M = 16, random_seed = 100)` initializes the index from with no elements.
44
+
*`init_index(max_elements, M = 16, ef_construction = 200, random_seed = 100)` initializes the index from with no elements.
45
45
*`max_elements` defines the maximum number of elements that can be stored in the structure(can be increased/shrunk).
46
46
*`ef_construction` defines a construction time/accuracy trade-off (see [ALGO_PARAMS.md](ALGO_PARAMS.md)).
47
47
*`M` defines tha maximum number of outgoing connections in the graph ([ALGO_PARAMS.md](ALGO_PARAMS.md)).
48
48
49
-
*`add_items(data, data_labels, num_threads = -1)` - inserts the `data`(numpy array of vectors, shape:`N*dim`) into the structure.
50
-
*`labels` is an optional N-size numpy array of integer labels for all elements in `data`.
49
+
*`add_items(data, ids, num_threads = -1)` - inserts the `data`(numpy array of vectors, shape:`N*dim`) into the structure.
51
50
*`num_threads` sets the number of cpu threads to use (-1 means use default).
52
-
*`data_labels` specifies the labels for the data. If index already has the elements with the same labels, their features will be updated. Note that update procedure is slower than insertion of a new element, but more memory- and query-efficient.
51
+
*`ids` are optional N-size numpy array of integer labels for all elements in `data`.
52
+
- If index already has the elements with the same labels, their features will be updated. Note that update procedure is slower than insertion of a new element, but more memory- and query-efficient.
53
53
* Thread-safe with other `add_items` calls, but not with `knn_query`.
54
54
55
-
*`mark_deleted(data_label)` - marks the element as deleted, so it will be omitted from search results.
55
+
*`mark_deleted(label)` - marks the element as deleted, so it will be omitted from search results.
56
56
57
57
*`resize_index(new_size)` - changes the maximum capacity of the index. Not thread safe with `add_items` and `knn_query`.
58
58
@@ -113,7 +113,7 @@ num_elements = 10000
113
113
114
114
# Generating sample data
115
115
data = np.float32(np.random.random((num_elements, dim)))
116
-
data_labels= np.arange(num_elements)
116
+
ids= np.arange(num_elements)
117
117
118
118
# Declaring index
119
119
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
0 commit comments