#| child: aaa.Rmd
#| include: false

r descr_models("logistic_reg", "glmnet")

Tuning Parameters

#| label: glmnet-param-info
#| echo: false
defaults <- 
  tibble::tibble(parsnip = c("penalty", "mixture"),
                 default = c("see below", "1.0"))

param <-
logistic_reg() |> 
  set_engine("glmnet") |> 
  make_parameter_list(defaults)

This model has r nrow(param) tuning parameters:

#| label: glmnet-param-list
#| echo: false
#| results: asis
param$item

The penalty parameter has no default and requires a single numeric value. For more details about this, and the glmnet model in general, see [glmnet-details]. As for mixture:

Translation from parsnip to the original package

#| label: glmnet-cls
logistic_reg(penalty = double(1), mixture = double(1)) |> 
  set_engine("glmnet") |> 
  translate()

Preprocessing requirements

#| child: template-makes-dummies.Rmd
#| child: template-same-scale.Rmd

By default, [glmnet::glmnet()] uses the argument standardize = TRUE to center and scale the data.

Case weights

#| child: template-uses-case-weights.Rmd

Sparse Data

#| child: template-uses-sparse-data.Rmd

Saving fitted model objects

#| child: template-butcher.Rmd

Examples

The "Fitting and Predicting with parsnip" article contains examples for logistic_reg() with the "glmnet" engine.

References



Try the parsnip package in your browser

Any scripts or data that you put into this service are public.

parsnip documentation built on June 8, 2025, 12:10 p.m.