Skip to contents

An internal function used by modeltime_resample_accuracy().

Usage

unnest_modeltime_resamples(object)

Arguments

object

A Modeltime Table that has a column '.resample_results'

Value

Tibble with columns for '.row_id', '.resample_id', '.model_id', '.model_desc', '.pred', '.row', and actual value name from the data set

Details

The following data columns are unnested and prepared for evaluation:

  • .row_id - A unique identifier to compare observations.

  • .resample_id - A unique identifier given to the resample iteration.

  • .model_id and .model_desc - Modeltime Model ID and Description

  • .pred - The Resample Prediction Value

  • .row - The actual row value from the original dataset

  • Actual Value Column - The name changes to target variable name in dataset

Examples


# The .resample_results column is deeply nested
m750_training_resamples_fitted
#> # Modeltime Table
#> # A tibble: 3 × 4
#>   .model_id .model     .model_desc             .resample_results
#>       <int> <list>     <chr>                   <list>           
#> 1         1 <workflow> ARIMA(0,1,1)(0,1,1)[12] <rsmp[+]>        
#> 2         2 <workflow> PROPHET                 <rsmp[+]>        
#> 3         3 <workflow> GLMNET                  <rsmp[+]>        

# Unnest and prepare the resample predictions for evaluation
unnest_modeltime_resamples(m750_training_resamples_fitted)
#> # A tibble: 432 × 7
#>    .row_id .resample_id .model_id .model_desc              .pred  .row value
#>      <int> <chr>            <int> <chr>                    <dbl> <int> <dbl>
#>  1       1 Slice1               1 ARIMA(0,1,1)(0,1,1)[12]  9033.   259  8800
#>  2       2 Slice1               1 ARIMA(0,1,1)(0,1,1)[12]  9329.   260  9360
#>  3       3 Slice1               1 ARIMA(0,1,1)(0,1,1)[12]  9507.   261  9650
#>  4       4 Slice1               1 ARIMA(0,1,1)(0,1,1)[12] 10157.   262 10280
#>  5       5 Slice1               1 ARIMA(0,1,1)(0,1,1)[12] 10308.   263 10410
#>  6       6 Slice1               1 ARIMA(0,1,1)(0,1,1)[12] 10202.   264 10240
#>  7       7 Slice1               1 ARIMA(0,1,1)(0,1,1)[12] 10278.   265 10380
#>  8       8 Slice1               1 ARIMA(0,1,1)(0,1,1)[12] 10277.   266 10390
#>  9       9 Slice1               1 ARIMA(0,1,1)(0,1,1)[12] 10478.   267 10580
#> 10      10 Slice1               1 ARIMA(0,1,1)(0,1,1)[12] 10500.   268 10560
#> # ℹ 422 more rows