9.2 Update Model

Update to fit a regression decision tree

rt_spec <- 
  parsnip::decision_tree() %>%
  parsnip::set_engine(engine = "rpart") %>% 
  parsnip::set_mode("regression")
rt_wf <- 
  all_wf %>% 
  workflows::update_model(rt_spec)
all_fitwf <- rt_wf %>%
  tune::last_fit(ames_split)

all_fitwf %>%
  tune::collect_metrics()
## # A tibble: 2 x 3
##   .metric .estimator .estimate
##   <chr>   <chr>          <dbl>
## 1 rmse    standard   39730.   
## 2 rsq     standard       0.701
all_fitwf %>% tune::collect_predictions()
## # A tibble: 732 x 4
##    id                 .pred  .row Sale_Price
##    <chr>              <dbl> <int>      <int>
##  1 train/test split 107845.     2     105000
##  2 train/test split 137889.     3     172000
##  3 train/test split 167715.     8     191500
##  4 train/test split 168788.    10     189000
##  5 train/test split 167715.    14     171500
##  6 train/test split 344321.    16     538000
##  7 train/test split 194020.    17     164000
##  8 train/test split 168788.    21     190000
##  9 train/test split 137889.    25     149900
## 10 train/test split 107845.    27     126000
## # … with 722 more rows