stevenpawley / colino

Recipes Steps for Supervised Filter-Based Feature Selection
https://stevenpawley.github.io/colino/
Other
37 stars 5 forks source link

Conflicts or errors in the tune and tidymodels packages using information gain from the colino package or recipeselectors. #6

Closed forecastingEDs closed 1 year ago

forecastingEDs commented 1 year ago

Hello @stevenpawley , Please help me!

This code was working until yesterday, when I uninstalled the recipeselectors and colino packages. I've looked everywhere and it looks like other users have recently reported the same error:

https://stackoverflow.com/questions/76463339/error-in-purrrmap-unable-to-use-step-select-from-colino-and-workflow/76508232

There seems to be a conflict between recipeselectors and colino in which they both want to run the step_select_infgain function. I already tried deleting one of the two packages recipeselectors or colino, but the error remains. Until two days ago my script was working normally, but I needed to install the recipeselectors and colino packages and the error started to appear.

Link to download the database used:

https://github.com/forecastingEDs/Forecasting-of-admissions-in-the-emergency-departments/blob/131bd23723a39724ad4f88ad6b8e5a58f42a7960/datasets.xlsx

Repex reproducible example

*** Load the following R packages ----

library(remotes)
library(pak)
remotes::install_github("business-science/modeltime.ensemble")
remotes::install_github("tidymodels/recipes")
library(recipes)
library(tune)
library(keras)
library(ForecastTB) 
library(ggplot2)
library(zoo)
library(forecast)
library(lmtest)
library(urca)
library(stats)
library(nnfor)
library(forecastHybrid)
library(pastecs)
library(forecastML)
library(Rcpp)
library(modeltime.ensemble)
library(tidymodels)
library(modeltime)
library(lubridate)
library(tidyverse)
library(timetk)
library(tidyquant)
library(yardstick)
library(reshape)
library(plotly)
library(xgboost)
library(rsample)
library(targets)
library(tidymodels)
library(modeltime)
library(timetk)
library(tidyverse)
library(tidyquant)
library(LiblineaR)
library(parsnip)
library(ranger)
library(kknn)
library(readxl)
library(lifecycle)
library(skimr) 
library(remotes)
remotes::install_github("tidymodels/bonsai")
library(bonsai)
library(lightgbm)
remotes::install_github("curso-r/treesnip")
library(treesnip)
library(rio)
library(pak)
library(devtools) 
devtools::install_github("stevenpawley/recipeselectors")
devtools::install_github("stevenpawley/colino")
library(colino)
library(recipeselectors)
library(FSelectorRcpp)
library(care)
library(parsnip)
library(Boruta)
library(praznik)
library(parallel) 
library(foreach)
library(doParallel)
library(RcppParallel)

Preparing data for preprocessing with recipe

data_tbl <- datasets %>%
  select(id, Date, attendences, average_temperature, min, max,  sunday, monday, tuesday, wednesday, thursday, friday, saturday, Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec) %>%
  set_names(c("id", "date", "value","tempe_verage", "tempemin", "tempemax", "sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"))

data_tbl

Full = Training + Forecast Datasets

full_data_tbl <- datasets %>%
  select(id, Date, attendences, average_temperature, min, max,  sunday, monday, tuesday, wednesday, thursday, friday, saturday, Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec) %>%
  set_names(c("id", "date", "value","tempe_verage", "tempemin", "tempemax", "sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec")) %>%

Apply Group-wise Time Series Manipulations

group_by(id) %>%
  future_frame(
    .date_var   = date,
    .length_out = "45 days",
    .bind_data  = TRUE
  ) %>%
  ungroup() %>%

Consolidate IDs

mutate(id = fct_drop(id))

Training Data

data_prepared_tbl <- full_data_tbl %>%
  filter(!is.na(value))

Forecast Data

future_tbl <- full_data_tbl %>%
  filter(is.na(value))

data_prepared_tbl %>% glimpse()

** Summary Diagnostics. Let us check the regularity of all time series with timetk::tk_summary_diagnostics()

** Check for summary of timeseries data for training set

data_prepared_tbl %>%
  group_by(id) %>%
  tk_summary_diagnostics()

Data Splitting ----

Now we set aside the future data (we would only need that later when we make forecast)

And focus on training data

* 4.1 Panel Data Splitting ----

Split the dataset into analyis/assessment set

`emergency_tscv <- data_prepared_tbl %>%
  time_series_cv(
    date_var    = date, 
    assess      = "45 days",
    skip        = "30 days",
    cumulative  = TRUE,
    slice_limit = 5
  )

emergency_tscv`

Feature Selection and preprocessing ----

Information gain feature selection ----

recipe_spec <- recipe(value ~ ., 
                      data = training(emergency_tscv$splits[[1]])) %>%
  step_timeseries_signature(date) %>%
  step_rm(matches("(.iso$)|(.xts$)|(.lbl$)|(hour)|(minute)|(second)|(am.pm)|(date_year$)")) %>%
  step_normalize (date_index.num,tempe_verage,tempemin,tempemax, -all_outcomes())%>%
  step_select_infgain(all_predictors(), scores = TRUE, top_p = 22, outcome = "value") %>%
  step_mutate(data = factor(value, ordered = TRUE))%>%
  step_dummy(all_nominal(), one_hot = TRUE)

recipe_spec %>% prep() %>% juice() %>% glimpse()

*** Model 4: GLMNET ----

wflw_fit_glmnet <- workflow() %>%
  add_model(
    linear_reg(mixture = tune(),
               penalty = tune()) %>% set_engine("glmnet", num.threads = 20))%>%
  add_recipe(recipe_spec %>% step_rm(date)) %>%
  tune_grid(grid = 1, recipe_spec, resamples = emergency_tscv, control = control_grid(verbose = TRUE, parallel_over = "resamples", allow_par = TRUE), metrics = metric_set(rmse))
### reported error ###

Error in `map()`:
ℹ In index: 4.
Caused by error in `tibble::tibble()`:
! Tibble columns must have compatible sizes.
• Size 2: Existing data.
• Size 4: Column `call_info`.
ℹ Only values of size one are recycled.
Run `rlang::last_trace()` to see where the error occurred.
Warning message:
The `...` are not used in this function but one or more objects were passed: ''

> rlang::last_trace()
<error/purrr_error_indexed>
Error in `map()`:
ℹ In index: 4.
Caused by error in `tibble::tibble()`:
! Tibble columns must have compatible sizes.
• Size 2: Existing data.
• Size 4: Column `call_info`.
ℹ Only values of size one are recycled.
---
Backtrace:
     ▆
  1. ├─... %>% ...
  2. ├─tune::tune_grid(...)
  3. └─tune:::tune_grid.workflow(...)
  4.   └─tune:::tune_grid_workflow(...)
  5.     └─tune::check_parameters(...)
  6.       ├─hardhat::extract_parameter_set_dials(wflow)
  7.       └─workflows:::extract_parameter_set_dials.workflow(wflow)
  8.         ├─hardhat::extract_parameter_set_dials(recipe)
  9.         └─recipes:::extract_parameter_set_dials.recipe(recipe)
 10.           ├─generics::tunable(x)
 11.           └─recipes:::tunable.recipe(x)
 12.             └─purrr::map_dfr(x$steps, tunable)
 13.               └─purrr::map(.x, .f, ...)
 14.                 └─purrr:::map_("list", .x, .f, ..., .progress = .progress)
 15.                   ├─purrr:::with_indexed_errors(...)
 16.                   │ └─base::withCallingHandlers(...)
 17.                   ├─purrr:::call_with_cleanup(...)
 18.                   ├─generics (local) .f(.x[[i]], ...)
 19.                   └─colino:::tunable.step_select_infgain(.x[[i]], ...)
 20.                     └─tibble::tibble(...)

See that if we run the model training without the step of selecting variables for information gain, it works normally generating the grid search. It could be some package conflict that I am not able to identify because the preprocessing with the information gain step was working normally

recipe_spec <- recipe(value ~ ., 
                      data = training(emergency_tscv$splits[[1]])) %>%
  step_timeseries_signature(date) %>%
  step_rm(matches("(.iso$)|(.xts$)|(.lbl$)|(hour)|(minute)|(second)|(am.pm)|(date_year$)")) %>%
  step_mutate(data = factor(value, ordered = TRUE))%>%
  step_dummy(all_nominal(), one_hot = TRUE)%>%
  step_normalize (date_index.num,tempe_verage,tempemin,tempemax, -all_outcomes())

recipe_spec %>% prep() %>% juice() %>% glimpse()
wflw_fit_glmnet <- workflow() %>%
  add_model(
    linear_reg(mixture = tune(),
               penalty = tune()) %>% set_engine("glmnet", num.threads = 20))%>%
  add_recipe(recipe_spec %>% step_rm(date)) %>%
  tune_grid(grid = 1, recipe_spec, resamples = emergency_tscv, control = control_grid(verbose = TRUE, parallel_over = "resamples", allow_par = TRUE), metrics = metric_set(rmse))
i Slice1: preprocessor 1/1
✓ Slice1: preprocessor 1/1
i Slice1: preprocessor 1/1, model 1/1
✓ Slice1: preprocessor 1/1, model 1/1
i Slice1: preprocessor 1/1, model 1/1 (extracts)
i Slice1: preprocessor 1/1, model 1/1 (predictions)
i Slice2: preprocessor 1/1
✓ Slice2: preprocessor 1/1
i Slice2: preprocessor 1/1, model 1/1
✓ Slice2: preprocessor 1/1, model 1/1
i Slice2: preprocessor 1/1, model 1/1 (extracts)
i Slice2: preprocessor 1/1, model 1/1 (predictions)
i Slice3: preprocessor 1/1
✓ Slice3: preprocessor 1/1
i Slice3: preprocessor 1/1, model 1/1
✓ Slice3: preprocessor 1/1, model 1/1
i Slice3: preprocessor 1/1, model 1/1 (extracts)
i Slice3: preprocessor 1/1, model 1/1 (predictions)
i Slice4: preprocessor 1/1
✓ Slice4: preprocessor 1/1
i Slice4: preprocessor 1/1, model 1/1
✓ Slice4: preprocessor 1/1, model 1/1
i Slice4: preprocessor 1/1, model 1/1 (extracts)
i Slice4: preprocessor 1/1, model 1/1 (predictions)
i Slice5: preprocessor 1/1
✓ Slice5: preprocessor 1/1
i Slice5: preprocessor 1/1, model 1/1
✓ Slice5: preprocessor 1/1, model 1/1
i Slice5: preprocessor 1/1, model 1/1 (extracts)
i Slice5: preprocessor 1/1, model 1/1 (predictions)
glmnet_tune_All_45 <- wflw_fit_glmnet
wflw_fit_glmnet %>% show_best(metric = "rmse")

result

A tibble: 1 × 8

penalty mixture .metric .estimator  mean     n std_err .config             
     <dbl>   <dbl> <chr>   <chr>      <dbl> <int>   <dbl> <chr>               
1 0.000110   0.762 rmse    standard    4.75     5   0.339 Preprocessor1_Model1
> session_info()
─ Session info ─────────────────────────────────────────────────────────────────────────────────────────────
 setting  value
 version  R version 4.3.0 (2023-04-21 ucrt)
 os       Windows 11 x64 (build 22621)
 system   x86_64, mingw32
 ui       RStudio
 language (EN)
 collate  English_United States.utf8
 ctype    English_United States.utf8
 tz       America/Sao_Paulo
 date     2023-06-18
 rstudio  2023.06.0+421 Mountain Hydrangea (desktop)
 pandoc   NA

─ Packages ─────────────────────────────────────────────────────────────────────────────────────────────────
 ! package              * version    date (UTC) lib source
   backports              1.4.1      2021-12-13 [1] CRAN (R 4.3.0)
   base64enc              0.1-3      2015-07-28 [1] CRAN (R 4.3.0)
   bonsai               * 0.2.1.9000 2023-06-15 [1] Github (tidymodels/bonsai@aab79d5)
   boot                   1.3-28.1   2022-11-22 [2] CRAN (R 4.3.0)
   broom                * 1.0.5      2023-06-09 [1] CRAN (R 4.3.0)
   cachem                 1.0.8      2023-05-01 [1] CRAN (R 4.3.0)
   callr                  3.7.3      2022-11-02 [1] CRAN (R 4.3.0)
   cellranger             1.1.0      2016-07-27 [1] CRAN (R 4.3.0)
   circlize               0.4.15     2022-05-10 [1] CRAN (R 4.3.0)
   class                  7.3-21     2023-01-23 [2] CRAN (R 4.3.0)
   cli                    3.6.1      2023-03-23 [1] CRAN (R 4.3.0)
   cluster                2.1.4      2022-08-22 [2] CRAN (R 4.3.0)
   codetools              0.2-19     2023-02-01 [2] CRAN (R 4.3.0)
   colino               * 0.0.1      2023-06-18 [1] Github (stevenpawley/colino@6738db1)
   colorspace             2.1-0      2023-01-23 [1] CRAN (R 4.3.0)
   crayon                 1.5.2      2022-09-29 [1] CRAN (R 4.3.0)
   curl                   5.0.1      2023-06-07 [1] CRAN (R 4.3.0)
   data.table             1.14.8     2023-02-17 [1] CRAN (R 4.3.0)
   desc                   1.4.2      2022-09-08 [1] CRAN (R 4.3.0)
   devtools             * 2.4.5      2022-10-11 [1] CRAN (R 4.3.0)
   dials                * 1.2.0      2023-04-03 [1] CRAN (R 4.3.0)
   DiceDesign             1.9        2021-02-13 [1] CRAN (R 4.3.0)
   digest                 0.6.31     2022-12-11 [1] CRAN (R 4.3.0)
   doParallel             1.0.17     2022-02-07 [1] CRAN (R 4.3.0)
   dplyr                * 1.1.2      2023-04-20 [1] CRAN (R 4.3.0)
   ellipsis               0.3.2      2021-04-29 [1] CRAN (R 4.3.0)
   fansi                  1.0.4      2023-01-22 [1] CRAN (R 4.3.0)
   fastmap                1.1.1      2023-02-24 [1] CRAN (R 4.3.0)
   forcats              * 1.0.0      2023-01-29 [1] CRAN (R 4.3.0)
   foreach                1.5.2      2022-02-02 [1] CRAN (R 4.3.0)
   forecast             * 8.21       2023-02-27 [1] CRAN (R 4.3.0)
   forecastHybrid       * 5.0.19     2020-08-28 [1] CRAN (R 4.3.0)
   forecastML           * 0.9.0      2020-05-07 [1] CRAN (R 4.3.0)
   ForecastTB           * 1.0.1      2020-03-14 [1] CRAN (R 4.3.0)
   foreign                0.8-84     2022-12-06 [2] CRAN (R 4.3.0)
   fracdiff               1.5-2      2022-10-31 [1] CRAN (R 4.3.0)
   fs                     1.6.2      2023-04-25 [1] CRAN (R 4.3.0)
   FSelectorRcpp          0.3.11     2023-04-28 [1] CRAN (R 4.3.0)
   furrr                  0.3.1      2022-08-15 [1] CRAN (R 4.3.0)
   future                 1.32.0     2023-03-07 [1] CRAN (R 4.3.0)
   future.apply           1.11.0     2023-05-21 [1] CRAN (R 4.3.0)
   generics             * 0.1.3      2022-07-05 [1] CRAN (R 4.3.0)
   ggplot2              * 3.4.2      2023-04-03 [1] CRAN (R 4.3.0)
   ggtext                 0.1.2      2022-09-16 [1] CRAN (R 4.3.0)
   glmnet               * 4.1-7      2023-03-23 [1] CRAN (R 4.3.0)
   GlobalOptions          0.1.2      2020-06-10 [1] CRAN (R 4.3.0)
   globals                0.16.2     2022-11-21 [1] CRAN (R 4.3.0)
   glue                   1.6.2      2022-02-24 [1] CRAN (R 4.3.0)
   gower                  1.0.1      2022-12-22 [1] CRAN (R 4.3.0)
   GPfit                  1.0-8      2019-02-08 [1] CRAN (R 4.3.0)
   greybox                1.0.8      2023-04-02 [1] CRAN (R 4.3.0)
   gridExtra              2.3        2017-09-09 [1] CRAN (R 4.3.0)
   gridtext               0.1.5      2022-09-16 [1] CRAN (R 4.3.0)
   gtable                 0.3.3      2023-03-21 [1] CRAN (R 4.3.0)
   hardhat                1.3.0      2023-03-30 [1] CRAN (R 4.3.0)
   haven                  2.5.2      2023-02-28 [1] CRAN (R 4.3.0)
   hms                    1.1.3      2023-03-21 [1] CRAN (R 4.3.0)
   htmltools              0.5.5      2023-03-23 [1] CRAN (R 4.3.0)
   htmlwidgets            1.6.2      2023-03-17 [1] CRAN (R 4.3.0)
   httpuv                 1.6.11     2023-05-11 [1] CRAN (R 4.3.0)
   httr                   1.4.6      2023-05-08 [1] CRAN (R 4.3.0)
   imputeTestbench        3.0.3      2019-07-05 [1] CRAN (R 4.3.0)
   imputeTS               3.3        2022-09-09 [1] CRAN (R 4.3.0)
   infer                * 1.0.4      2022-12-02 [1] CRAN (R 4.3.0)
   ipred                  0.9-14     2023-03-09 [1] CRAN (R 4.3.0)
   iterators              1.0.14     2022-02-05 [1] CRAN (R 4.3.0)
   jsonlite               1.8.5      2023-06-05 [1] CRAN (R 4.3.0)
   keras                * 2.11.1     2023-03-20 [1] CRAN (R 4.3.0)
   later                  1.3.1      2023-05-02 [1] CRAN (R 4.3.0)
   lattice                0.21-8     2023-04-05 [2] CRAN (R 4.3.0)
   lava                   1.7.2.1    2023-02-27 [1] CRAN (R 4.3.0)
   lhs                    1.1.6      2022-12-17 [1] CRAN (R 4.3.0)
   lifecycle              1.0.3      2022-10-07 [1] CRAN (R 4.3.0)
   lightgbm             * 3.3.5      2023-01-16 [1] CRAN (R 4.3.0)
   listenv                0.9.0      2022-12-16 [1] CRAN (R 4.3.0)
   lmtest               * 0.9-40     2022-03-21 [1] CRAN (R 4.3.0)
   lubridate            * 1.9.2      2023-02-10 [1] CRAN (R 4.3.0)
   magrittr               2.0.3      2022-03-30 [1] CRAN (R 4.3.0)
   MAPA                   2.0.5      2022-07-10 [1] CRAN (R 4.3.0)
   MASS                   7.3-58.4   2023-03-07 [2] CRAN (R 4.3.0)
   Matrix               * 1.5-4      2023-04-04 [2] CRAN (R 4.3.0)
   memoise                2.0.1      2021-11-26 [1] CRAN (R 4.3.0)
   mime                   0.12       2021-09-28 [1] CRAN (R 4.3.0)
   miniUI                 0.1.1.1    2018-05-18 [1] CRAN (R 4.3.0)
   modeldata            * 1.1.0      2023-01-25 [1] CRAN (R 4.3.0)
   modeltime            * 1.2.6      2023-03-31 [1] CRAN (R 4.3.0)
   modeltime.ensemble   * 1.0.3      2023-04-18 [1] CRAN (R 4.3.0)
   modeltime.resample   * 0.2.3      2023-04-12 [1] CRAN (R 4.3.0)
   munsell                0.5.0      2018-06-12 [1] CRAN (R 4.3.0)
   nlme                   3.1-162    2023-01-31 [2] CRAN (R 4.3.0)
   nloptr                 2.0.3      2022-05-26 [1] CRAN (R 4.3.0)
   nnet                   7.3-18     2022-09-28 [2] CRAN (R 4.3.0)
   nnfor                * 0.9.8      2022-07-09 [1] CRAN (R 4.3.0)
   openxlsx               4.2.5.2    2023-02-06 [1] CRAN (R 4.3.0)
   pak                  * 0.5.1      2023-04-27 [1] CRAN (R 4.3.0)
   parallelly             1.36.0     2023-05-26 [1] CRAN (R 4.3.0)
   parsnip              * 1.1.0      2023-04-12 [1] CRAN (R 4.3.0)
   pastecs              * 1.3.21     2018-03-15 [1] CRAN (R 4.3.0)
   PerformanceAnalytics * 2.0.4      2020-02-06 [1] CRAN (R 4.3.0)
   pillar                 1.9.0      2023-03-22 [1] CRAN (R 4.3.0)
   pkgbuild               1.4.1      2023-06-14 [1] CRAN (R 4.3.0)
   pkgconfig              2.0.3      2019-09-22 [1] CRAN (R 4.3.0)
   pkgload                1.3.2      2022-11-16 [1] CRAN (R 4.3.0)
   plyr                   1.8.8      2022-11-11 [1] CRAN (R 4.3.0)
   png                    0.1-8      2022-11-29 [1] CRAN (R 4.3.0)
   pracma                 2.4.2      2022-09-22 [1] CRAN (R 4.3.0)
   prettyunits            1.1.1      2020-01-24 [1] CRAN (R 4.3.0)
   processx               3.8.1      2023-04-18 [1] CRAN (R 4.3.0)
   prodlim                2023.03.31 2023-04-02 [1] CRAN (R 4.3.0)
   profvis                0.3.8      2023-05-02 [1] CRAN (R 4.3.0)
   promises               1.2.0.1    2021-02-11 [1] CRAN (R 4.3.0)
   ps                     1.7.5      2023-04-18 [1] CRAN (R 4.3.0)
   PSF                    0.5        2022-05-01 [1] CRAN (R 4.3.0)
   purrr                * 1.0.1      2023-01-10 [1] CRAN (R 4.3.0)
   quadprog               1.5-8      2019-11-20 [1] CRAN (R 4.3.0)
   Quandl                 2.11.0     2021-08-11 [1] CRAN (R 4.3.0)
   quantmod             * 0.4.23     2023-06-15 [1] CRAN (R 4.3.0)
   R6                   * 2.5.1      2021-08-19 [1] CRAN (R 4.3.0)
   RColorBrewer           1.1-3      2022-04-03 [1] CRAN (R 4.3.0)
   Rcpp                 * 1.0.10     2023-01-22 [1] CRAN (R 4.3.0)
 D RcppParallel           5.1.7      2023-02-27 [1] CRAN (R 4.3.0)
   readr                * 2.1.4      2023-02-10 [1] CRAN (R 4.3.0)
   readxl               * 1.4.2      2023-02-09 [1] CRAN (R 4.3.0)
   recipes              * 1.0.6.9000 2023-06-18 [1] Github (tidymodels/recipes@0d528b2)
   remotes                2.4.2      2021-11-30 [1] CRAN (R 4.3.0)
   reshape2               1.4.4      2020-04-09 [1] CRAN (R 4.3.0)
   reticulate             1.30       2023-06-09 [1] CRAN (R 4.3.0)
   rio                  * 0.5.29     2021-11-22 [1] CRAN (R 4.3.0)
   rlang                  1.1.1      2023-04-28 [1] CRAN (R 4.3.0)
   rpart                  4.1.19     2022-10-21 [2] CRAN (R 4.3.0)
   rprojroot              2.0.3      2022-04-02 [1] CRAN (R 4.3.0)
   rsample              * 1.1.1      2022-12-07 [1] CRAN (R 4.3.0)
   rstudioapi             0.14       2022-08-22 [1] CRAN (R 4.3.0)
   scales               * 1.2.1      2022-08-20 [1] CRAN (R 4.3.0)
   sessioninfo            1.2.2      2021-12-06 [1] CRAN (R 4.3.0)
   shape                  1.4.6      2021-05-19 [1] CRAN (R 4.3.0)
   shiny                  1.7.4      2022-12-15 [1] CRAN (R 4.3.0)
   smooth                 3.2.1      2023-06-01 [1] CRAN (R 4.3.0)
   StanHeaders            2.26.27    2023-06-14 [1] CRAN (R 4.3.0)
   statmod                1.5.0      2023-01-06 [1] CRAN (R 4.3.0)
   stinepack              1.4        2018-07-30 [1] CRAN (R 4.3.0)
   stringi                1.7.12     2023-01-11 [1] CRAN (R 4.3.0)
   stringr              * 1.5.0      2022-12-02 [1] CRAN (R 4.3.0)
   survival               3.5-5      2023-03-12 [2] CRAN (R 4.3.0)
   tensorflow             2.11.0     2022-12-19 [1] CRAN (R 4.3.0)
   texreg                 1.38.6     2022-04-06 [1] CRAN (R 4.3.0)
   tfruns                 1.5.1      2022-09-05 [1] CRAN (R 4.3.0)
   thief                * 0.3        2018-01-24 [1] CRAN (R 4.3.0)
   tibble               * 3.2.1      2023-03-20 [1] CRAN (R 4.3.0)
   tidymodels           * 1.1.0      2023-05-01 [1] CRAN (R 4.3.1)
   tidyquant            * 1.0.7      2023-03-31 [1] CRAN (R 4.3.0)
   tidyr                * 1.3.0      2023-01-24 [1] CRAN (R 4.3.0)
   tidyselect             1.2.0      2022-10-10 [1] CRAN (R 4.3.0)
   tidyverse            * 2.0.0      2023-02-22 [1] CRAN (R 4.3.0)
   timechange             0.2.0      2023-01-11 [1] CRAN (R 4.3.0)
   timeDate               4022.108   2023-01-07 [1] CRAN (R 4.3.0)
   timetk               * 2.8.3      2023-03-30 [1] CRAN (R 4.3.0)
   tree                   1.0-43     2023-02-05 [1] CRAN (R 4.3.0)
   tseries                0.10-54    2023-05-02 [1] CRAN (R 4.3.0)
   tsutils                0.9.3      2022-07-05 [1] CRAN (R 4.3.0)
   TTR                  * 0.24.3     2021-12-12 [1] CRAN (R 4.3.0)
   tune                 * 1.1.1      2023-04-11 [1] CRAN (R 4.3.0)
   tzdb                   0.4.0      2023-05-12 [1] CRAN (R 4.3.0)
   urca                 * 1.3-3      2022-08-29 [1] CRAN (R 4.3.0)
   urlchecker             1.0.1      2021-11-30 [1] CRAN (R 4.3.0)
   uroot                  2.1-2      2020-09-04 [1] CRAN (R 4.3.0)
   usethis              * 2.2.0      2023-06-06 [1] CRAN (R 4.3.0)
   utf8                   1.2.3      2023-01-31 [1] CRAN (R 4.3.0)
   vctrs                  0.6.3      2023-06-14 [1] CRAN (R 4.3.0)
   whisker                0.4.1      2022-12-05 [1] CRAN (R 4.3.0)
   withr                  2.5.0      2022-03-03 [1] CRAN (R 4.3.0)
   workflows            * 1.1.3      2023-02-22 [1] CRAN (R 4.3.0)
   workflowsets         * 1.0.1      2023-04-06 [1] CRAN (R 4.3.0)
   xml2                   1.3.4      2023-04-27 [1] CRAN (R 4.3.0)
   xtable                 1.8-4      2019-04-21 [1] CRAN (R 4.3.0)
   xts                  * 0.13.1     2023-04-16 [1] CRAN (R 4.3.0)
   yardstick            * 1.2.0      2023-04-21 [1] CRAN (R 4.3.0)
   zeallot                0.1.0      2018-01-28 [1] CRAN (R 4.3.0)
   zip                    2.3.0      2023-04-17 [1] CRAN (R 4.3.0)
   zoo                  * 1.8-12     2023-04-13 [1] CRAN (R 4.3.0)

 [1] C:/Users/Bruno Matos Porto/AppData/Local/R/win-library/4.3
 [2] C:/Program Files/R/R-4.3.0/library

 D ── DLL MD5 mismatch, broken installation.

────────────────

See that if we run the model training without the step of selecting variables for information gain, it works normally generating the grid search. It could be some package conflict that I am not able to identify because the preprocessing with the information gain step was working normally

recipe_spec <- recipe(value ~ ., 
                      data = training(emergency_tscv$splits[[1]])) %>%
  step_timeseries_signature(date) %>%
  step_rm(matches("(.iso$)|(.xts$)|(.lbl$)|(hour)|(minute)|(second)|(am.pm)|(date_year$)")) %>%
  step_mutate(data = factor(value, ordered = TRUE))%>%
  step_dummy(all_nominal(), one_hot = TRUE)%>%
  step_normalize (date_index.num,tempe_verage,tempemin,tempemax, -all_outcomes())

recipe_spec %>% prep() %>% juice() %>% glimpse()
wflw_fit_glmnet <- workflow() %>%
  add_model(
    linear_reg(mixture = tune(),
               penalty = tune()) %>% set_engine("glmnet", num.threads = 20))%>%
  add_recipe(recipe_spec %>% step_rm(date)) %>%
  tune_grid(grid = 1, recipe_spec, resamples = emergency_tscv, control = control_grid(verbose = TRUE, parallel_over = "resamples", allow_par = TRUE), metrics = metric_set(rmse))
i Slice1: preprocessor 1/1
✓ Slice1: preprocessor 1/1
i Slice1: preprocessor 1/1, model 1/1
✓ Slice1: preprocessor 1/1, model 1/1
i Slice1: preprocessor 1/1, model 1/1 (extracts)
i Slice1: preprocessor 1/1, model 1/1 (predictions)
i Slice2: preprocessor 1/1
✓ Slice2: preprocessor 1/1
i Slice2: preprocessor 1/1, model 1/1
✓ Slice2: preprocessor 1/1, model 1/1
i Slice2: preprocessor 1/1, model 1/1 (extracts)
i Slice2: preprocessor 1/1, model 1/1 (predictions)
i Slice3: preprocessor 1/1
✓ Slice3: preprocessor 1/1
i Slice3: preprocessor 1/1, model 1/1
✓ Slice3: preprocessor 1/1, model 1/1
i Slice3: preprocessor 1/1, model 1/1 (extracts)
i Slice3: preprocessor 1/1, model 1/1 (predictions)
i Slice4: preprocessor 1/1
✓ Slice4: preprocessor 1/1
i Slice4: preprocessor 1/1, model 1/1
✓ Slice4: preprocessor 1/1, model 1/1
i Slice4: preprocessor 1/1, model 1/1 (extracts)
i Slice4: preprocessor 1/1, model 1/1 (predictions)
i Slice5: preprocessor 1/1
✓ Slice5: preprocessor 1/1
i Slice5: preprocessor 1/1, model 1/1
✓ Slice5: preprocessor 1/1, model 1/1
i Slice5: preprocessor 1/1, model 1/1 (extracts)
i Slice5: preprocessor 1/1, model 1/1 (predictions)
glmnet_tune_All_45 <- wflw_fit_glmnet
wflw_fit_glmnet %>% show_best(metric = "rmse")

result

A tibble: 1 × 8

penalty mixture .metric .estimator  mean     n std_err .config             
     <dbl>   <dbl> <chr>   <chr>      <dbl> <int>   <dbl> <chr>               
1 0.000110   0.762 rmse    standard    4.75     5   0.339 Preprocessor1_Model1
EmilHvitfeldt commented 1 year ago

Hello @forecastingEDs 👋

This is cross-posted from https://stackoverflow.com/questions/76507745/conflicts-or-errors-in-the-tune-and-tidymodels-packages-using-information-gain-f and https://github.com/tidymodels/tidymodels/issues/109

This bug was introduced in https://github.com/stevenpawley/colino/commit/b6f15487029eaabf6a147383d290104d35cd4854#diff-861702901efb987346f4a1cefaad0ac436f9f8a3a6b1385e12a77a32edbca645, this PR should fix that problem. https://github.com/stevenpawley/colino/pull/7

If you urgently need these changes, you can install {colino} from that branch with pak::pak("stevenpawley/colino#7")

forecastingEDs commented 1 year ago

Dear @EmilHvitfeldt Thanks a lot for providing the bug-fixed version. #7 I managed to install using devtools::install_github("stevenpawley/colino#7") I thank you immensely!** @EmilHvitfeldt

stevenpawley commented 1 year ago

Merged! thanks for the fix and for reporting this!