Description Usage Arguments Details Value Examples
View source: R/cross_validation.R
Cross-validation for the desired method and parameter combinations.
1 2 3 4 5 6 | CrossValidation(x, delta = c(0.1, 0.25), lambda = NULL,
lambda_min_ratio = 0.01, lambda_grid_size = 10, gamma = NULL,
n_folds = 10, method = c("nodewise_regression", "summed_regression",
"ratio_regression"), penalize_diagonal = F, optimizer = c("line_search",
"section_search"), control = NULL, standardize = T, threshold = 1e-07,
parallel = T, verbose = T, FUN = NULL, ...)
|
x |
A n times p matrix or data frame. |
delta |
Numeric value between 0 and 0.5. This tuning parameter determines the minimal segment size proportional to the size of the dataset and hence an upper bound for the number of changepoints (roughly 1/δ). |
lambda |
Positive numeric value. This is the regularization parameter in the single Lasso fits. This value is ignored if FUN is not NULL. |
lambda_min_ratio |
Numeric value between 0 and 1. If the λ_max is determined internally this will pick λ_min = lambda_min_ratio * λ_max. |
lambda_grid_size |
Integer value determining the number of values between λ_min and λ_max to will be equally spaced on a logarithmic scale. |
gamma |
Numeric value or vector. If NULL the full solution path for gamma will be caluclated for every combination of λ and δ |
n_folds |
Number of folds. Test data will be selected equi-spaced, i.e. each n_fold-th observation. |
method |
Which estimator should be used? Possible choices are
This value is ignored if |
penalize_diagonal |
Boolean, should the diagonal elements of the precision matrix be penalized by λ? This value is ignored if FUN is not NULL. |
optimizer |
Which search technique should be used for performing individual splits in the binary segmentation alogrithm? Possible choices are
|
control |
A list with parameters that is accessed by the selected optimizer:
|
standardize |
Boolean. If TRUE the penalty parameter λ will be adjusted for every dimension in the single Lasso fits according to the standard deviation in the data. |
threshold |
The threshold for halting the iteration in
|
parallel |
If TRUE and a parallel backend is registered, the cross-validation will be performed in parallel. |
verbose |
Boolean. If TRUE additional information will be printed. |
FUN |
A loss function with formal arguments, |
... |
Supply additional arguments for a specific method (e.g. |
Evaluating different lambda values will lead to refitting the entire model whereas gamma values can be evaluted cheaply using a single fit. Suitable values for lambda as well as gamma are choosen automatically if they are not supplied.
Will make use of a registered parallel backend over the folds and lambda values. Therefore the whole cross-validation will make use even of a high number of compute nodes (up to number of folds times number of lambda values).
A nested list with the cv results and the full fitted models for each combination of δ, lambda and gamma combination.
1 2 3 4 5 | ## Not run:
dat <- SimulateFromModel(CreateModel(n_segments = 2,n = 100,p = 30, ChainNetwork))
CrossValidation(dat, method = "summed_regression")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.