generate a heatmap for each recipe and model on a object generated with the modeltime_wfs_fit()
function.
modeltime_wfs_heatmap( .wfs_results, metric = "rsq", low_color = "#c7e9b4", high_color = "#253494" )
.wfs_results | a tibble generated with the |
---|---|
metric | a metric the metric used for the heatmap values: 'mae', 'mape','mase','smape','rmse','rsq'. |
low_color | color for the worst metric (highest error or lowest rsq). |
high_color | color for the better metric (lowest error or highest rsq). |
a ggplot heatmap.
assumes that the workflows included in the 'workflow_set' object are named M_name_of_model, since the .model_id is recipe_nameMname_of_model and the 'M' is used to separate the recipe from the model name.
library(modeltime) library(dplyr) library(parsnip) library(earth) data <- sknifedatar::data_avellaneda %>% mutate(date=as.Date(date)) %>% filter(date<'2011-01-01') recipe_date <- recipes::recipe(value ~ ., data = data) %>% recipes::step_date(date, features = c('dow','doy','week','month','year')) mars_backward <- mars(prune_method ='backward', mode = 'regression') %>% set_engine('earth') mars_forward <- mars(prune_method = 'forward', mode = 'regression') %>% set_engine('earth') wfsets <- workflowsets::workflow_set( preproc = list( date = recipe_date), models = list(M_mars_backward = mars_backward, M_mars_forward = mars_forward), cross = TRUE) wffits <- sknifedatar::modeltime_wfs_fit(.wfsets = wfsets, .split_prop = 0.6, .serie=data)#>#>#>#>#> ✓ Training finished OK.#>#>#> ── 2 models fitted ♥ ───────────────────────────────────────────────────────────#>#> 0 models deleted x ──#>sknifedatar::modeltime_wfs_heatmap(wffits, 'rsq')