Get and set the last cv object
last_cv.Rd
last_cv()
returns the last generated “cv” object.
This allows recovering a cross-validation if you have (for example) used the
method cv_performance.multimodel()
directly, in which case
the “cv” is not saved.
set_last_cv(value)
causes that value
will be returned by last_cv()
.
Value
last_cv()
returns a cv
object,
Examples
data(mcycle, package = "MASS")
m <- lm(accel ~ times, mcycle)
cv_performance(m) # m %>% cv %>% cv_performance
#> --- Performance table ---
#> Metric: rmse
#> train_rmse test_rmse time_cv
#> model 45.959 45.811 0.008
last_cv() # recovers unsaved output from cv() in previous call
#> --- A “cv” object containing 1 validated model ---
#>
#> Validation procedure: Complete k-fold Cross-Validation
#> Number of obs in data: 133
#> Number of test sets: 10
#> Size of test sets: ~13
#> Size of training sets: ~120
#>
#> Model:
#>
#> ‘model’:
#> model class: lm
#> formula: accel ~ times
#> metric: rmse