8.67 Final evauation

Last fit

xgb_last_fit <- 
     xgb_wf %>% 
     finalize_workflow(select_best(xgb_rs, "rmse")) %>% 
     last_fit(carseats_split)

xgb_last_fit
## # Resampling results
## # Manual resampling 
## # A tibble: 1 × 6
##   splits            id               .metrics .notes   .predictions .workflow 
##   <list>            <chr>            <list>   <list>   <list>       <list>    
## 1 <split [300/100]> train/test split <tibble> <tibble> <tibble>     <workflow>

Collect metrics

xgb_last_fit %>% collect_metrics()
## # A tibble: 2 × 4
##   .metric .estimator .estimate .config             
##   <chr>   <chr>          <dbl> <chr>               
## 1 rmse    standard       1.41  Preprocessor1_Model1
## 2 rsq     standard       0.712 Preprocessor1_Model1

RMSE: 1.42 R-squared: 0.706