business-science / modeltime

Modeltime unlocks time series forecast models and machine learning in one framework
https://business-science.github.io/modeltime/
Other
532 stars 82 forks source link

Error: Tuning nnetar_reg() hyperparameter num_networks #34

Closed MxNl closed 4 years ago

MxNl commented 4 years ago

Hello Matt,

thanks again for you fas implementation of NNETAR. I tried it out today and came accross the following error after trying to tune the num_networks hyperparameter using the following code:

tune_nnetar_model <-
  nnetar_reg(
    seasonal_period = 12,
    non_seasonal_ar = 1,
    seasonal_ar = 1,
    hidden_units = tune(),
    num_networks = tune(),
    penalty = tune(),
    epochs = tune()
  ) %>%
  set_engine("nnetar") %>%
  set_mode("regression")

Tuning

n_levels <- 1
tune_grid <- grid_regular(
  hidden_units(),
  num_networks(),
  penalty(),
  epochs(),
  levels = n_levels
)

Workflow

nnetar_workflow <- 
  workflow() %>% 
  add_model(tune_nnetar_model) %>% 
  add_recipe(steenkopies_recipe)

Modelling with resamples

nnetar_resampling <- 
  nnetar_workflow %>% 
  tune_grid(
    resamples = resampling_strategy_cv5fold,
    grid = tune_grid)
Error: Problem with `mutate()` input `object`. x Error when calling num_networks(): Error : 'num_networks' is not an exported object from 'namespace:dials' i Input `object` is `purrr::map(call_info, eval_call_info)`.

Sorry for asking if the cause should be obvious but I couldn't find anything related in the documentation. I can add a reprex if needed.

mdancho84 commented 4 years ago

It should work now. I accidentally had it pointing to dials when num_networks() is in modeltime