| MLRidge | R Documentation |
Solves the ridge regression problem
\min_\beta \|y - X\beta\|^2 + \lambda \|\beta\|^2
for a single regularization value. Dispatches internally between primal
(n \ge p) and dual (n < p) Cholesky paths.
Wraps the C++ MLRidge::solve(X, y, lambda) static method.
MLRidge$solve()Solve ridge regression for a single lambda.
MLRidge$solve(X, y, lambda, n_threads = NULL)
XA numeric matrix (n x p), or an mmap_matrix (bound
zero-copy; "readonly" suffices).
yNumeric response vector of length n.
lambdaNon-negative regularization parameter.
n_threadsInteger, the thread budget of the matrix products
(NULL, the default: the library's default budget,
trex_get_num_threads(), initially 1).
Coefficient vector of length p.
MLRidge$clone()The objects of this class are cloneable with this method.
MLRidge$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).
Other ML methods:
MLElasticNet,
MLElasticNetCV,
MLLpNormScaler,
MLPCA,
MLRidgeCV,
MLSVD,
MLZScoreScaler,
ml_agglomerative_cluster(),
ml_cut_tree(),
ml_distance_metric,
ml_linkage_method
set.seed(42)
n <- 40; p <- 5
X <- matrix(rnorm(n * p), n, p)
beta_true <- c(1, -2, 0, 0.5, 0)
y <- X %*% beta_true + rnorm(n, sd = 0.1)
solver <- MLRidge$new()
beta_hat <- solver$solve(X, y, lambda = 0.01)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.