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

sample_size does not work for Catboost #49

Open
vidarsumo opened this issue Sep 11, 2021 · 1 comment
Open

sample_size does not work for Catboost #49

vidarsumo opened this issue Sep 11, 2021 · 1 comment

Comments

@vidarsumo
Copy link

I'm trying to tune sample_size for Catboost but it gives an error:

library(modeltime)
library(treesnip)
#> Loading required package: parsnip
library(tidyverse)
library(tidymodels)
#> Registered S3 method overwritten by 'tune':
#>   method                   from   
#>   required_pkgs.model_spec parsnip
library(timetk)

library(catboost)

m750_lag <- m750 %>%
    tk_augment_lags(value, .lags = 1:2)

resamples_kfold <- vfold_cv(m750_lag, v = 3)

recipe_spec <- recipe(value ~ ., data = m750_lag) %>%
    update_role(date, new_role = "indicator")

model_spec_catboost <- boost_tree(
    mode           = "regression",
    trees          = tune(),
    min_n          = tune(),
    tree_depth     = tune(),
    learn_rate     = tune(),
    sample_size    = tune()
    ) %>%
    set_engine("catboost")

wflw_catboost <- workflow() %>%
    add_model(model_spec_catboost) %>%
    add_recipe(recipe_spec)

grid_latin_hypercube(wflw_catboost)
#> # A tibble: 3 x 4
#>   trees min_n tree_depth    learn_rate
#>   <int> <int>      <int>         <dbl>
#> 1   315    22          5 0.0188       
#> 2  1245     4         13 0.00000000648
#> 3  1421    34          8 0.0000360
catboost_tuned <- tune_grid(
    object     = wflw_catboost,
    resamples  = resamples_kfold,
    param_info = parameters(wflw_catboost) %>%
        update(sample_size = sample_prop(range = c(0, 1))),
    grid = 3,
    control = control_grid(verbose = TRUE)
    )
#> Error: At least one parameter does not match any id's in the set: 'sample_size'

Created on 2021-09-11 by the reprex package (v2.0.1)

@p-schaefer
Copy link

I came across this issue as well, I wonder if its related to #22 because it seems to affect lightgbm as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants