Description Usage Arguments Details Value Author(s) See Also Examples
Perform kmeans clustering in preparation for a KMKNN nearestneighbors search.
1  buildKmknn(X, transposed=FALSE, distance=c("Euclidean", "Manhattan"), ...)

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. 
... 
Further arguments to pass to 
This function is automatically called by findKmknn
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
.
A KmknnIndex object containing:
data
, a numeric matrix with points in the columns and dimensions in the rows, i.e., transposed relative to the input.
Points have also been reordered to improve data locality during the nearestneighbor search.
Specifically, points in the same cluster are contiguous and ordered by increasing distance from the cluster center.
clusters
, itself a list containing:
centers
, a numeric matrix of cluster center coordinates where each column corresponds to a cluster.
info
, another list of length equal to the number of clusters.
Each entry corresponds to a column of centers
(let's say cluster j) and is a list of length 2.
The first element is the zeroindex of the first cell in the output X
that is assigned to j.
The second element is the distance of each point in the cluster from the cluster center.
order
, an integer vector specifying how rows in X
have been reordered in columns of data
.
NAMES
, a character vector or NULL
equal to rownames(X)
.
distance
, a string specifying the distance metric used.
Aaron Lun
See kmeans
for optional arguments.
See KmknnIndex
for details on the output class.
See findKmknn
, queryKmknn
and findNeighbors
for dependent functions.
1 2 3  Y < matrix(rnorm(100000), ncol=20)
out < buildKmknn(Y)
out

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.