When the penalized generalize linear model (Lasso or Ridge) is processed in the tidymodel environment, finalizing the hyperparameter (lambda) and getting coefficients of the final model are confusing. Here is an example. This example predicts PIK3CA mutation status by gene expression data. TCGA breast cancer dataset is used.
Modeling library(glmnet) library(themis) set.seed(930093) cv_splits <- rsample::vfold_cv(trainset_ahDiff, strata = PIK3CA_T) mod <- logistic_reg(penalty = tune(), mixture = tune()) %>% set_engine("glmnet") rec <- recipe(PIK3CA_T ~ .
Machine Learning and Tidymodel Model setting, {Parsnip} Rpackage Parsnip standardizes model specification. Tidymodel follows the concept of lazy evaluation of the tidyverse. Parsnip sets unified specifications and lately evaluates.
Feature engineering, {Recipes} Recipes make preprocessing easy with step_() functions. Recipes after specification calculate.
Resampling, {rsample} To choose a model and hyperparameters, we must validate the different models.
Making hyperparameter set, {dials} The Rpackage {dials} set hyperparameter similarily with {Parsnip}.