buildVptree | R Documentation |
Build a vantage point tree in preparation for a nearest-neighbors search.
buildVptree(
X,
transposed = FALSE,
distance = c("Euclidean", "Manhattan", "Cosine")
)
X |
A numeric matrix where rows correspond to data points and columns correspond to variables (i.e., dimensions). |
transposed |
Logical scalar indicating whether |
distance |
String specifying the type of distance to use. |
This function is automatically called by findVptree
and related functions.
However, it can be called directly by the user to save time if multiple queries are to be performed to the same X
.
Points in X
are reordered to improve data locality during the nearest-neighbor search.
Specifically, points in the same cluster are contiguous and ordered by increasing distance from the cluster center.
The function also reports a list containing four vectors of equal length describing the structure of the VP tree. Each parallel element specifies a node:
The first integer vector specifies the column index of data
of the current node.
The second integer vector specifies the column index of the left child of the current node,
The third integer vector specifies the column index of the right child of the current node.
The fourth numeric vector specifies the radius of the current node.
All indices here are zero-based, with child values set to -1 for leaf nodes.
A VptreeIndex object containing indexing structures for the VP-tree search.
Aaron Lun
VptreeIndex, for details on the output class.
findVptree
and queryVptree
, for dependent functions.
Y <- matrix(rnorm(100000), ncol=20)
out <- buildVptree(Y)
out
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.