cv.softSVD: cross-validation for softSVD

Description Usage Arguments Value Examples

Description

This function use k-fold cross-valiation method to optimize the sparsity of right singular values

Usage

1
2
3
4
5
cv.softSVD(x, nf = 1, kv.opt = c(0.3, 0.5, 0.8), ku.opt = c(0.3, 0.5,
  0.8), wv = 1, wu = 1, pos = FALSE, maxiter = 50, init = c("svd",
  "average")[2], tol = sqrt(.Machine$double.eps), verbose = FALSE,
  ncores = 1, fold = 5, nstart = 1, seed = NULL, loorss = FALSE,
  scan = FALSE, nsd = 2)

Arguments

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

Value

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

Examples

 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)

mengchen18/omic3plus documentation built on May 6, 2019, 4:59 p.m.