MulaiMulai sekarang secara gratis

Model

You are now setting up your model. Since you chose a penalized logistic regression, know by its friends as Lasso, you need to find out what is the best penalty value, and do it through a search algorithm.

The recipe you built to engineer your features prior to modeling is already loaded.

Latihan ini adalah bagian dari kursus

Feature Engineering in R

Lihat Kursus

Petunjuk latihan

  • Set up the penalty for tuning.
  • Bundle your model and recipe in a workflow.

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

# Set up the penalty for tuning
lr_model <- logistic_reg() %>% set_engine("glmnet") %>%
  set_args(mixture = 1, penalty = ___)

lr_penalty_grid <- grid_regular(penalty(range = c(-3, 1)),levels = 30)

# Bundle your model and recipe in a workflow
lr_workflow <- workflow() %>%
  ___(lr_model) %>%
  ___(___)

lr_workflow
Edit dan Jalankan Kode