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

Tuning results give "All models failed" message #69

Closed
JauntyJJS opened this issue Aug 17, 2022 · 2 comments
Closed

Tuning results give "All models failed" message #69

JauntyJJS opened this issue Aug 17, 2022 · 2 comments

Comments

@JauntyJJS
Copy link

Hi,

I tried to run the code that does the tuning in https://emilhvitfeldt.github.io/tidyclust/articles/tuning_and_metrics.html

I have installed the development of parsnip and workflows.

remotes::install_github("tidymodels/parsnip")
#> Skipping install of 'parsnip' from a github remote, the SHA1 (de886645) has not changed since last install.
#>   Use `force = TRUE` to force installation
remotes::install_github("tidymodels/workflows@celery")
#> Skipping install of 'workflows' from a github remote, the SHA1 (099a735e) has not changed since last install.
#>   Use `force = TRUE` to force installation

Created on 2022-08-17 by the reprex package (v2.0.1)

Unfortunately, the tuning results give this message saying all the models have failed.

library(parsnip)
library(workflows)
library(rsample)
library(recipes)
#> Loading required package: dplyr
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union
#> 
#> Attaching package: 'recipes'
#> The following object is masked from 'package:stats':
#> 
#>     step
library(tune)
library(dials)
#> Loading required package: scales
library(tidyr)
library(modeldata)
library(tidyclust)
#> 
#> Attaching package: 'tidyclust'
#> The following object is masked from 'package:parsnip':
#> 
#>     prepare_data

data("penguins", package = "modeldata")

penguins <- penguins %>%
 drop_na()

penguins_cv <- vfold_cv(penguins, v = 5)

kmeans_spec <- k_means(num_clusters = tune()) 

penguins_rec <- recipe(~ bill_length_mm + bill_depth_mm, 
                      data = penguins)

kmeans_wflow <- workflow(penguins_rec, kmeans_spec)

clust_num_grid <- grid_regular(num_clusters(), 
                              levels = 10)

res <- tune_cluster(
 kmeans_wflow,
 resamples = penguins_cv,
 grid = clust_num_grid,
 control = control_grid(save_pred = TRUE, extract = identity),
 metrics = cluster_metric_set(tot_wss, tot_sse, sse_ratio)
) 
#> Warning: All models failed. See the `.notes` column.

res
#> # Tuning results
#> # 5-fold cross-validation 
#> # A tibble: 5 × 6
#>   splits           id    .metrics .notes .extracts .predictions
#>   <list>           <chr> <list>   <list> <list>    <list>      
#> 1 <split [266/67]> Fold1 <NULL>   <NULL> <NULL>    <NULL>      
#> 2 <split [266/67]> Fold2 <NULL>   <NULL> <NULL>    <NULL>      
#> 3 <split [266/67]> Fold3 <NULL>   <NULL> <NULL>    <NULL>      
#> 4 <split [267/66]> Fold4 <NULL>   <NULL> <NULL>    <NULL>      
#> 5 <split [267/66]> Fold5 <NULL>   <NULL> <NULL>    <NULL>

sessionInfo()
#> R version 4.2.1 (2022-06-23 ucrt)
#> Platform: x86_64-w64-mingw32/x64 (64-bit)
#> Running under: Windows 10 x64 (build 19044)
#> 
#> Matrix products: default
#> 
#> locale:
#> [1] LC_COLLATE=English_Singapore.utf8  LC_CTYPE=English_Singapore.utf8   
#> [3] LC_MONETARY=English_Singapore.utf8 LC_NUMERIC=C                      
#> [5] LC_TIME=English_Singapore.utf8    
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> other attached packages:
#>  [1] tidyclust_0.0.0.9000 modeldata_1.0.0      tidyr_1.2.0         
#>  [4] dials_1.0.0          scales_1.2.0         tune_1.0.0          
#>  [7] recipes_1.0.1        dplyr_1.0.9          rsample_1.1.0       
#> [10] workflows_1.0.0.9000 parsnip_1.0.0.9000  
#> 
#> loaded via a namespace (and not attached):
#>  [1] splines_4.2.1      foreach_1.5.2      R.utils_2.12.0     prodlim_2019.11.13
#>  [5] highr_0.9          GPfit_1.0-8        yaml_2.3.5         globals_0.16.0    
#>  [9] ipred_0.9-13       pillar_1.8.0       lattice_0.20-45    glue_1.6.2        
#> [13] digest_0.6.29      hardhat_1.2.0      colorspace_2.0-3   htmltools_0.5.2   
#> [17] Matrix_1.4-1       R.oo_1.25.0        timeDate_4021.104  pkgconfig_2.0.3   
#> [21] lhs_1.1.5          DiceDesign_1.9     listenv_0.8.0      purrr_0.3.4       
#> [25] gower_1.0.0        lava_1.6.10        tibble_3.1.8       styler_1.7.0      
#> [29] generics_0.1.3     ggplot2_3.3.6      ellipsis_0.3.2     withr_2.5.0       
#> [33] furrr_0.3.1        nnet_7.3-17        cli_3.3.0          crayon_1.5.1      
#> [37] survival_3.3-1     magrittr_2.0.3     evaluate_0.15      R.methodsS3_1.8.2 
#> [41] fs_1.5.2           future_1.27.0      fansi_1.0.3        parallelly_1.32.1 
#> [45] R.cache_0.15.0     MASS_7.3-57        class_7.3-20       tools_4.2.1       
#> [49] lifecycle_1.0.1    stringr_1.4.0      munsell_0.5.0      reprex_2.0.1      
#> [53] compiler_4.2.1     rlang_1.0.4        grid_4.2.1         iterators_1.0.14  
#> [57] yardstick_1.0.0    rstudioapi_0.13    rmarkdown_2.14     gtable_0.3.0      
#> [61] codetools_0.2-18   R6_2.5.1           lubridate_1.8.0    knitr_1.39        
#> [65] fastmap_1.1.0      future.apply_1.9.0 utf8_1.2.2         stringi_1.7.8     
#> [69] parallel_4.2.1     Rcpp_1.0.9         vctrs_0.4.1        rpart_4.1.16      
#> [73] tidyselect_1.1.2   xfun_0.31

Created on 2022-08-17 by the reprex package (v2.0.1)

Is the tuning procedures still under development ?

@JauntyJJS
Copy link
Author

Somehow I managed to get it to work again.

@github-actions
Copy link

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.

@github-actions github-actions bot locked and limited conversation to collaborators Jan 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant