| MLRidgeCV | R Documentation |
Performs explicit K-Fold cross-validation for Ridge Regression model selection.
MLRidgeCV$new()Initialize the MLRidgeCV object.
MLRidgeCV$new(low_memory = FALSE, n_threads = NULL)
low_memoryLogical (default FALSE). FALSE: each
fold gathers and standardizes its training rows and takes a thin SVD
(about three to four copies of X in flight). TRUE: the dual
(kernel) form — n x n kernels accumulated from column blocks of X read
in place (an mmap_matrix included, "readonly"
suffices), no p-dimensional coefficients; same estimator, grid and
rank rule, agreement to numerical precision; memory O(n^2) instead of
O(n p), the route for p >> n.
n_threadsInteger, the thread budget of the fit's matrix products
(NULL, the default: the library's default budget,
trex_get_num_threads(), initially 1).
MLRidgeCV$fit()Fit the CV model.
MLRidgeCV$fit( X, y, n_folds = 10, n_lambda = 100, lambda_ratio = 1000, seed = 0 )
XPredictor matrix, or an mmap_matrix created by
mem_matrix / mem_matrix_from
(bound zero-copy; "readonly" mode suffices since the fit does
not modify X).
yResponse vector.
n_foldsNumber of folds (default 10).
n_lambdaNumber of lambdas in the path (default 100).
lambda_ratioRatio of max to min lambda (default 1000).
seedRandom seed for CV splits (default 0).
Value.
MLRidgeCV$cv_min()Get lambda that minimizes CV error.
MLRidgeCV$cv_min()
Value.
MLRidgeCV$cv_1se()Get 1SE rule lambda.
MLRidgeCV$cv_1se()
Value.
MLRidgeCV$index_min()Get index of minimum CV error.
MLRidgeCV$index_min()
Value.
MLRidgeCV$index_1se()Get index of 1SE rule lambda.
MLRidgeCV$index_1se()
Value.
MLRidgeCV$get_lambdas()Get the sequence of lambdas used.
MLRidgeCV$get_lambdas()
Value.
MLRidgeCV$get_cv_errors()Get the CV mean squared errors for each lambda.
MLRidgeCV$get_cv_errors()
Value.
MLRidgeCV$get_cv_std()Get the standard error of the CV errors.
MLRidgeCV$get_cv_std()
Value.
MLRidgeCV$interpolates()Whether the smallest training fold has p >= n_train, so
the lambda -> 0 end of the grid tends to the minimum-norm
interpolator instead of an ordinary least-squares fit. The curve
still has a genuine interior minimum in that regime; together with
selection_at_grid_edge() it tells whether cv_min() is
a real minimum or the grid running out.
MLRidgeCV$interpolates()
Logical.
MLRidgeCV$selection_at_grid_edge()Whether cv_min() or cv_1se() landed on the
first or the last grid point. The pick is then the grid boundary,
not an optimum, and lambda_ratio or n_lambda need
widening.
MLRidgeCV$selection_at_grid_edge()
Logical.
MLRidgeCV$clone()The objects of this class are cloneable with this method.
MLRidgeCV$clone(deep = FALSE)
deepWhether to make a deep clone.
A. E. Hoerl and R. W. Kennard, "Ridge Regression: Biased Estimation for Nonorthogonal Problems," Technometrics, vol. 42, no. 1, pp. 80-86, 2000 (Reprint of the 1970 article in the Special 40th Anniversary Issue).
G. Guennebaud, B. Jacob et al., Eigen v3, https://libeigen.gitlab.io/, 2010.
Other ML methods:
MLElasticNet,
MLElasticNetCV,
MLLpNormScaler,
MLPCA,
MLRidge,
MLSVD,
MLZScoreScaler,
ml_agglomerative_cluster(),
ml_cut_tree(),
ml_distance_metric,
ml_linkage_method
set.seed(1)
X <- matrix(rnorm(50 * 5), 50, 5)
y <- X[, 1] * 2 + rnorm(50)
cv <- MLRidgeCV$new()
cv$fit(X, y, n_folds = 5)
cv$cv_min()
cv$selection_at_grid_edge() # FALSE: the picks are interior grid points
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.