tidymodels / tune

Tools for tidy parameter tuning
https://tune.tidymodels.org
Other
285 stars 42 forks source link

Error while using tune_grid ($ operator is invalid for atomic vectors) #150

Closed dilsherdhillon closed 4 years ago

dilsherdhillon commented 4 years ago

Hi Folks! I'm running into trouble with the tuning parameters using the tune_grid function while using tune() to set hyperparameters in {parsnip}.

suppressPackageStartupMessages(library(tidyverse))
suppressPackageStartupMessages(library(yardstick))
suppressPackageStartupMessages(library(tune))
suppressPackageStartupMessages(library(rsample))
suppressPackageStartupMessages(library(recipes))
suppressPackageStartupMessages(library(parsnip))

### Create random data  

dta <- tibble::tibble(binary = rbinom(1000, 1, 0.7),
                      feature_1 = rgamma(1000, 2, 1),
                      feature_2 = rnorm(1000, 10, 20),
                      feature_3 = rpois(1000, 5))

### create a recipe  
recipe_df <- dta %>%
  recipe(binary ~ .) %>%
  step_center(all_predictors()) %>%
  step_scale(all_predictors())

### set the engine  
engine <- boost_tree(
  mode = "classification",
  trees = tune(),
  min_n = tune(),
  tree_depth = tune(),
  learn_rate = tune()

  ) %>%
  set_mode("classification") %>%
  set_engine("xgboost")  

### create a resamples tibble  
df_resamples <- vfold_cv(dta, v = 5)  

### grid of hyperparameters to tune  
grid <-  expand.grid(
  trees = c(50),
  min_n = c(3, 5, 7),
  tree_depth = 100,
  learn_rate = c(0.1, 0.5, 0.9)
)

### fit te model  
fits <- tune_grid(
  recipe_df,
  model = engine,
  resamples  = df_resamples,
  grid = grid,
  metrics  = metric_set(roc_auc)
  )  
#> x Fold1: internal: Error: $ operator is invalid for atomic vectors
#> x Fold2: internal: Error: $ operator is invalid for atomic vectors
#> x Fold3: internal: Error: $ operator is invalid for atomic vectors
#> x Fold4: internal: Error: $ operator is invalid for atomic vectors
#> x Fold5: internal: Error: $ operator is invalid for atomic vectors
#> Warning: All models failed in tune_grid(). See the `.notes` column.

fits$.notes
#> [[1]]
#> # A tibble: 1 x 1
#>   .notes                                                   
#>   <chr>                                                    
#> 1 internal: Error: $ operator is invalid for atomic vectors
#> 
#> [[2]]
#> # A tibble: 1 x 1
#>   .notes                                                   
#>   <chr>                                                    
#> 1 internal: Error: $ operator is invalid for atomic vectors
#> 
#> [[3]]
#> # A tibble: 1 x 1
#>   .notes                                                   
#>   <chr>                                                    
#> 1 internal: Error: $ operator is invalid for atomic vectors
#> 
#> [[4]]
#> # A tibble: 1 x 1
#>   .notes                                                   
#>   <chr>                                                    
#> 1 internal: Error: $ operator is invalid for atomic vectors
#> 
#> [[5]]
#> # A tibble: 1 x 1
#>   .notes                                                   
#>   <chr>                                                    
#> 1 internal: Error: $ operator is invalid for atomic vectors

sessionInfo()
#> R version 3.6.2 (2019-12-12)
#> Platform: x86_64-pc-linux-gnu (64-bit)
#> Running under: Debian GNU/Linux 10 (buster)
#> 
#> Matrix products: default
#> BLAS/LAPACK: /usr/lib/x86_64-linux-gnu/libopenblasp-r0.3.5.so
#> 
#> locale:
#>  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
#>  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
#>  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=C             
#>  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
#>  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
#> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> other attached packages:
#>  [1] parsnip_0.0.5   recipes_0.1.9   rsample_0.0.5   tune_0.0.1     
#>  [5] yardstick_0.0.4 forcats_0.4.0   stringr_1.4.0   dplyr_0.8.3    
#>  [9] purrr_0.3.3     readr_1.3.1     tidyr_1.0.0     tibble_2.1.3   
#> [13] ggplot2_3.2.1   tidyverse_1.3.0
#> 
#> loaded via a namespace (and not attached):
#>  [1] nlme_3.1-142       fs_1.3.1           lubridate_1.7.4    DiceDesign_1.8-1  
#>  [5] httr_1.4.1         tools_3.6.2        backports_1.1.5    utf8_1.1.4        
#>  [9] R6_2.4.1           rpart_4.1-15       DBI_1.1.0          lazyeval_0.2.2    
#> [13] colorspace_1.4-1   nnet_7.3-12        withr_2.1.2        tidyselect_0.2.5  
#> [17] compiler_3.6.2     cli_2.0.1          rvest_0.3.5        xml2_1.2.2        
#> [21] scales_1.1.0       digest_0.6.23      rmarkdown_2.0      pkgconfig_2.0.3   
#> [25] htmltools_0.4.0    lhs_1.0.1          dbplyr_1.4.2       highr_0.8         
#> [29] rlang_0.4.2        readxl_1.3.1       generics_0.0.2     jsonlite_1.6      
#> [33] magrittr_1.5       Matrix_1.2-18      Rcpp_1.0.3         munsell_0.5.0     
#> [37] fansi_0.4.1        GPfit_1.0-8        lifecycle_0.1.0    furrr_0.1.0       
#> [41] stringi_1.4.4      pROC_1.15.3        yaml_2.2.0         MASS_7.3-51.4     
#> [45] plyr_1.8.5         grid_3.6.2         parallel_3.6.2     listenv_0.8.0     
#> [49] crayon_1.3.4       lattice_0.20-38    haven_2.2.0        splines_3.6.2     
#> [53] hms_0.5.2          zeallot_0.1.0      knitr_1.26         pillar_1.4.3      
#> [57] xgboost_0.90.0.2   dials_0.0.4        codetools_0.2-16   reprex_0.3.0      
#> [61] glue_1.3.1         evaluate_0.14      data.table_1.12.8  modelr_0.1.5      
#> [65] vctrs_0.2.1        foreach_1.4.7      cellranger_1.1.0   gtable_0.3.0      
#> [69] future_1.15.1      assertthat_0.2.1   xfun_0.11          gower_0.2.1       
#> [73] prodlim_2019.11.13 broom_0.5.3        class_7.3-15       survival_3.1-8    
#> [77] timeDate_3043.102  iterators_1.0.12   hardhat_0.1.1      lava_1.6.6        
#> [81] workflows_0.1.0    globals_0.12.5     ellipsis_0.3.0     ipred_0.9-9

Created on 2020-01-10 by the reprex package (v0.3.0)

dwhdai commented 4 years ago

Also running into this issue

topepo commented 4 years ago

The problem is that your outcome is numeric and you are trying to fit a classification model. We expect a factor predictor.

There is a better error message for this case but that should happen in parsnip:

library(parsnip)

dta <- tibble::tibble(binary = rbinom(1000, 1, 0.7),
                      feature_1 = rgamma(1000, 2, 1),
                      feature_2 = rnorm(1000, 10, 20),
                      feature_3 = rpois(1000, 5))

### set the engine  
engine <- 
  boost_tree() %>%
  set_mode("classification") %>%
  set_engine("xgboost")  

engine %>% fit(binary ~ ., data = dta)
#> Error: For classification models, the outcome should be a factor.

Created on 2020-02-16 by the reprex package (v0.3.0)

We need to find out where it failed prior to this and write a better message.

juliasilge commented 4 years ago

I believe this has to do with how catch_and_log_fit() finds the error to report. It is not logging the thing we want it to.

library(tidymodels)
#> ── Attaching packages ──────────────────────────────────────────── tidymodels 0.1.0 ──
#> ✓ broom     0.5.4          ✓ recipes   0.1.9     
#> ✓ dials     0.0.4          ✓ rsample   0.0.5     
#> ✓ dplyr     0.8.4          ✓ tibble    2.1.3     
#> ✓ ggplot2   3.2.1          ✓ tune      0.0.1.9000
#> ✓ infer     0.5.1          ✓ workflows 0.1.0     
#> ✓ parsnip   0.0.5          ✓ yardstick 0.0.5.9000
#> ✓ purrr     0.3.3
#> ── Conflicts ─────────────────────────────────────────────── tidymodels_conflicts() ──
#> x purrr::discard()    masks scales::discard()
#> x dplyr::filter()     masks stats::filter()
#> x dplyr::lag()        masks stats::lag()
#> x ggplot2::margin()   masks dials::margin()
#> x recipes::step()     masks stats::step()
#> x recipes::yj_trans() masks scales::yj_trans()

dta <- tibble::tibble(binary = rbinom(1000, 1, 0.7),
                      feature_1 = rgamma(1000, 2, 1),
                      feature_2 = rnorm(1000, 10, 20),
                      feature_3 = rpois(1000, 5))

xbg_spec <- boost_tree(mode = "classification", learn_rate = tune()) %>%
  set_mode("classification") %>%
  set_engine("xgboost") 

df_resamples <- vfold_cv(dta, v = 3)

wf <- workflow() %>%
  add_model(xbg_spec) %>%
  add_formula(binary ~ .)

## error we want
tune:::train_formula(df_resamples$splits[[1]], wf) %>%
  tune:::train_model(grid = tibble(learn_rate = 0.00000862), 
                     control = control_workflow())
#> Error: For classification models, the outcome should be a factor.

## NOT error we want
tune:::catch_and_log_fit(
  tune:::train_formula(df_resamples$splits[[1]], wf) %>%
    tune:::train_model(grid = tibble(learn_rate = 0.00000862), 
                       control = control_workflow()),
  control = control_grid()
)
#> Error: $ operator is invalid for atomic vectors

Created on 2020-02-25 by the reprex package (v0.3.0)

juliasilge commented 4 years ago

It's this line, after the call to catcher(). The error message we want is caught by catcher() and stored in result but then that next line tries to get FIT INCEPTION that isn't there.

I can't find tests for catch_and_log_fit(). How likely is it that it's behaving in unexpected ways in more than just this situation? What do we think the best next step is?

dilsherdhillon commented 4 years ago

@topepo Thank you for catching this!

cimentadaj commented 4 years ago

Experiencing this under a different context. I tried to run a model where I specify one argument of the model with tune() but a hard coded value for the other argument. This raises the same error. See the reprex:

library(tidymodels)
#> ── Attaching packages ────────────────────────────────────── tidymodels 0.1.0 ──
#> ✔ broom     0.5.6      ✔ recipes   0.1.12
#> ✔ dials     0.0.6      ✔ rsample   0.0.6 
#> ✔ dplyr     0.8.5      ✔ tibble    3.0.1 
#> ✔ ggplot2   3.3.0      ✔ tune      0.1.0 
#> ✔ infer     0.5.1      ✔ workflows 0.1.1 
#> ✔ parsnip   0.1.1      ✔ yardstick 0.0.6 
#> ✔ purrr     0.3.4
#> ── Conflicts ───────────────────────────────────────── tidymodels_conflicts() ──
#> ✖ purrr::discard()  masks scales::discard()
#> ✖ dplyr::filter()   masks stats::filter()
#> ✖ dplyr::lag()      masks stats::lag()
#> ✖ ggplot2::margin() masks dials::margin()
#> ✖ recipes::step()   masks stats::step()
library(mlbench)
data(Ionosphere)
Ionosphere <- Ionosphere %>% select(-V2) %>% mutate(cont = 1:nrow(.)) %>% as_tibble()

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

resample <- bootstraps(Ionosphere, times = 5)

# Define a tune for one argument but specify the other
svm_mod <-
  svm_rbf(cost = tune(), rbf_sigma = -0.25) %>%
  set_mode("classification") %>%
  set_engine("kernlab")

# Errors
tune_grid(svm_mod, iono_rec, resample, grid = 3)
#> x Bootstrap1: model 1/3 (predictions): Error: $ operator is invalid for atomic vectors
#> x Bootstrap1: model 2/3 (predictions): Error: $ operator is invalid for atomic vectors
#> x Bootstrap1: model 3/3 (predictions): Error: $ operator is invalid for atomic vectors
#> x Bootstrap2: model 1/3 (predictions): Error: $ operator is invalid for atomic vectors
#> x Bootstrap2: model 2/3 (predictions): Error: $ operator is invalid for atomic vectors
#> x Bootstrap2: model 3/3 (predictions): Error: $ operator is invalid for atomic vectors
#> x Bootstrap3: model 1/3 (predictions): Error: $ operator is invalid for atomic vectors
#> x Bootstrap3: model 2/3 (predictions): Error: $ operator is invalid for atomic vectors
#> x Bootstrap3: model 3/3 (predictions): Error: $ operator is invalid for atomic vectors
#> x Bootstrap4: model 1/3 (predictions): Error: $ operator is invalid for atomic vectors
#> x Bootstrap4: model 2/3 (predictions): Error: $ operator is invalid for atomic vectors
#> x Bootstrap4: model 3/3 (predictions): Error: $ operator is invalid for atomic vectors
#> x Bootstrap5: model 1/3 (predictions): Error: $ operator is invalid for atomic vectors
#> x Bootstrap5: model 2/3 (predictions): Error: $ operator is invalid for atomic vectors
#> x Bootstrap5: model 3/3 (predictions): Error: $ operator is invalid for atomic vectors
#> Warning: All models failed in tune_grid(). See the `.notes` column.
#> # Bootstrap sampling 
#> # A tibble: 5 x 4
#>   splits            id         .metrics .notes          
#>   <list>            <chr>      <list>   <list>          
#> 1 <split [351/120]> Bootstrap1 <NULL>   <tibble [3 × 1]>
#> 2 <split [351/126]> Bootstrap2 <NULL>   <tibble [3 × 1]>
#> 3 <split [351/132]> Bootstrap3 <NULL>   <tibble [3 × 1]>
#> 4 <split [351/136]> Bootstrap4 <NULL>   <tibble [3 × 1]>
#> 5 <split [351/124]> Bootstrap5 <NULL>   <tibble [3 × 1]>

# Define tune for both arguments
svm_mod <-
  svm_rbf(cost = tune(), rbf_sigma = tune()) %>%
  set_mode("classification") %>%
  set_engine("kernlab")

# Runs fine
tune_grid(svm_mod, iono_rec, resample, grid = 3)
#> # Bootstrap sampling 
#> # A tibble: 5 x 4
#>   splits            id         .metrics         .notes          
#>   <list>            <chr>      <list>           <list>          
#> 1 <split [351/120]> Bootstrap1 <tibble [6 × 5]> <tibble [0 × 1]>
#> 2 <split [351/126]> Bootstrap2 <tibble [6 × 5]> <tibble [0 × 1]>
#> 3 <split [351/132]> Bootstrap3 <tibble [6 × 5]> <tibble [0 × 1]>
#> 4 <split [351/136]> Bootstrap4 <tibble [6 × 5]> <tibble [0 × 1]>
#> 5 <split [351/124]> Bootstrap5 <tibble [6 × 5]> <tibble [0 × 1]>

Here's the SI:

devtools::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#>  setting  value                       
#>  version  R version 4.0.0 (2020-04-24)
#>  os       Ubuntu 20.04 LTS            
#>  system   x86_64, linux-gnu           
#>  ui       X11                         
#>  language (EN)                        
#>  collate  en_US.UTF-8                 
#>  ctype    en_US.UTF-8                 
#>  tz       Europe/Berlin               
#>  date     2020-05-26                  
#> 
#> ─ Packages ───────────────────────────────────────────────────────────────────
#>  package       * version    date       lib source        
#>  assertthat      0.2.1      2019-03-21 [1] CRAN (R 4.0.0)
#>  backports       1.1.7      2020-05-13 [1] CRAN (R 4.0.0)
#>  base64enc       0.1-3      2015-07-28 [1] CRAN (R 4.0.0)
#>  bayesplot       1.7.1      2019-12-01 [1] CRAN (R 4.0.0)
#>  boot            1.3-25     2020-04-26 [3] CRAN (R 4.0.0)
#>  broom         * 0.5.6      2020-04-20 [1] CRAN (R 4.0.0)
#>  callr           3.4.3      2020-03-28 [1] CRAN (R 4.0.0)
#>  class           7.3-17     2020-04-26 [3] CRAN (R 4.0.0)
#>  cli             2.0.2      2020-02-28 [1] CRAN (R 4.0.0)
#>  codetools       0.2-16     2018-12-24 [3] CRAN (R 4.0.0)
#>  colorspace      1.4-1      2019-03-18 [1] CRAN (R 4.0.0)
#>  colourpicker    1.0        2017-09-27 [1] CRAN (R 4.0.0)
#>  crayon          1.3.4      2017-09-16 [1] CRAN (R 4.0.0)
#>  crosstalk       1.1.0.1    2020-03-13 [1] CRAN (R 4.0.0)
#>  desc            1.2.0      2018-05-01 [1] CRAN (R 4.0.0)
#>  devtools        2.3.0      2020-04-10 [1] CRAN (R 4.0.0)
#>  dials         * 0.0.6      2020-04-03 [1] CRAN (R 4.0.0)
#>  DiceDesign      1.8-1      2019-07-31 [1] CRAN (R 4.0.0)
#>  digest          0.6.25     2020-02-23 [1] CRAN (R 4.0.0)
#>  dplyr         * 0.8.5      2020-03-07 [1] CRAN (R 4.0.0)
#>  DT              0.13       2020-03-23 [1] CRAN (R 4.0.0)
#>  dygraphs        1.1.1.6    2018-07-11 [1] CRAN (R 4.0.0)
#>  ellipsis        0.3.1      2020-05-15 [1] CRAN (R 4.0.0)
#>  evaluate        0.14       2019-05-28 [1] CRAN (R 4.0.0)
#>  fansi           0.4.1      2020-01-08 [1] CRAN (R 4.0.0)
#>  fastmap         1.0.1      2019-10-08 [1] CRAN (R 4.0.0)
#>  foreach         1.5.0      2020-03-30 [1] CRAN (R 4.0.0)
#>  fs              1.4.1      2020-04-04 [1] CRAN (R 4.0.0)
#>  furrr           0.1.0      2018-05-16 [1] CRAN (R 4.0.0)
#>  future          1.17.0     2020-04-18 [1] CRAN (R 4.0.0)
#>  generics        0.0.2      2018-11-29 [1] CRAN (R 4.0.0)
#>  ggplot2       * 3.3.0      2020-03-05 [1] CRAN (R 4.0.0)
#>  ggridges        0.5.2      2020-01-12 [1] CRAN (R 4.0.0)
#>  globals         0.12.5     2019-12-07 [1] CRAN (R 4.0.0)
#>  glue            1.4.1      2020-05-13 [1] CRAN (R 4.0.0)
#>  gower           0.2.1      2019-05-14 [1] CRAN (R 4.0.0)
#>  GPfit           1.0-8      2019-02-08 [1] CRAN (R 4.0.0)
#>  gridExtra       2.3        2017-09-09 [1] CRAN (R 4.0.0)
#>  gtable          0.3.0      2019-03-25 [1] CRAN (R 4.0.0)
#>  gtools          3.8.2      2020-03-31 [1] CRAN (R 4.0.0)
#>  hardhat         0.1.3      2020-05-20 [1] CRAN (R 4.0.0)
#>  highr           0.8        2019-03-20 [1] CRAN (R 4.0.0)
#>  htmltools       0.4.0      2019-10-04 [1] CRAN (R 4.0.0)
#>  htmlwidgets     1.5.1      2019-10-08 [1] CRAN (R 4.0.0)
#>  httpuv          1.5.2      2019-09-11 [1] CRAN (R 4.0.0)
#>  igraph          1.2.5      2020-03-19 [1] CRAN (R 4.0.0)
#>  infer         * 0.5.1      2019-11-19 [1] CRAN (R 4.0.0)
#>  inline          0.3.15     2018-05-18 [1] CRAN (R 4.0.0)
#>  ipred           0.9-9      2019-04-28 [1] CRAN (R 4.0.0)
#>  iterators       1.0.12     2019-07-26 [1] CRAN (R 4.0.0)
#>  janeaustenr     0.1.5      2017-06-10 [1] CRAN (R 4.0.0)
#>  kernlab         0.9-29     2019-11-12 [1] CRAN (R 4.0.0)
#>  knitr           1.28       2020-02-06 [1] CRAN (R 4.0.0)
#>  later           1.0.0      2019-10-04 [1] CRAN (R 4.0.0)
#>  lattice         0.20-41    2020-04-02 [3] CRAN (R 4.0.0)
#>  lava            1.6.7      2020-03-05 [1] CRAN (R 4.0.0)
#>  lhs             1.0.2      2020-04-13 [1] CRAN (R 4.0.0)
#>  lifecycle       0.2.0      2020-03-06 [1] CRAN (R 4.0.0)
#>  listenv         0.8.0      2019-12-05 [1] CRAN (R 4.0.0)
#>  lme4            1.1-23     2020-04-07 [1] CRAN (R 4.0.0)
#>  loo             2.2.0      2019-12-19 [1] CRAN (R 4.0.0)
#>  lubridate       1.7.8      2020-04-06 [1] CRAN (R 4.0.0)
#>  magrittr        1.5        2014-11-22 [1] CRAN (R 4.0.0)
#>  markdown        1.1        2019-08-07 [1] CRAN (R 4.0.0)
#>  MASS            7.3-51.6   2020-04-26 [3] CRAN (R 4.0.0)
#>  Matrix          1.2-18     2019-11-27 [3] CRAN (R 4.0.0)
#>  matrixStats     0.56.0     2020-03-13 [1] CRAN (R 4.0.0)
#>  memoise         1.1.0      2017-04-21 [1] CRAN (R 4.0.0)
#>  mime            0.9        2020-02-04 [1] CRAN (R 4.0.0)
#>  miniUI          0.1.1.1    2018-05-18 [1] CRAN (R 4.0.0)
#>  minqa           1.2.4      2014-10-09 [1] CRAN (R 4.0.0)
#>  mlbench       * 2.1-1      2012-07-10 [1] CRAN (R 4.0.0)
#>  munsell         0.5.0      2018-06-12 [1] CRAN (R 4.0.0)
#>  nlme            3.1-147    2020-04-13 [3] CRAN (R 4.0.0)
#>  nloptr          1.2.2.1    2020-03-11 [1] CRAN (R 4.0.0)
#>  nnet            7.3-14     2020-04-26 [3] CRAN (R 4.0.0)
#>  parsnip       * 0.1.1      2020-05-06 [1] CRAN (R 4.0.0)
#>  pillar          1.4.4      2020-05-05 [1] CRAN (R 4.0.0)
#>  pkgbuild        1.0.8      2020-05-07 [1] CRAN (R 4.0.0)
#>  pkgconfig       2.0.3      2019-09-22 [1] CRAN (R 4.0.0)
#>  pkgload         1.0.2      2018-10-29 [1] CRAN (R 4.0.0)
#>  plyr            1.8.6      2020-03-03 [1] CRAN (R 4.0.0)
#>  prettyunits     1.1.1      2020-01-24 [1] CRAN (R 4.0.0)
#>  pROC            1.16.2     2020-03-19 [1] CRAN (R 4.0.0)
#>  processx        3.4.2      2020-02-09 [1] CRAN (R 4.0.0)
#>  prodlim         2019.11.13 2019-11-17 [1] CRAN (R 4.0.0)
#>  promises        1.1.0      2019-10-04 [1] CRAN (R 4.0.0)
#>  ps              1.3.3      2020-05-08 [1] CRAN (R 4.0.0)
#>  purrr         * 0.3.4      2020-04-17 [1] CRAN (R 4.0.0)
#>  R6              2.4.1      2019-11-12 [1] CRAN (R 4.0.0)
#>  Rcpp            1.0.4.6    2020-04-09 [1] CRAN (R 4.0.0)
#>  recipes       * 0.1.12     2020-05-01 [1] CRAN (R 4.0.0)
#>  remotes         2.1.1      2020-02-15 [1] CRAN (R 4.0.0)
#>  reshape2        1.4.4      2020-04-09 [1] CRAN (R 4.0.0)
#>  rlang           0.4.6      2020-05-02 [1] CRAN (R 4.0.0)
#>  rmarkdown       2.1        2020-01-20 [1] CRAN (R 4.0.0)
#>  rpart           4.1-15     2019-04-12 [3] CRAN (R 4.0.0)
#>  rprojroot       1.3-2      2018-01-03 [1] CRAN (R 4.0.0)
#>  rsample       * 0.0.6      2020-03-31 [1] CRAN (R 4.0.0)
#>  rsconnect       0.8.16     2019-12-13 [1] CRAN (R 4.0.0)
#>  rstan           2.19.3     2020-02-11 [1] CRAN (R 4.0.0)
#>  rstanarm        2.19.3     2020-02-11 [1] CRAN (R 4.0.0)
#>  rstantools      2.0.0      2019-09-15 [1] CRAN (R 4.0.0)
#>  rstudioapi      0.11       2020-02-07 [1] CRAN (R 4.0.0)
#>  scales        * 1.1.1      2020-05-11 [1] CRAN (R 4.0.0)
#>  sessioninfo     1.1.1      2018-11-05 [1] CRAN (R 4.0.0)
#>  shiny           1.4.0.2    2020-03-13 [1] CRAN (R 4.0.0)
#>  shinyjs         1.1        2020-01-13 [1] CRAN (R 4.0.0)
#>  shinystan       2.5.0      2018-05-01 [1] CRAN (R 4.0.0)
#>  shinythemes     1.1.2      2018-11-06 [1] CRAN (R 4.0.0)
#>  SnowballC       0.7.0      2020-04-01 [1] CRAN (R 4.0.0)
#>  StanHeaders     2.19.2     2020-02-11 [1] CRAN (R 4.0.0)
#>  statmod         1.4.34     2020-02-17 [1] CRAN (R 4.0.0)
#>  stringi         1.4.6      2020-02-17 [1] CRAN (R 4.0.0)
#>  stringr         1.4.0      2019-02-10 [1] CRAN (R 4.0.0)
#>  survival        3.1-12     2020-04-10 [3] CRAN (R 4.0.0)
#>  testthat        2.3.2      2020-03-02 [1] CRAN (R 4.0.0)
#>  threejs         0.3.3      2020-01-21 [1] CRAN (R 4.0.0)
#>  tibble        * 3.0.1      2020-04-20 [1] CRAN (R 4.0.0)
#>  tidymodels    * 0.1.0      2020-02-16 [1] CRAN (R 4.0.0)
#>  tidyposterior   0.0.2      2018-11-15 [1] CRAN (R 4.0.0)
#>  tidypredict     0.4.5      2020-02-10 [1] CRAN (R 4.0.0)
#>  tidyr           1.1.0      2020-05-20 [1] CRAN (R 4.0.0)
#>  tidyselect      1.1.0      2020-05-11 [1] CRAN (R 4.0.0)
#>  tidytext        0.2.4      2020-04-17 [1] CRAN (R 4.0.0)
#>  timeDate        3043.102   2018-02-21 [1] CRAN (R 4.0.0)
#>  tokenizers      0.2.1      2018-03-29 [1] CRAN (R 4.0.0)
#>  tune          * 0.1.0      2020-04-02 [1] CRAN (R 4.0.0)
#>  usethis         1.6.1      2020-04-29 [1] CRAN (R 4.0.0)
#>  utf8            1.1.4      2018-05-24 [1] CRAN (R 4.0.0)
#>  vctrs           0.3.0      2020-05-11 [1] CRAN (R 4.0.0)
#>  withr           2.2.0      2020-04-20 [1] CRAN (R 4.0.0)
#>  workflows     * 0.1.1      2020-03-17 [1] CRAN (R 4.0.0)
#>  xfun            0.14       2020-05-20 [1] CRAN (R 4.0.0)
#>  xtable          1.8-4      2019-04-21 [1] CRAN (R 4.0.0)
#>  xts             0.12-0     2020-01-19 [1] CRAN (R 4.0.0)
#>  yaml            2.2.1      2020-02-01 [1] CRAN (R 4.0.0)
#>  yardstick     * 0.0.6      2020-03-17 [1] CRAN (R 4.0.0)
#>  zoo             1.8-8      2020-05-02 [1] CRAN (R 4.0.0)
#> 
#> [1] /usr/local/lib/R/site-library
#> [2] /usr/lib/R/site-library
#> [3] /usr/lib/R/library
topepo commented 4 years ago

It is always better to start a new issue when you have an error (and reference this issue). We are unlikely to look at closed issues.

In this particular case, you are using a negative value for the scale parameter in the kernel function. If you have that > 0, it will run fine.

github-actions[bot] commented 3 years ago

This issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue.