Description Usage Arguments Value References See Also Examples
Does a kfold crossvalidation for kmr
, and returns a fitted KMR model, CV performance scores and optimal values for the regularization parameter lambda
.
1 2 3 4 5 
x 

y 

kx_type 
Kernel type for observations as in 
kx_option 
Optional list of parameters for the observation kernel as in 
kt_type 
Kernel type for tasks as in 
kt_option 
Optional list of parameters for the task kernel as in 
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
" 
nfolds 
Number of folds for crossvalidation. Default is 5. 
nrepeats 
Number of times the kfold crossvalidation 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. 
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 CVfitted KMR model as in 
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. 
Bernard, E., Jiao, Y., Scornet, E., Stoven, V., Walter, T., and Vert, J.P. (2017). Kernel multitask regression for toxicogenetics. bioRxiv171298.
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")

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.