View source: R/MultiLambdaCVfun.R
optLambdas | R Documentation |
Optimizes a cross-validated score w.r.t. ridge penalties for multiple data blocks.
optLambdas(penaltiesinit = NULL, XXblocks, Y, X1 = NULL, pairing = NULL, folds, intercept = ifelse(is(Y, "Surv"), FALSE, TRUE), frac1 = NULL, score = "loglik", model = NULL, epsIWLS = 0.001, maxItrIWLS = 25, traceCV = TRUE, reltol = 1e-04, optmethod = ifelse(length(penaltiesinit) == 1, "Brent", "Nelder-Mead"), maxItropt = 500, save = FALSE, parallel = FALSE, fixedpen = NULL, fixedseed = TRUE)
penaltiesinit |
Numeric vector. Initial values for penaltyparameters. May be obtained from |
XXblocks |
List of |
Y |
Response vector: numeric, binary, factor or |
X1 |
Matrix. Dimension |
pairing |
Numerical vector of length 3 or |
folds |
List, containing the splits of the samples. Usually obtained by |
intercept |
Boolean. Should an intercept be included? |
frac1 |
Scalar. Prior fraction of cases. Only relevant for |
score |
Character. See Details. |
model |
Character. Any of |
epsIWLS |
Scalar. Numerical bound for IWLS convergence. |
maxItrIWLS |
Integer. Maximum number of iterations used in IWLS. |
traceCV |
Boolean. Should the output of the IWLS algorithm be traced? |
reltol |
Scalar. Relative tolerance for optimization methods. |
optmethod |
Character. Optimization method. Any of the methods |
maxItropt |
Integer. Maximum number of iterations for |
save |
Boolean. If TRUE appends the penalties and resulting CVscore to global variable |
parallel |
Boolean. Should computation be done in parallel? If |
fixedpen |
Integer vector or |
fixedseed |
Boolean. Should the initialization be fixed? For reproducibility. |
See Scoring
for details on score
.
We highly recommend to use smooth scoring functions, in particular "loglik"
.
For ranking-based criteria like auc
and cindex
we advise to use repeated CV (see CVfolds
) to avoid ending up in any of the many local optima.
List, with components:
optres |
Output of the optimizer |
optpen |
Vector with determined optimal penalties |
allsc |
Matrix with CV scores for all penalty parameter configurations used by the optimizer |
optLambdasWrap
for i) (recommended) optimization in two steps: first global, then local; and ii) sequential optimization
when some data types are preferred over others. fastCV2
for initialization of penalties. A full demo and data are available from:
https://drive.google.com/open?id=1NUfeOtN8-KZ8A2HZzveG506nBwgW64e4
data(dataXXmirmeth) resp <- dataXXmirmeth[[1]] XXmirmeth <- dataXXmirmeth[[2]] # Find initial lambdas: fast CV per data block separately. cvperblock2 <- fastCV2(XXblocks=XXmirmeth,Y=resp,kfold=10,fixedfolds = TRUE) lambdas <- cvperblock2$lambdas # Create (repeated) CV-splits of the data. leftout <- CVfolds(Y=resp,kfold=10,nrepeat=3,fixedfolds = TRUE) # One-pass optimization # Increase the number of iterations for optimal results jointlambdas <- optLambdas(penaltiesinit=lambdas, XXblocks=XXmirmeth,Y=resp, folds=leftout,score="loglik",save=T,maxItropt=5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.