cv_gflasso | R Documentation |
k-fold Cross Validation for GFLasso
cv_gflasso(X, Y, R, additionalOpts = list(), k = 5, times = 1,
params = seq(0, 1, by = 0.1), nCores = NULL, seed = 100,
err_fun = rmse, err_opt = "min")
X |
The data matrix, scaled and centered as necessary. |
Y |
The matrix of regression responses, scaled and centered as necessary. |
R |
The matrix of (thresholded) correlations between columns of Y. |
additionalOpts |
Additional options to pass alongside lambda and gamma. See merge_proxgrad_opts(). |
k |
Number of folds. |
times |
Number of repetitions. Total number of metric estimates = no. folds x no. times. |
params |
The grid of lambda and gamma values to cross-validate. |
nCores |
The number of CPU cores to be used. |
seed |
Arbitrary number to ensure reproducibility. Defaults to 100. |
err_fun |
A function that computes the metric (error/goodness-of-fit) between vectors of predicted and true responses. Defaults to rmse(pred, y) = sqrt(mean((pred - y) ^ 2)). |
err_opt |
Specify whether do minimize ('min') or maximize ('max') 'err_fun'. Default is 'min'. |
cvMatrix A matrix of errors across a grid of lambda (row) and gamma (column) values.
X <- matrix(rnorm(100 * 10), 100, 10)
u <- matrix(rnorm(10), 10, 1)
B <- u %*% t(u) + matrix(rnorm(10 * 10, 0, 0.1), 10, 10)
Y <- X %*% B + matrix(rnorm(100 * 10), 100, 10)
R <- ifelse(cor(Y) > .8, 1, 0)
system.time(testCV <- cv_gflasso(scale(X), scale(Y), R, nCores = 1))
system.time(testCV <- cv_gflasso(scale(X), scale(Y), R, nCores = 2))
cv_plot_gflasso(testCV)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.