Skip to content

Commit 04515af

Browse files
committed
Tidied up the README.
1 parent 4255dd6 commit 04515af

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

README.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,15 @@ Check out the [reference documentation](https://knncolle.github.io/knncolle-py)
5050

5151
## Switching algorithms
5252

53-
We can easily switch to a different algorithm by just passing a different `params` object.
53+
We can easily switch to a different NN search algorithm by supplying a different `params` object.
5454
For example, we could use the [Approximate Nearest Neighbors Oh Yeah](https://github.com/spotify/annoy) (Annoy) algorithm:
5555

5656
```python
5757
an_params = knncolle.AnnoyParameters()
5858
an_idx = knncolle.build_index(an_params, y)
5959
```
6060

61-
We can also tweak the search parameters in our `Parameters` object, during or after construction.
61+
We can also tweak the search parameters in our `Parameters` object during or after its construction.
6262
For example, with the [hierarchical navigable small worlds](https://github.com/nmslib/hnswlib) (HNSW) algorithm:
6363

6464
```python
@@ -67,12 +67,12 @@ h_params.ef_construction = 150
6767
h_idx = knncolle.build_index(h_params, y)
6868
```
6969

70-
Currently, we support Annoy, HNSW, vantage point trees, k-means k-nearest neighbors, and (for testing) an exhaustive brute-force search.
70+
Currently, we support Annoy, HNSW, vantage point trees, k-means k-nearest neighbors, and an exhaustive brute-force search.
7171
More algorithms can be added by extending **knncolle** as described [below](#extending-to-more-algorithms) without any change to end-user code.
7272

7373
## Other searches
7474

75-
Given a query dataset, we can find the nearest neighbors in the prebuilt search index:
75+
Given a separate query dataset of the same dimensionality, we can find the nearest neighbors in the prebuilt NN search index:
7676

7777
```python
7878
q = numpy.random.rand(20, 50)
@@ -91,7 +91,8 @@ var_res.distance
9191
```
9292

9393
We can find all observations within a distance threshold of each observation via `find_neighbors()`.
94-
This also supports a variable threshold for each observation as well as querying of observations in a separate dataset.
94+
The related `query_neighbors()` function handles querying of observations in a separate dataset.
95+
Both functions also accept a variable threshold for each observation.
9596

9697
```python
9798
range_res = knncolle.find_neighbors(idx, threshold=10)
@@ -101,9 +102,9 @@ range_res.distance
101102

102103
## Use with C++
103104

104-
The raison d'être of the **knncolle** Python package is to enable re-use within ([**pybind11**](https://pybind11.readthedocs.io)-wrapped) C++ code in other Python packages.
105+
The raison d'être of the **knncolle** Python package is to facilitate the re-use of the neighbor search algorithms by C++ code in other Python packages.
105106
The idea is that downstream packages will link against the **knncolle** C++ interface so that they can re-use the search indices created by the **knncolle** Python package.
106-
This allows downstream packages to (i) save time by avoiding the need to re-compile all algorithms and (ii) support more algorithms in **knncolle** extensions.
107+
This allows developers to (i) save time by avoiding the need to re-compile all desired algorithms and (ii) support more algorithms in extensions to the **knncolle** framework.
107108
To do so:
108109

109110
1. Add `knncolle.includes()` and `assorthead.includes()` to the compiler's include path for the package.
@@ -160,7 +161,7 @@ PYBIND11_MODULE(lib_downstream, m) {
160161
}
161162
```
162163
163-
A pointer to the `knncolle::Builder` is then be created in Python by the `define_builder()` function, and then passed to C++:
164+
A pointer to the `knncolle::Builder` can be created by the `define_builder()` function in Python, and then passed to the C++ code:
164165
165166
```python
166167
from . import lib_downstream as lib

0 commit comments

Comments
 (0)