mdancho84 / modeltime-iterative-forecasting

3 stars 6 forks source link

Workflows - Parsnip #3

Open AlbertoAlmuinha opened 3 years ago

AlbertoAlmuinha commented 3 years ago

Hi @mdancho84 ,

I have been looking at the issue of using only workflows or also using parsnip models and I think it is best to force the use of workflows.

The code I think is well assembled as you have developed it and I think it would have to be rethought to include the parsnip models, I think it would also be enough to use a workflow with model + formula which is really something simple for the user as well.

What do you think? @mdancho84 @rafzamb

rafzamb commented 3 years ago

I agree with @AlbertoAlmuinha , I think that adding support for parsnip models would not be too much, I do not see so complicated, perhaps limiting the parsnip models to only use date and value, for more regressors if to force a workflow to be used.

Additionally for the checks of the modeltime_nested_fit() function, it would be enough to use tune :: is_workflow (). Models that are not workflows (and if parsnip) can finally be transformed into workflows, but for the user it would be nice to give them the flexibility to choose.

mdancho84 commented 3 years ago

Thinking through this, a quick and easy solution is to allow fitted parsnip models. I can pull the preprocessor, which is simple to do. Something like this will work because the formula is attached as a preprocessor:

fit_prophet <- prophet_reg(seasonality_yearly = TRUE) %>%
    fit(value ~ date, data = training(nested_data_tbl$.splits[[1]]))

Unfitted Parnsip Models (Model Spec's) will still fail, but we don't need to make assumptions. If the user wants to use the parsnip method, they just need to fit on one of the samples.