
Last chance! 50% off unlimited learning
Sale ends in
Exploit k-nearest neighbor algorithms to estimate a sparse matrix measuring the distance, correlation or covariance between two matched datasets. Critical to the validity of this function is the basic mathematical relationships between euclidean distance and correlation and between correlation and covariance. For applications of such matrices, one may see relevant publications by Mauro Maggioni and other authors.
sparseDistanceMatrixXY(x, y, k = 3, r = Inf, sigma = NA,
kmetric = c("euclidean", "correlation", "covariance", "gaussian"),
eps = 1e-06, ncores = NA)
input matrix, should be n (samples) by p (measurements)
input matrix second view, should be n (samples) by q (measurements)
number of neighbors
radius of epsilon-ball
parameter for kernel PCA.
similarity or distance metric determining k nearest neighbors
epsilon error for rapid knn
number of cores to use
matrix sparse p by q matrix is output with p by k nonzero entries
# NOT RUN {
mat = matrix( rnorm(60), nrow=6 )
mat2 = matrix( rnorm(120), nrow=6 )
smat = sparseDistanceMatrixXY( mat, mat2, 3 )
smat2 = sparseDistanceMatrixXY( mat2, mat, 3 )
# }
Run the code above in your browser using DataLab