crossval_o2m {OmicsPLS} | R Documentation |
Cross-validate procedure for O2PLS
Description
Cross-validate procedure for O2PLS
Usage
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 |
Y |
Numeric matrix. Vectors will be coerced to matrix with |
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: |
nr_cores |
Positive integer. Number of cores to use for CV. You might want to use |
stripped |
Logical. Use the stripped version of o2m (usually when cross-validating)? |
p_thresh |
Integer. If |
q_thresh |
Integer. If |
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
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)
})