crossval_o2m: Cross-validate procedure for O2PLS

Description Usage Arguments Details Value Examples

View source: R/Crossval_OmicsPLS.R

Description

Cross-validate procedure for O2PLS

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
crossval_o2m(
  X,
  Y,
  a,
  ax,
  ay,
  nr_folds,
  nr_cores = 1,
  stripped = TRUE,
  p_thresh = 3000,
  q_thresh = p_thresh,
  tol = 1e-10,
  max_iterations = 100
)

Arguments

X

Numeric matrix. Vectors will be coerced to matrix with as.matrix (if this is possible)

Y

Numeric matrix. Vectors will be coerced to matrix with as.matrix (if this is possible)

a

Vector of positive integers. Denotes the numbers of joint components to consider.

ax

Vector of non-negative integers. Denotes the numbers of X-specific components to consider.

ay

Vector of non-negative integers. Denotes the numbers of Y-specific components to consider.

nr_folds

Positive integer. Number of folds to consider. Note: kcv=N gives leave-one-out CV. Note that CV with less than two folds does not make sense.

nr_cores

Positive integer. Number of cores to use for CV. You might want to use detectCores(). Defaults to 1.

stripped

Logical. Use the stripped version of o2m (usually when cross-validating)?

p_thresh

Integer. If X has more than p_thresh columns, a power method optimization is used, see o2m2

q_thresh

Integer. If Y has more than q_thresh columns, a power method optimization is used, see o2m2

tol

Double. Threshold for which the NIPALS method is deemed converged. Must be positive.

max_iterations

Integer. Maximum number of iterations for the NIPALS method.

Details

This is the standard CV approach. It minimizes the sum of the prediction errors of X and Y over a three-dimensional grid of integers. Parallelization is possible on all platforms. On Windows it uses makePSOCKcluster, then exports all necessary objects to the workers, and then calls parLapply. On OSX and Linux the more friendly mclapply is used, which uses forking. A print method is defined, printing the minimizers and minimum in a readable way. Also the elapsed time is tracked and reported.

Value

List of class "cvo2m" with the original and sorted Prediction errors and the number of folds used.

Examples

1
2
3
4
5
6
local({
X = scale(jitter(tcrossprod(rnorm(100),runif(10))))
Y = scale(jitter(tcrossprod(rnorm(100),runif(10))))
crossval_o2m(X, Y, a = 1:4, ax = 1:2, ay = 1:2,
             nr_folds = 5, nr_cores = 1)
})

OmicsPLS documentation built on May 19, 2021, 5:08 p.m.