Type: | Package |
Title: | Landmark Multi-Dimensional Scaling |
Version: | 0.1.0 |
Description: | A fast dimensionality reduction method scaleable to large numbers of samples. Landmark Multi-Dimensional Scaling (LMDS) is an extension of classical Torgerson MDS, but rather than calculating a complete distance matrix between all pairs of samples, only the distances between a set of landmarks and the samples are calculated. |
License: | GPL-3 |
Encoding: | UTF-8 |
LazyData: | true |
Imports: | assertthat, dynutils (≥ 1.0.3), irlba, Matrix |
Suggests: | testthat |
RoxygenNote: | 6.1.1 |
URL: | http://github.com/dynverse/lmds |
BugReports: | https://github.com/dynverse/lmds/issues |
Collate: | 'cmdscale_landmarks.R' 'select_landmarks.R' 'lmds.R' 'package.R' |
NeedsCompilation: | no |
Packaged: | 2019-09-19 12:12:04 UTC; rcannood |
Author: | Robrecht Cannoodt |
Maintainer: | Robrecht Cannoodt <rcannood@gmail.com> |
Repository: | CRAN |
Date/Publication: | 2019-09-27 09:10:02 UTC |
Landmark MDS
Description
A fast dimensionality reduction method scaleable to large numbers of samples. Landmark Multi-Dimensional Scaling (LMDS) is an extension of classical 'Torgerson MDS', but rather than calculating a complete distance matrix between all pairs of samples, only the distances between a set of landmarks and the samples are calculated.
A fast dimensionality reduction method scaleable to large numbers of samples. Landmark Multi-Dimensional Scaling (LMDS) is an extension of classical Torgerson MDS´, but rather than calculating a complete distance matrix between all pairs of samples, only the distances between a set of landmarks and the samples are calculated.
Usage
lmds(x, ndim = 3, distance_method = c("euclidean", "pearson",
"spearman", "cosine", "manhattan"), landmark_method = c("sample"),
num_landmarks = 500)
Arguments
x |
A matrix, optionally sparse. |
ndim |
The number of dimensions |
distance_method |
The distance metric to use. Options are "euclidean" (default), "pearson", "spearman", "cosine", "manhattan". |
landmark_method |
The landmark selection method to use. Options are "sample" (default). |
num_landmarks |
The number of landmarks to use, |
Value
The dimensionality reduction in the form of a nrow(x)
by ndim
matrix.
Examples
library(Matrix)
x <- Matrix::rsparsematrix(1000, 1000, .01)
lmds(x, ndim = 3)
Perform MDS on landmarks and project other samples to the same space
Description
Perform MDS on landmarks and project other samples to the same space
Usage
cmdscale_landmarks(dist_2lm, ndim = 3, rescale = TRUE, ...)
Arguments
dist_2lm |
Distance matrix between the landmarks and all the samples in original dataset |
ndim |
The number of dimensions |
rescale |
Whether or not to rescale the final dimensionality reduction (recommended) |
... |
Extra params to pass to |
Value
The dimensionality reduction in the form of a ncol(dist_2lm)
by ndim
matrix.
Examples
library(Matrix)
x <- as.matrix(iris[,1:4])
dist_2lm <- select_landmarks(x)
cmdscale_landmarks(dist_2lm)
Select landmarks from dataset
Description
In addition, the distances between the landmarks and all samples are calculated.
Usage
select_landmarks(x, distance_method = c("euclidean", "pearson",
"spearman", "cosine", "manhattan"), landmark_method = c("sample"),
num_landmarks = 500)
Arguments
x |
A matrix, optionally sparse. |
distance_method |
The distance metric to use. Options are "euclidean" (default), "pearson", "spearman", "cosine", "manhattan". |
landmark_method |
The landmark selection method to use. Options are "sample" (default). |
num_landmarks |
The number of landmarks to use, |
Value
The distance matrix between the landmarks and all samples. In addition, an attribute "landmark_ix"
denotes the indices of landmarks that were sampled.
Examples
library(Matrix)
x <- Matrix::rsparsematrix(1000, 1000, .01)
select_landmarks(x)