Description Usage Arguments Value References Examples
Fits a kernel multitask regression (KMR) model.
1 2 3 |
x |
Input matrix of covariates, of dimension |
y |
Output matrix of responses. |
kx_type |
Kernel for observations. |
kx_option |
An optional list of parameters for the observation kernel,
including elements such as " |
kt_type |
Kernel for tasks. |
kt_option |
An optional list of parameters for the task kernel,
including elements such as " |
An object (list) of class "kmr"
, which can then be used to make
predictions for the different tasks on new observations.
Bernard, E., Jiao, Y., Scornet, E., Stoven, V., Walter, T., and Vert, J.-P. (2017). Kernel multitask regression for toxicogenetics. bioRxiv-171298.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | # 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)
# Case I: with linear kernel for x and empirical kernel for t
# Train
mo1 <- kmr(x=xtrain, y=ytrain, kx_type="linear", kt_type="empirical")
# Predict
pred1 <- predict(mo1, xtest)
# Evaluate
evalpred(pred1, ytest, "mse")
# Case II: with precomputed kernel matrices
# Kernel matrices
kxtrain <- tcrossprod(xtrain)
kxtest <- tcrossprod(xtest,xtrain)
kttrain <- cor(ytrain)
# Train
mo2 <- kmr(x=kxtrain, y=ytrain, kx_type="precomputed",
kt_type="precomputed", kt_option=list(kt=kttrain))
# Predict
pred2 <- predict(mo2, kxtest)
# Evaluate
evalpred(pred2, ytest, "mse")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.