Description Usage Arguments Details Value
This function is a wrapper around a C++ function that calculates pairwise distances in a memory- and CPU-efficient manner.
1 2 3 4 5 6 7 8 9 10 11 12 13 | distance(x, i, j, distance_method, threads = NULL, verbose)
## S3 method for class 'matrix'
distance(x, i, j, distance_method = "Euclidean",
threads = NULL, verbose = getOption("verbose", TRUE))
## S3 method for class 'CsparseMatrix'
distance(x, i, j, distance_method = "Euclidean",
threads = NULL, verbose = getOption("verbose", TRUE))
## S3 method for class 'TsparseMatrix'
distance(x, i, j, distance_method = "Euclidean",
threads = NULL, verbose = getOption("verbose", TRUE))
|
x |
A (potentially sparse) matrix, where examples are columns and features are rows. |
i |
0-indexed vector of column indices. |
j |
0-indexed vector of column indices. |
distance_method |
One of "Euclidean" or "Cosine." |
threads |
The maximum number of threads to spawn. Determined automatically if |
verbose |
Verbosity. |
The Euclidean or angular distances between columns in 'x' identified by parameters 'i' and 'j' are calculated and returned.
A vector of the distances between the columns in 'x' indexed by 'i' and 'j', with attribute method
giving the distance_method
.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.