Reputation: 29
I have the following:
acs_ny_split<- initial_split(acs_ny, prop=0.80)
acs_ny_split
acs_ny_train <- training(acs_ny_split)
acs_ny_test <- testing(acs_ny_split)
nyc_recipe<- recipe(FamilyIncome ~ ., data=acs_ny_train) |>
step_rm(contains('FoodStamp')) |>
step_dummy(all_nominal_predictors(), one_hot=TRUE) |>
step_normalize(all_numeric_predictors())
nyc_recipe |> prep() |> bake(new_data=NULL)
nyc_glm <- linear_reg(penalty = 0, mixture = 0) |> set_engine("glmnet")
nyc_glm
nyc_flow_glm <- workflow(preprocessor = nyc_recipe, spec=nyc_glm)
nyc_flow_glm
nyc_fit <- fit(nyc_flow_glm, data=acs_ny_train)
nyc_fit
Here's where I'm stuck:
nyc_flow_glm |> workflows::extract_parameter_dials()
Here's the error that I can't figure out:
Error in `extract_parameter_dials()`:
! Please supply a single 'parameter' string.
Backtrace:
1. workflows::extract_parameter_dials(nyc_flow_glm)
2. workflows:::extract_parameter_dials.workflow(nyc_flow_glm)
4. dials:::extract_parameter_dials.parameters(extract_parameter_set_dials(x), parameter)
Upvotes: 0
Views: 80
Reputation: 531
The code you'll want to extract the glmnet
engine fit here is:
extract_fit_engine(nyc_fit)
To read more about parsnip's extractor functions, you can check out the package website. :)
Upvotes: 2