Description Usage Arguments Value Examples
This function use k-fold cross-valiation method to optimize the sparsity of right singular values
1 2 3 4 5 |
x |
input matrix |
nf |
number of component |
kv.opt |
optional value for sparsity on right singular value |
ku.opt |
optional value for sparsity on left singular value |
wv |
weight for columns |
wu |
weight for rows |
pos |
whether retein non-negative results |
tol |
convergence tolerance |
verbose |
if print the progress |
ncores |
the number of cores used, passed to mclapply |
fold |
fold number in cross validation |
nstart |
how many time the k-fold cross validation should be done |
seed |
set seed |
loorss |
if the Leave-one-out procedure should be used in matrix reconstruction |
scan |
if the sum of PRESS should be plotted |
nsd |
the n*sd for selecting k automatically |
maiter |
maximum number of iteration |
list consist of two matrix. - cvv - The PRESS for right singular vector, mean and sd - cvu - the PRESS for left singular vector, mean and sd - sel.v - the selected v - sel.u - the selected u
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | ###
seed <- rnorm(8)
noise1 <- matrix(rnorm(8*15, sd = 0.3), 15, 8)
noise2 <- matrix(rnorm(8*20, sd = 0.3), 8, 20)
noise1[1:4, ] <- noise1[1:4, ] + rbind(seed, seed, seed, seed)
noise2[, 1:6] <- noise2[, 1:6] + seed
mat <- noise1 %*% noise2
dim(mat)
cv <- cv.softSVD(x = mat, nf = 1, kv.opt = 1:10, ku.opt = 1:8)
boxplot(cv$cvu$press)
boxplot(cv$cvv$press)
#' cv <- cv.softSVD(x = mat, nf = 1, kv.opt = 1:10, ku.opt = 1:8, scan = TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.