Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't combine tune and hardcoded values in tune grid #1

Closed
cimentadaj opened this issue May 26, 2020 · 1 comment
Closed

Can't combine tune and hardcoded values in tune grid #1

cimentadaj opened this issue May 26, 2020 · 1 comment
Labels
bug Something isn't working

Comments

@cimentadaj
Copy link
Owner

Running this:

library(tidymodels)
devtools::load_all()
library(mlbench)
data(Ionosphere)
Ionosphere <- Ionosphere %>% select(-V2) %>% mutate(cont = 1:nrow(.)) %>% as_tibble()

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

iono_rec <-
  ~ recipe(Class ~ ., data = .)  %>%
    step_zv(all_predictors()) %>%
    step_mutate(V1 = factor(V1), Class = factor(Class)) %>% 
    step_dummy(V1) %>% 
    step_range(matches("V1_")) %>% 
    step_ns(cont, deg_free = tune())

tflow <-
  Ionosphere %>%
  tidyflow(seed = 4943) %>%
  plug_split(initial_split) %>% 
  plug_recipe(iono_rec) %>%
  plug_resample(bootstraps, times = 30) %>%
  plug_model(svm_mod) %>% 
  plug_grid(grid_latin_hypercube,
            cost = cost(c(-10, 10)),
            size = 1)

t1 <- tflow %>% fit()

Doesn't run. The error comes from tune_grid, as discussed at tidymodels/tune#150

@cimentadaj cimentadaj added the bug Something isn't working label May 26, 2020
@cimentadaj
Copy link
Owner Author

This is fixed by specifying the fixed value in svm_mod as positive. You can't have negative values in the kernel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant