cv.kmr: Cross-validation for KMR

Description Usage Arguments Value References See Also Examples

Description

Does a k-fold cross-validation for kmr, and returns a fitted KMR model, CV performance scores and optimal values for the regularization parameter lambda.

Usage

1
2
3
4
5
cv.kmr(x, y, kx_type = c("linear", "gaussian", "precomputed"),
  kx_option = list(sigma = 1), kt_type = c("multitask", "empirical",
  "precomputed"), kt_option = list(alpha = 1, kt = NULL),
  lambda = 10^(-5:5), type.measure = c("ci", "mse", "cor"), nfolds = 5,
  nrepeats = 1, seed = 9182456, mc.cores = 1)

Arguments

x

x input matrix as in kmr.

y

y output matrix as in kmr.

kx_type

Kernel type for observations as in kmr.

kx_option

Optional list of parameters for the observation kernel as in kmr.

kt_type

Kernel type for tasks as in kmr.

kt_option

Optional list of parameters for the task kernel as in kmr.

lambda

Sequence of (more than one) values for lambda that must be tested. Default is 10^(-5:5).

type.measure

Measure type for evaluating performance. Possible options are "ci" (concordance index), "mse" (mean squared error), "cor" (pearson correlation). Default is "ci".

nfolds

Number of folds for cross-validation. Default is 5.

nrepeats

Number of times the k-fold cross-validation is performed Default is 1.

seed

A seed number for the random number generator (useful to have the same CV splits).

mc.cores

Number of parallelable CPU cores to use.

Value

An object (list) of class "cv.kmr", which can then be used to make predictions for the different tasks on new observations, as a list containing the following slots:

...

Outputs of a CV-fitted KMR model as in "kmr".

meanCV

A matrix of CV performance scores of dim ntask x nlambda.

bestlambda

A vector of lambdas of length ntask, each corresp to the underlying min CV score.

bestCV

A vector of min CV performance scores of length ntask.

lambda

Lambda sequence against which a model is tested.

type.measure

Measure type for evaluating performance.

References

Bernard, E., Jiao, Y., Scornet, E., Stoven, V., Walter, T., and Vert, J.-P. (2017). Kernel multitask regression for toxicogenetics. bioRxiv-171298.

See Also

kmr

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
# Data
ntr <- 80
ntst <- 20
nt <- 50
p <- 20
xtrain <- matrix(rnorm(ntr*p),ntr,p)
xtest <- matrix(rnorm(ntst*p),ntst,p)
ytrain <- matrix(rnorm(ntr*nt),ntr,nt)
ytest <- matrix(rnorm(ntst*nt),ntst,nt)

# Train with Gaussian RBF kernel for x and multitask kernel for t
cvmo <- cv.kmr(x=xtrain, y=ytrain, kx_type="gaussian", kx_option=list(sigma=100), 
               kt_type="multitask", kt_option=list(alpha=0.5), type.measure="mse")
# Plot
plot(cvmo)
# Predict
cvpred <- predict(cvmo, xtest)
# Evaluate
evalpred(cvpred, ytest, "mse")

jpvert/kmr documentation built on May 20, 2019, 7:56 a.m.