| MLElasticNetCV | R Documentation |
Selects the elastic-net penalty by K-fold cross-validation over
a shared glmnet-style lambda grid (coordinate descent per fold), returning
lambda.min and lambda.1se. The mixing parameter alpha
interpolates between lasso (alpha = 1) and ridge (alpha = 0).
MLElasticNetCV$new()Initialize the MLElasticNetCV object.
MLElasticNetCV$new(low_memory = FALSE, n_threads = NULL)
low_memoryLogical (default FALSE); TRUE runs the
full-data fit and every fold on X itself with a 0/1 training mask
(no allocation of the size of X; an mmap_matrix is read in
place). See MLElasticNet.
n_threadsInteger, the thread budget of the matrix products of the
fit and its folds (NULL, the default: the library's default
budget, trex_get_num_threads(), initially 1).
MLElasticNetCV$fit()Fit K-fold CV over a glmnet-style grid.
MLElasticNetCV$fit( X, y, alpha = 0, n_folds = 10, n_lambda = 100, lambda_min_ratio = -1, seed = 0, standardize = TRUE, intercept = TRUE, max_iter = 1e+05, tol = 1e-07 )
XPredictor matrix (n x p), or an mmap_matrix (bound
zero-copy; "readonly" suffices, the fit does not modify X).
yResponse vector (n).
alphaMixing in [0, 1]: 1 = lasso, 0 = ridge (default 0).
n_foldsNumber of folds (default 10).
n_lambdaGrid size (default 100).
lambda_min_ratioRatio lambda_min/lambda_max; negative (default) auto-selects glmnet's rule.
seedFold-permutation RNG seed (default 0).
standardizeStandardize columns to unit SD (default TRUE).
interceptFit an unpenalized intercept (default TRUE).
max_iterMax CD sweeps per lambda (default 100000).
tolConvergence tolerance (default 1e-7).
Invisibly returns self.
MLElasticNetCV$cv_min()Lambda that minimizes the mean CV error.
MLElasticNetCV$cv_min()
Scalar numeric.
MLElasticNetCV$cv_1se()Largest lambda within one SE of the minimum (1SE rule).
MLElasticNetCV$cv_1se()
Scalar numeric.
MLElasticNetCV$index_min()Index (1-based) of lambda.min.
MLElasticNetCV$index_min()
Integer.
MLElasticNetCV$index_1se()Index (1-based) of lambda.1se.
MLElasticNetCV$index_1se()
Integer.
MLElasticNetCV$get_lambdas()Lambda grid used (descending).
MLElasticNetCV$get_lambdas()
Numeric vector.
MLElasticNetCV$get_cv_errors()Mean CV MSE per lambda.
MLElasticNetCV$get_cv_errors()
Numeric vector.
MLElasticNetCV$get_cv_std()Standard error of the CV MSE per lambda.
MLElasticNetCV$get_cv_std()
Numeric vector.
MLElasticNetCV$clone()The objects of this class are cloneable with this method.
MLElasticNetCV$clone(deep = FALSE)
deepWhether to make a deep clone.
H. Zou and T. Hastie, "Regularization and Variable Selection via the Elastic Net," J. R. Stat. Soc. Ser. B Stat. Methodol., vol. 67, no. 2, pp. 301-320, 2005.
J. Friedman, T. Hastie, and R. Tibshirani, "Regularization Paths for Generalized Linear Models via Coordinate Descent," J. Stat. Softw., vol. 33, no. 1, pp. 1-22, 2010, doi: 10.18637/jss.v033.i01.
R. Tibshirani, J. Bien, J. Friedman, T. Hastie, N. Simon, J. Taylor, and R. J. Tibshirani, "Strong Rules for Discarding Predictors in Lasso-Type Problems," J. R. Stat. Soc. Ser. B Stat. Methodol., vol. 74, no. 2, pp. 245-266, 2012, doi: 10.1111/j.1467-9868.2011.01004.x.
L. Breiman, J. H. Friedman, R. A. Olshen, and C. J. Stone, Classification and Regression Trees. Wadsworth, Belmont, CA, 1984.
Other ML methods:
MLElasticNet,
MLLpNormScaler,
MLPCA,
MLRidge,
MLRidgeCV,
MLSVD,
MLZScoreScaler,
ml_agglomerative_cluster(),
ml_cut_tree(),
ml_distance_metric,
ml_linkage_method
set.seed(1)
n <- 60; p <- 10
X <- matrix(rnorm(n * p), n, p)
y <- X[, 1] * 2 - X[, 4] + rnorm(n)
cv <- MLElasticNetCV$new()
cv$fit(X, y, alpha = 0.5)
cv$cv_min()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.