logistic_reg
is a way to generate a specification of a model
before fitting and allows the model to be created using
different packages in R, Stan, or via Spark. The main arguments for the
model are:
regularization
: The total amount of regularization
in the model. Note that this must be zero for some engines.
mixture
: The proportion of L2 regularization in
the model. Note that this will be ignored for some engines.
These arguments are converted to their specific names at the
time that the model is fit. Other options and argument can be
set using the engine_args
argument. If left to their defaults
here (NULL
), the values are taken from the underlying model
functions.
logistic_reg(mode = "classification", regularization = NULL,
mixture = NULL, engine_args = list(), ...)
A single character string for the type of model. The only possible value for this model is "classification".
An non-negative number representing the total amount of regularization.
A number between zero and one (inclusive) that represents the proportion of regularization that is used for the L2 penalty (i.e. weight decay, or ridge regression) versus L1 (the lasso).
A named list of arguments to be used by the
underlying models (e.g., stats::glm
,
rstanarm::stan_glm
, etc.). These are not evaluated
until the model is fit and will be substituted into the model
fit expression.
Used for S3 method consistency. Any arguments passed to
the ellipses will result in an error. Use engine_args
instead.
The data given to the function are not saved and are only used
to determine the mode of the model. For logistic_reg
,the
mode will always be "classification".
The model can be created using the fit()
function using the
following engines:
R: "glm"
or "glmnet"
Stan: "rstanarm"
Spark: "spark"
# NOT RUN {
logistic_reg()
# Parameters can be represented by a placeholder:
logistic_reg(regularization = varying())
# }
Run the code above in your browser using DataLab