- x
n
by p
matrix of numeric predictors.
- y
vector of response values of length n
.
For binary classification, y
should be a factor with 2 levels.
- lambda
optional user-supplied sequence of penalization levels.
If given and not NULL
, nlambda
and lambda_min_ratio
are ignored.
- cv_k
number of folds per cross-validation.
- cv_repl
number of cross-validation replications.
- cv_metric
either a string specifying the performance metric to use, or a function to
evaluate prediction errors in a single CV replication.
If a function, the number of arguments define the data the function receives.
If the function takes a single argument, it is called with a single numeric vector of
prediction errors.
If the function takes two or more arguments, it is called with the predicted values as
first argument and the true values as second argument.
The function must always return a single numeric value quantifying the prediction performance.
The order of the given values corresponds to the order in the input data.
- fit_all
If TRUE
, fit the model for all penalization levels.
Can also be any combination of "min"
and "{x}-se"
, in which case only models at the
penalization level with smallest average CV accuracy, or within {x}
standard errors,
respectively.
Setting fit_all
to FALSE
is equivalent to "min"
.
Applies to all alpha
value.
- cl
a parallel cluster. Can only be used in combination with
ncores = 1
.
- ncores
deprecated and not used anymore.
- ...
Arguments passed on to elnet
alpha
elastic net penalty mixing parameter with \(0 \le \alpha \le 1\).
alpha = 1
is the LASSO penalty, and alpha = 0
the Ridge penalty.
Can be a vector of several values, but alpha = 0
cannot be mixed with other values.
nlambda
number of penalization levels.
lambda_min_ratio
Smallest value of the penalization level as a fraction of the largest
level (i.e., the smallest value for which all coefficients are zero).
The default depends on the sample size relative to the number of variables and alpha
.
If more observations than variables are available, the default is 1e-3 * alpha
,
otherwise 1e-2 * alpha
.
penalty_loadings
a vector of positive penalty loadings (a.k.a. weights) for
different penalization of each coefficient.
standardize
standardize variables to have unit variance.
Coefficients are always returned in original scale.
weights
a vector of positive observation weights.
intercept
include an intercept in the model.
sparse
use sparse coefficient vectors.
en_algorithm_opts
options for the EN algorithm. See en_algorithm_options
for details.
eps
numerical tolerance.
xtest
defunct.
options
deprecated. Use en_algorithm_opts
instead.
correction
defunct. Correction for EN estimates is not supported anymore.