Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reword readme #139

Merged
merged 1 commit into from
Feb 8, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,19 @@

## Creating a tree

The abstract tree type that the trees in this package are a subtype of is called a `NNTree`. A `NNTree`
is created by the function:
There are currently three types of trees available:

* `BruteTree`: Not actually a tree. It linearly searches all points in a brute force fashion. Works with any `Metric`.
* `KDTree`: In a kd tree the points are recursively split into groups using hyper-planes.
Therefore a `KDTree` only works with axis aligned metrics which are: `Euclidean`, `Chebyshev`, `Minkowski` and `Cityblock`.
* `BallTree`: Points are recursively split into groups bounded by hyper-spheres. Works with any `Metric`.

These trees are created with the following syntax:

```jl
NNTree(data, metric; leafsize, reorder)
BruteTree(data, metric; leafsize, reorder)
KDTree(data, metric; leafsize, reorder)
BallTree(data, metric; leafsize, reorder)
```

* `data`: The data, i.e., the points to build up the tree from. It can either be
Expand All @@ -27,12 +36,6 @@ NNTree(data, metric; leafsize, reorder)
* `leafsize` (keyword argument): Determines at what number of points to stop splitting the tree further. There is a trade-off between traversing the tree and having to evaluate the metric function for increasing number of points.
* `reorder` (keyword argument): While building the tree this will put points close in distance close in memory since this helps with cache locality. In this case, a copy of the original data will be made so that the original data is left unmodified. This can have a significant impact on performance and is by default set to `true`.

There are currently three types of trees available:

* `BruteTree`: Not actually a tree. It linearly searches all points in a brute force fashion. Works with any `Metric`.
* `KDTree`: In a kd tree the points are recursively split into groups using hyper-planes.
Therefore a `KDTree` only works with axis aligned metrics which are: `Euclidean`, `Chebyshev`, `Minkowski` and `Cityblock`.
* `BallTree`: Points are recursively split into groups bounded by hyper-spheres. Works with any `Metric`.

All trees in `NearestNeighbors.jl` are static which means that points can not be added or removed from an already created tree.

Expand Down