Description Usage Arguments Details Value Author(s) References See Also Examples
Function to run k-fold cross-validation for GADAG2 to optimally tune the parameter of penalization.
1 2 3 4 5 |
X |
Design matrix, with samples (n) in rows and variables (p) in columns. |
Lambdas |
Optional user-supplied lambda sequence. Default is null and GADAG2 chooses its own sequence. |
n.folds |
Number of folds for cross-validation (10 by default). Can be as large as the sample size (leave-one-out cross validation) but not recommended for large data sets. |
threshold |
Thresholding value for the estimated edges. |
GADAG2.control |
A list containing parameters for controlling GADAG2 (termination conditions and inherent parameters of the Genetic Algortihm). Some parameters (n.gen, max.eval and pop.size) are particularly critical for reducing the computational time.
|
grad.control |
A list containing the parameters for controlling the inner optimization, i.e. the gradient descent.
|
ncores |
Number of cores (>0, depending on your computer). |
plot.CV |
If 1, plots the averaged cross validation error given sequence of lambdas. |
The function runs GADAG2
n.folds
times for each of the tested lambdas to compute the best solution associated to each omitted fold. The error is accumulated and the averaged error over the folds is computed. The best lambda lambda.min
corresponds to the one that minimizes the error.
A list with the following elements:
lambda.min
Value of lambda
that minimizes the averaged cross validation error error.CV
.
lambda.1se
Largest value of lambda
such that error.CV
is within 1 % of the minimum.
nzero
Number of non-zero coefficients at each lambda
.
Lambdas
The values of lambda
used in the fits.
error.CV
The averaged cross validation error.
Magali Champion, Victor Picheny and Matthieu Vignes
M. Champion, V. Picheny, M. Vignes, Inferring large graphs using l-1 penalized likelihood, Statistics and Computing (2017).
GADAG2
, GADAG2_Run
, GADAG2_Analyze
.
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 | #############################################################
# Loading toy data
#############################################################
data(toy_data)
# toy_data is a list of two matrices corresponding to a "star"
# DAG (node 1 activates all other nodes):
# - toy_data$X is a 100x10 design matrix
# - toy_data$G is the 10x10 adjacency matrix (ground trough)
#############################################################
# Tuning the parameter of penalization
#############################################################
# Simple run, whithout specifying GADAG2 parameters
## Not run:
GADAG2_CV_results <- GADAG2_CV(X=toy_data$X)
print(GADAG2_CV_results$lambda.1se) # best lambda
## End(Not run)
# If desired, additional plot for the averaged cross validation
# error
## Not run:
GADAG2_CV_results <- GADAG2_CV(X=toy_data$X,plot.CV=1)
## End(Not run)
# Given the best lambda, re-run GADAG2
## Not run:
GADAG2_results <- GADAG2_Run(X=toy_data$X, lambda=GADAG2_CV_results$lambda.1se)
print(GADAG2_results$G.best) # optimal adjacency matrix graph
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.