library(targets)
library(tidymodels)

Specifications for the lasso model

```{targets ridgeTargets, tar_simple = TRUE} linear_reg( penalty = tune(), mixture = 0 ) |> set_engine("glmnet")

## Grid search to determine the best value for the penaly parameter (i.e. amount of regularization)

```{targets gridRidge, tar_simple = TRUE }
  dials::grid_regular(dials::penalty(),
    levels = 100
  )

Recipe for the model

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 recRidge, 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 workflowRidge, tar_simple = TRUE}
workflow()|>
    add_recipe(recLasso)|>
    add_model(specLasso)

{targets tuningRidge, tar_simple = TRUE} tune_grid( workflowLasso, resamples = foldsFive, grid = gridLasso )



awconway/eicu_nitro documentation built on Feb. 21, 2022, 4:35 p.m.