new BallTree(elementsopt, metricopt) → {BallTree}
Generates a BallTree with given elements
.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
elements | Array | <optional> | null | Elements which should be added to the BallTree |
metric | function | <optional> | euclidean | metric to use: (a, b) => distance |
- Source
Returns:
- Type:
- BallTree
Methods
add(elements) → {BallTree}
Parameters:
Name | Type | Description |
---|---|---|
elements | Array.<*> | new elements. |
- Source
Returns:
- Type:
- BallTree
search(t, kopt) → {Heap}
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
t | * | query element. | ||
k | Number | <optional> | 5 | number of nearest neighbors to return. |
- Source
Returns:
- Heap consists of the
k
nearest neighbors.
- Type:
- Heap