Learn R Programming

parsnip (version 0.0.0.9000)

update.logistic_reg: Update a Logistic Regression Specification

Description

If parameters need to be modified, this function can be used in lieu of recreating the object from scratch.

Usage

# S3 method for logistic_reg
update(object, regularization = NULL, mixture = NULL,
  engine_args = list(), fresh = FALSE, ...)

Arguments

object

A logistic reression model specification.

regularization

An non-negative number representing the total amount of regularization.

mixture

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).

engine_args

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.

fresh

A logical for whether the arguments should be modifed in-place of or replaced wholesale.

...

Used for S3 method consistency. Any arguments passed to the ellipses will result in an error. Use engine_args instead.

Value

An updated model specification.

Examples

Run this code
# NOT RUN {
model <- logistic_reg(regularization = 10, mixture = 0.1)
model

update(model, regularization = 1)

update(model, regularization = 1, fresh = TRUE)
# }

Run the code above in your browser using DataLab