Description Usage Arguments Value Author(s) Examples
Linear multiple output cross validation using multiple possessors
1 2 3 4 |
x |
design matrix, matrix of size N \times p. |
y |
response matrix, matrix of size N \times K. |
intercept |
should the model include intercept parameters. |
weights |
sample weights, vector of size N \times K. |
grouping |
grouping of features, a factor or vector of length p. Each element of the factor/vector specifying the group of the feature. |
groupWeights |
the group weights, a vector of length m (the number of groups). |
parameterWeights |
a matrix of size K \times p. |
alpha |
the α value 0 for group lasso, 1 for lasso, between 0 and 1 gives a sparse group lasso penalty. |
lambda |
lambda.min relative to lambda.max or the lambda sequence for the regularization path. |
d |
length of lambda sequence (ignored if |
fold |
the fold of the cross validation, an integer larger than 1 and less than N+1. Ignored if |
cv.indices |
a list of indices of a cross validation splitting.
If |
max.threads |
Deprecated (will be removed in 2018),
instead use |
use_parallel |
If |
algorithm.config |
the algorithm configuration to be used. |
Yhat |
the cross validation estimated response matrix |
Y.true |
the true response matrix, this is equal to the argument |
cv.indices |
the cross validation splitting used |
features |
number of features used in the models |
parameters |
number of parameters used in the models. |
Martin Vincent
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 | set.seed(100) # This may be removed, it ensures consistency of the daily tests
## Simulate from Y=XB+E, the dimension of Y is N x K, X is N x p, B is p x K
N <- 50 #number of samples
p <- 25 #number of features
K <- 15 #number of groups
B<-matrix(sample(c(rep(1,p*K*0.1),rep(0, p*K-as.integer(p*K*0.1)))),nrow=p,ncol=K)
X1<-matrix(rnorm(N*p,1,1),nrow=N,ncol=p)
Y1 <-X1%*%B+matrix(rnorm(N*K,0,1),N,K)
## Do cross validation
fit.cv <- lsgl::cv(X1, Y1, alpha = 1, lambda = 0.1, intercept = FALSE)
## Cross validation errors (estimated expected generalization error)
Err(fit.cv)
## Do the same cross validation using 2 parallel units
cl <- makeCluster(2)
registerDoParallel(cl)
fit.cv <- lsgl::cv(X1, Y1, alpha = 1, lambda = 0.1, intercept = FALSE, use_parallel = TRUE)
stopCluster(cl)
Err(fit.cv)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.