library(targets) library(tidymodels)
```{targets specLasso, tar_simple = TRUE} linear_reg( penalty = tune(), mixture = tune() ) |> set_engine("glmnet")
## Grid search to determine the best value for the penaly parameter (i.e. amount of regularization) ```{targets gridLasso, tar_simple = TRUE } dials::grid_regular(dials::penalty(), dials::mixture(), levels = 100 )
Preprocessing steps include normalization, a Yeo-Johnson transformation for variables with many zero values and principal components analysis for the variables that are highly correlated.
Predictors used here are restricted to those that can be derived from just a medication infusion device and physiolgical monitoring device. Clinical predictors (age, gender, medical conditions etc) were not included.
```{targets recLasso, tar_simple = TRUE } recipe(sbp_post ~ sbp_pre + nitro_diff_mcg + total_nitro + n_nitro + nitro_time + sbp_pre_mean_60 + sbp_pre_sd_60 + pain_score, data = dataModel ) |> step_YeoJohnson( n_nitro, nitro_time, total_nitro, sbp_pre_sd_60, pain_score ) |> step_normalize( all_numeric_predictors() )|> step_pca( sbp_pre_mean_60, sbp_pre )
## Run the model using 5-fold cross-validation ```{targets workflowLasso, tar_simple = TRUE} workflow()|> add_recipe(recLasso)|> add_model(specLasso)
{targets tuningLasso, tar_simple = TRUE}
tune_grid(
workflowLasso,
resamples = foldsFive,
grid = gridLasso
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.