alexpghayes / modelling-in-r

an initial attempt to describe a grammar of modelling for r
https://alexpghayes.github.io/modelling-in-r/
3 stars 0 forks source link

purpose of recipes #2

Open jarvmiller opened 6 years ago

jarvmiller commented 6 years ago

This looks great. should lead to many good conversations. One thing I'm a bit confused about are two of your "things to note" bullet points when discussing model fitting and prediction, mostly because I have not heard of the recipes package.

Just to make sure I understand, do you mean the user does something like so?

my_recipe <- function(df){
  processed <- df %>%
  step_center(all_predictors()) %>%
  step_scale(all_predictors())
  # ... insert 3-5 more steps
  return(processed)
}

knn_family <- new_knn() %>% 
  add_design(my_recipe, data) %>% 
  add_hp_space(hyperparams) %>% 
  add_hp_search(hyperband) %>% 
  add_resampling(resamp_spec) %>% 
  fit()