Skip to content

Commit 620bdb7

Browse files
authored
Update README.md
1 parent 24a9e1b commit 620bdb7

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

README.md

+11-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# Hnswlib - fast approximate nearest neighbor search
22
Header-only C++ HNSW implementation with python bindings. Paper code for the HNSW 200M SIFT experiment
33

4+
**NEWS:**
5+
6+
**Thanks to Louis Abraham (@louisabraham) hnswlib is now can be installed via pip!**
7+
48
Highlights:
59
1) Lightweight, header-only, no dependencies other than C++ 11.
610
2) Interfaces for C++, python and R (https://github.com/jlmelville/rcpphnsw).
@@ -26,7 +30,7 @@ Note that inner product is not an actual metric. An element can be closer to som
2630

2731
For other spaces use the nmslib library https://github.com/nmslib/nmslib.
2832

29-
#### short API description
33+
#### Short API description
3034
* `hnswlib.Index(space, dim)` creates a non-initialized index an HNSW in space `space` with integer dimension `dim`.
3135

3236
Index methods:
@@ -45,7 +49,7 @@ Index methods:
4549
* `resize_index(new_size)` - changes the maximum capacity of the index. Not thread safe with `add_items` and `knn_query`.
4650

4751
* `set_ef(ef)` - sets the query time accuracy/speed trade-off, defined by the `ef` parameter (
48-
[ALGO_PARAMS.md](ALGO_PARAMS.md)).
52+
[ALGO_PARAMS.md](ALGO_PARAMS.md)). Note that the parameter is currently not saved along with the index, so you need to set it manually after loading.
4953

5054
* `knn_query(data, k = 1, num_threads = -1)` make a batch query for `k` closests elements for each element of the
5155
* `data` (shape:`N*dim`). Returns a numpy array of (shape:`N*k`).
@@ -166,13 +170,18 @@ print("Recall for two batches:", np.mean(labels.reshape(-1) == np.arange(len(dat
166170
```
167171

168172
### Bindings installation
173+
174+
You can install from sources:
169175
```bash
170176
apt-get install -y python-setuptools python-pip
171177
pip3 install pybind11 numpy setuptools
172178
cd python_bindings
173179
python3 setup.py install
174180
```
175181

182+
or you can install via pip:
183+
`pip install hnswlib`
184+
176185
### Other implementations
177186
* Non-metric space library (nmslib) - main library(python, C++), supports exotic distances: https://github.com/nmslib/nmslib
178187
* Faiss libary by facebook, uses own HNSW implementation for coarse quantization (python, C++):

0 commit comments

Comments
 (0)