You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm having trouble when trying to finish the workflow after applying the tune_grid function through worfklow_map. When I extract the best hyperparameters and introduce them in the finalize_workflow() function I get the following error as one of them is engine specific.
I think it is necessary to change the update method of the definition of the arima model. Not sure if maybe others as well, I just try arima.
Error in `parsnip::update_dot_check()` at modeltime/R/parsnip-arima_reg.R:258:4:
! Extra arguments will be ignored: `include.mean`
Reproducible example
``` r
library(tidymodels)
#> Warning: package 'tidymodels' was built under R version 4.1.3#> Warning: package 'broom' was built under R version 4.1.3#> Warning: package 'dials' was built under R version 4.1.3#> Warning: package 'dplyr' was built under R version 4.1.3#> Warning: package 'ggplot2' was built under R version 4.1.3#> Warning: package 'infer' was built under R version 4.1.3#> Warning: package 'modeldata' was built under R version 4.1.3#> Warning: package 'parsnip' was built under R version 4.1.3#> Warning: package 'recipes' was built under R version 4.1.3#> Warning: package 'rsample' was built under R version 4.1.3#> Warning: package 'tibble' was built under R version 4.1.3#> Warning: package 'tidyr' was built under R version 4.1.3#> Warning: package 'tune' was built under R version 4.1.3#> Warning: package 'workflows' was built under R version 4.1.3#> Warning: package 'workflowsets' was built under R version 4.1.3#> Warning: package 'yardstick' was built under R version 4.1.3
library(modeltime)
library(modeltime.resample)
library(timetk)
#> Warning: package 'timetk' was built under R version 4.1.3
library(tidyverse)
full_data_tbl<-walmart_sales_weekly %>%
select(id, Date, Weekly_Sales) %>%
# Apply Group-wise Time Series Manipulations
group_by(id) %>%
future_frame(
.date_var=Date,
.length_out="3 months",
.bind_data=TRUE
) %>%
ungroup() %>%
# Consolidate IDs
mutate(id= fct_drop(id))
# Training Datadata_prepared_tbl<-full_data_tbl %>%
filter(!is.na(Weekly_Sales))
walmart_tscv<-data_prepared_tbl %>%
time_series_cv(
date_var=Date,
assess="3 months",
skip="3 months",
cumulative=TRUE,
slice_limit=6
)
#> Data is not ordered by the 'date_var'. Resamples will be arranged by `Date`.#> Overlapping Timestamps Detected. Processing overlapping time series together using sliding windows.recipe_spec<- recipe(Weekly_Sales~.,
data= training(walmart_tscv$splits[[1]])) %>%
step_filter(id=="1_1") %>%
step_rm(id)
arima_spec<- arima_reg(non_seasonal_ar= tune(),
non_seasonal_differences= tune(),
non_seasonal_ma= tune()) %>%
set_engine("arima", include.mean= tune())
wfset<- workflow_set(
preproc=list(rec=recipe_spec),
models=list(arima=arima_spec),
cross=TRUE
) %>%
option_add(grid= crossing(non_seasonal_ar=1:1,
non_seasonal_differences=1:1,
non_seasonal_ma=1:4,
include.mean=1:1) %>%
mutate(include.mean=TRUE))
grid_results<-wfset %>%
workflow_map("tune_grid",
resamples=walmart_tscv,
seed=123,
metrics= default_forecast_accuracy_metric_set(),
verbose=TRUE)
#> i 1 of 1 tuning: rec_arima#> Registered S3 method overwritten by 'quantmod':#> method from#> as.zoo.data.frame zoo#> frequency = 13 observations per 1 quarter#> frequency = 13 observations per 1 quarter#> frequency = 13 observations per 1 quarter#> frequency = 13 observations per 1 quarter#> frequency = 13 observations per 1 quarter#> frequency = 13 observations per 1 quarter#> frequency = 13 observations per 1 quarter#> frequency = 13 observations per 1 quarter#> frequency = 13 observations per 1 quarter#> frequency = 13 observations per 1 quarter#> frequency = 13 observations per 1 quarter#> frequency = 13 observations per 1 quarter#> frequency = 13 observations per 1 quarter#> frequency = 13 observations per 1 quarter#> frequency = 13 observations per 1 quarter#> frequency = 13 observations per 1 quarter#> frequency = 13 observations per 1 quarter#> frequency = 13 observations per 1 quarter#> frequency = 13 observations per 1 quarter#> frequency = 13 observations per 1 quarter#> frequency = 12.5 observations per 1 quarter#> frequency = 12.5 observations per 1 quarter#> frequency = 12.5 observations per 1 quarter#> frequency = 12.5 observations per 1 quarter#> v 1 of 1 tuning: rec_arima (10.4s)best_results<-grid_results %>%
extract_workflow_set_result("rec_arima") %>%
select_best(metric="rmse")
test_results<-grid_results %>%
extract_workflow("rec_arima") %>%
finalize_workflow(best_results)
#> Error in `parsnip::update_dot_check()` at modeltime/R/parsnip-arima_reg.R:258:4:#> ! Extra arguments will be ignored: `include.mean`
The problem
I'm having trouble when trying to finish the workflow after applying the tune_grid function through worfklow_map. When I extract the best hyperparameters and introduce them in the
finalize_workflow()
function I get the following error as one of them is engine specific.Here is a related problem with a solution: tidymodels/tune#254
I think it is necessary to change the update method of the definition of the
arima
model. Not sure if maybe others as well, I just try arima.Reproducible example
Created on 2022-08-09 by the reprex package (v2.0.1)
Session info
The text was updated successfully, but these errors were encountered: