modeltime_wfs_heatmap: Modeltime workflowsets heatmap plot

Description Usage Arguments Details Value Examples

View source: R/modeltime_wfs_heatmap.R

Description

generate a heatmap for each recipe and model on a object generated with the modeltime_wfs_fit() function.

Usage

1
2
3
4
5
6
modeltime_wfs_heatmap(
  .wfs_results,
  metric = "rsq",
  low_color = "#c7e9b4",
  high_color = "#253494"
)

Arguments

.wfs_results

a tibble generated with the modeltime_wfs_fit() function.

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).

Details

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.

Value

a ggplot heatmap.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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)

sknifedatar::modeltime_wfs_heatmap(wffits, 'rsq')

sknifedatar documentation built on June 1, 2021, 9:08 a.m.