ruler {mmsample} | R Documentation |
Rcpp distance calculator
Description
Returns a vector of distances from all rows in vR to the single row uR using ciR as the inverted covariance matrix.
Usage
ruler(vR, uR, ciR)
Arguments
uR |
a vector of length k containing a list of values for all features (k) for the target. Numeric and dense. |
vR |
an n x k matrix containing a matrix of values for all features (k) for all candidates (n). Numeric and dense. |
ciR |
a square k x k matrix containing the inverted covariance matrix for all features (k). Numeric and dense. |
Examples
set.seed(123)
df <- data.frame(x = rpois(10, 20), y = rnorm(10, 50, 10))
cov_inv <- MASS::ginv(cov(df))
mmsample::ruler(as.matrix(df[2:10, ]), as.numeric(df[1, ]), cov_inv)
[Package mmsample version 0.1 Index]