table_modeltime_accuracy: Interactive Accuracy Tables

Description Usage Arguments Details Value Examples

View source: R/modeltime-accuracy-table.R

Description

Converts results from modeltime_accuracy() into either interactive (reactable) or static (gt) tables.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
table_modeltime_accuracy(
  .data,
  .round_digits = 2,
  .sortable = TRUE,
  .show_sortable = TRUE,
  .searchable = TRUE,
  .filterable = FALSE,
  .expand_groups = TRUE,
  .title = "Accuracy Table",
  .interactive = TRUE,
  ...
)

Arguments

.data

A tibble that is the output of modeltime_accuracy()

.round_digits

Rounds accuracy metrics to a specified number of digits. If NULL, rounding is not performed.

.sortable

Allows sorting by columns. Only applied to reactable tables. Passed to reactable(sortable).

.show_sortable

Shows sorting. Only applied to reactable tables. Passed to reactable(showSortable).

.searchable

Adds search input. Only applied to reactable tables. Passed to reactable(searchable).

.filterable

Adds filters to table columns. Only applied to reactable tables. Passed to reactable(filterable).

.expand_groups

Expands groups dropdowns. Only applied to reactable tables. Passed to reactable(defaultExpanded).

.title

A title for static (gt) tables.

.interactive

Return interactive or static tables. If TRUE, returns reactable table. If FALSE, returns static gt table.

...

Additional arguments passed to reactable::reactable() or gt::gt() (depending on .interactive selection).

Details

Groups

The function respects dplyr::group_by() groups and thus scales with multiple groups.

Reactable Output

A reactable() table is an interactive format that enables live searching and sorting. When .interactive = TRUE, a call is made to reactable::reactable().

table_modeltime_accuracy() includes several common options like toggles for sorting and searching. Additional arguments can be passed to reactable::reactable() via ....

GT Output

A gt table is an HTML-based table that is "static" (e.g. non-searchable, non-sortable). It's commonly used in PDF and Word documents that does not support interactive content.

When .interactive = FALSE, a call is made to gt::gt(). Arguments can be passed via ....

Table customization is implemented using a piping workflow (%>%). For more information, refer to the GT Documentation.

Value

A static gt table or an interactive reactable table containing the accuracy information.

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
27
28
29
30
31
32
library(tidyverse)
library(lubridate)
library(timetk)
library(parsnip)
library(rsample)

# Data
m750 <- m4_monthly %>% filter(id == "M750")

# Split Data 80/20
splits <- initial_time_split(m750, prop = 0.9)

# --- MODELS ---

# Model 1: auto_arima ----
model_fit_arima <- arima_reg() %>%
    set_engine(engine = "auto_arima") %>%
    fit(value ~ date, data = training(splits))


# ---- MODELTIME TABLE ----

models_tbl <- modeltime_table(
    model_fit_arima
)

# ---- ACCURACY ----

models_tbl %>%
    modeltime_calibrate(new_data = testing(splits)) %>%
    modeltime_accuracy() %>%
    table_modeltime_accuracy()

modeltime documentation built on July 16, 2021, 9:08 a.m.