cimentadaj / tidyflow

A simplified and fresh workflow for doing machine learning with tidymodels
https://cimentadaj.github.io/tidyflow/
Other
8 stars 0 forks source link

is it possible to use tidyflow with finetune #32

Open gutama opened 3 years ago

gutama commented 3 years ago

Hi,

I am trying to use

library(finetune)

data(cells, package = "modeldata")
cells <- cells %>% dplyr::select(-case)

svm_spec <-
  svm_rbf(cost = tune(), rbf_sigma = tune()) %>%
  set_engine("kernlab") %>%
  set_mode("classification")

svm_rec <-
  ~ .x %>%
  recipe(class ~ .) %>%
  step_YeoJohnson(all_predictors()) %>%
  step_normalize(all_predictors())

res_svm <-
  cells %>%
  tidyflow(seed = 442) %>%
  plug_recipe(svm_rec) %>%
  plug_model(svm_spec) %>%
  plug_resample(bootstraps, times = 25) %>% 
  plug_grid(grid_latin_hypercube, size=25) %>% 
  fit()

this is equivalent to

system.time({
set.seed(2)
svm_wflow %>% tune_grid(resamples = rs, grid = svm_grid)
})

I want to use the finetune method

system.time({
set.seed(2)
svm_wflow %>% tune_race_anova(resamples = rs, grid = svm_grid)
})

is it possible with tidyflow?

thank you

cimentadaj commented 3 years ago

At the moment, this is not possible. fit has a fixed call to tune_grid but I'm planning to incorporate other tuning methods. I'll leave this open so that when it's implemented I can refer to this.