| MLSVD | R Documentation |
Computes the top-M truncated SVD of a matrix. Dispatches
internally between a direct (tall matrices), Gram (wide matrices), and
randomized path based on the shape of X.
Wraps the C++ MLSVD::compute(X, M) static method.
MLSVD$new()Initialize the solver with its dispatch thresholds.
MLSVD$new(min_dim_thresh = 10000, block_size = 1024, n_threads = NULL)
min_dim_threshInteger (default 10000). The direct path (a
Jacobi SVD that copies X and computes every singular triplet) is
taken while min(n, p) is below it; above it, and when
M < min(n, p) / 10, the randomized path runs two block-wise
passes over X without a copy (the route for a large
mmap_matrix). p > 2 n always takes the Gram path.
block_sizeInteger (default 1024): the column block of the block-wise passes.
n_threadsInteger, the thread budget of the matrix products
(NULL, the default: the library's default budget,
trex_get_num_threads(), initially 1).
MLSVD$compute()Compute top-M singular value decomposition of X.
MLSVD$compute(X, M)
XA numeric matrix (n x p), or an mmap_matrix (bound
zero-copy; "readonly" suffices).
MInteger, number of singular components to retain.
Named list with:
U Left singular vectors (n x M).
S Singular values (M).
V Right singular vectors (p x M).
MLSVD$clone()The objects of this class are cloneable with this method.
MLSVD$clone(deep = FALSE)
deepWhether to make a deep clone.
G. Guennebaud, B. Jacob et al., Eigen v3, https://libeigen.gitlab.io/, 2010.
Other ML methods:
MLElasticNet,
MLElasticNetCV,
MLLpNormScaler,
MLPCA,
MLRidge,
MLRidgeCV,
MLZScoreScaler,
ml_agglomerative_cluster(),
ml_cut_tree(),
ml_distance_metric,
ml_linkage_method
set.seed(42)
X <- matrix(rnorm(50 * 10), 50, 10)
solver <- MLSVD$new()
res <- solver$compute(X, M = 3)
dim(res$U) # 50 x 3
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.