You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to know whether you know how to update the formula used in a workflow object during the fitting step, after a feature selection (FS) pre-processing step was performed.
The current issues is that when running the fit function I get "Error in eval(predvars, data, env) : object 'Var1' not found". It happens since the FS extracted that predictor, but the formula still considered it.
I had to add the formula using add_model, since I am working with a linear mixed effect, and so far I could not find a way to set the random effects ("ID") in a recipe object.
I would like to know whether you know how to update the formula used in a workflow object during the fitting step, after a feature selection (FS) pre-processing step was performed.
The current issues is that when running the fit function I get "Error in eval(predvars, data, env) : object 'Var1' not found". It happens since the FS extracted that predictor, but the formula still considered it.
I had to add the formula using add_model, since I am working with a linear mixed effect, and so far I could not find a way to set the random effects ("ID") in a recipe object.
Case example:
predictors_list <- c("Var1", "Var2")
recipe <- recipe(dataset)%>% ... %>% step_select_boruta(all_predictors(), outcome = "Disease")
recipe <-
recipe %>% add_role("ID", new_role = "predictor")
mixed_effects_formula <- as.formula(
paste(
"Disease ~ ",
paste(c(predictors_list, "(1|ID)"), collapse = " + ")
)
)
wflow <- workflow() %>%
add_recipe(recipe) %>%
add_model(model, formula = mixed_effects_formula)
fitted_model <-
fit(
wflow,
data = data_train
)
"Error in eval(predvars, data, env) : object 'Var1' not found"
Thanks in advance
Best
Alberto
The text was updated successfully, but these errors were encountered: